Backend server for NoComment
- Copy sensitive-template.properties and rename it sensitive.properties
- (Optional) Fill in the details for each option.
- Run
./gradlew build
To connect to the postgres database, the webserver will need details on how to reach and login to the database. There are two options to do this.
- Copy
application.ymlfromsrc/main/resourcesinto the work directory. - Remove everything except
nocom.ssh-tunnelandnocom.datasource.postgres - Fill in the details. If you don't need an ssh tunnel for port-forwarding, then
exclude those properties. Otherwise, set
nocom.ssh-tunnel.enabledtotrue. - When running your jar, make sure to add the config file into
spring.config.location(This will be explained more down below).
Create these system path variables before running the jar
- POSTGRES_HOSTNAME
- POSTGRES_PORT
- POSTGRES_DATABASE
- POSTGRES_USERNAME
- POSTGRES_PASSWORD
Note: This is only for postgres. It will not work if you need a ssh-tunnel.
There are two methods to run the application while in development mode.
IntelliJ will automatically detect the spring boot application and create a NocomApplication. In order to set it up properly you must provide the correct profile and (optionally) override configuration file.
-Dspring.profiles.active=dev -Dspring.config.location=classpath:/application.yml,file:./config.yml
Replace ./config.yml with whatever you named the configuration file. If you didn't
create a configuration file, then you can exclude -Dspring.config.location.
This is very simple, you only need to run ./gradle bootRun and it will handle
setting the vm parameters for you. However, it requires that you name the configuration
file config.yml.
In production, the jar should be run using java -jar. Move or create the configuration
file into the directory that the jar is in.
The result should look something like this
java -jar nocom-http-1.0-SNAPSHOT.jar -Dspring.config.location=classpath:/application.yml,file:./config.ymlTODO: Adding users into production builds