The project consists of two main (independent) modules:
You can collaborate on any of them independently by modifying only the module you would like to change.
-
Packing as a WAR file with the API server only
- You need Java 8 in order to generate the WAR and a servlet container (such as Apache Tomcat) in order to deploy it.
- From the location
server/
rungradle bootWar
.
-
API + Angular Client
- You need to have Node.js 8.9 or higher, together with NPM 5.5.1 or higher installed.
- Consider modifying the file
client/src/environments/environment.prod.ts
, by setting the valueapiBaseUrl
to the value of the API base url. This takes as defaulthttp://127.0.0.1/gms/api/
. - From the location
server/
rungradle bootWar -Pclient=true
. - Optionally you can modify other behaviors for the client app while generating the WAR using the following commands:
-
client
, use-Pclient=true
for generating the client Angular app. -
clientDoc
, use-PclientDoc=true
for generating the client app documentation. -
clientDependencies
, use-PclientDependencies=true
for (re)installing all node dependencies before creating the WAR. Use this options if it is the first time you create the WAR file. Once the dependencies have been installed this can be safely skipped next time. -
clientDeployUrl
, use-PclientDeployUrl=<deploy-url>
for specifying the base url were the WAR will be deployed. This is where the static resources will be allocated by the Angular app. For example, supposing the WAR is deployed under a domainwww.example.com
under the sub-domainsub1
(full path would bewww.example.com/sub1
), you should set as<deploy-url>
the value/sub1/
. -
clientBaseUrl
, use-PclientBaseUrl=<base-url>
for specifying the base url for resolving all the resources (js, css, images, etc). Generally it can be set to the same value as the<deploy-url>
and its default values is./
.- An example of build with the first two parameters enabled to true would be
gradle bootWar -Pclient=true -PclientDoc=true
.
- An example of build with the first two parameters enabled to true would be
-
This will create a WAR file inside
server/build/libs
ready to be deployed. -
Database configuration
- Create a PostgreSQL database.
- Open the WAR file and set the proper connection parameters inside the file
WEB-INF/classes/config/application-production.properties
- Save the file and update it inside the WAR file.
- Deploy the WAR file.
Note: If you don't have Gradle installed, you can use the command ./gradlew
instead of gradle
for the previous mentioned steps.
- Make a local working copy of the project (
git clone https://github.com/lealceldeiro/gms.git
).
- Open (import) the folder server in the working copy of the project.
- Configure the gradle options.
- Select the distribution of gradle to be used. The default option is "Use default gradle wrapper", but if you like you can check the "Use local gradle distribution" if you have gradle installed on your PC (in which case you must set the "Gradle home" directory.
- Select the JVM.
- Select the project format (
.idea (directory based)
in this case).
- This will create an IntelliJ IDEA project with one module (server). Here you should choose to add the root directory to the VCS.
Open Module Settings
(F4) and add a new module (+ green sign) and select theImport Module
option.
- Select the folder
client
in the same level of theserver
folder.
- Select the option "Create module from existing source".
- Next.
- In the window "Import Module", keep the checkbox checked and click "Next";
- Finish (this will search for the Angular CLI framework) installed through the angular-cli node package.
- This will create another module on the project (client).