Spring Boot server for Codecharacter 2020
- Docker
- IDE - Intellij IDEA (Preferably, makes life easier)
- MongoDB GUI - Robo 3T (Optional)
-
Clone the repository
-
Create a file named build.properties and copy the contents of build.properties.example
-
Update the tomcat.dir field in build.properties file. (it's value should be the path to root of Tomcat installed location)
-
Make a file named application.properties in
src/main/resourcesfolder and copy the contents of application.properties.example -
Set the mongodb port and also update the compilebox secret key in application.properties. Also fill the rabbitmq queue name. You can get the queue name from compilebox config.
-
Make sure the rabbitmq-server is running (You can check with command
sudo systemctl status rabbitmq-server) -
Check the status of tomcat server with
sudo systemctl status tomcat. If it's active, stop it manually with the commandsudo systemctl stop tomcat. -
Run
ant runto compile, build and start the tomcat server,or
mvn spring-boot:runto compile and start. -
If it was successful your server will be hosted at
localhost:{tomcat_port_no}/{app.name}. Tomcat port is by default 8080 and app.name is present at build.properties file -
The Swagger-UI will be hosted at
localhost:{tomcat_port_no}/{app.name}/swagger-ui.html. Note: Swagger-UI will be displayed only if you're logged in.
- While testing from frontend, if you encounter an error due to CORS, do this
- If you wish to change the default tomcat port number do this
- The storage.dir in application.properties property specifies the folder where defferent code files etc are stored. To change it or to set to a relative path, see this
- The volumes directive in docker-compose.yml file mounts source directories or volumes from your computer at target paths inside the container. So here the folder at path
/home/code/Server/storagein host will be mounted on/app/tomcat/bin/storagein the container and that at/home/code/.m2will be mounted on/root/.m2(see docker-compose.yml file).
-
Clone the repository
Create a file named build.properties and copy the contents of build.properties.example
Make a file named application.properties in
src/main/resourcesfolder and copy the contents of application.properties.example -
run
storage.shwith sudo once after cloning to initialise the storage dir -
run
start.shto start the server -
Run
ant runto inside the docker terminal. Just hitCtrl+Cin the terminal and run again after making changes, no need to restart docker -
The server is hosted at
localhost:{tomcat_port_no}/. Tomcat port is by default set to 8080 (mapped to 8086 in docker). -
Swagger is hosted at
localhost:{tomcat_port_no}/{app.name}/swagger-ui.html -
run
down.shto remove the docker containers -
use the port number in the compose file to connect to db using MongoDB GUI