TCS-iOn-Rio
A basic spring boot REST web application served with tomcat that lets you store users and fetches all the stored users using mysql database.
Installation
git clone git@github.com:sourikghosh/tcs-ion-rio.git
cd tcs-ion-rio
cat .env.example > .env
Fill the env with the appropriate valuesmake db_files
This is the dir where mysql data is persisted.make start
This will start the webserver on port 8080 by running a docker-compose which spins up a mysql db which reads the envs from the .env.
Make command
start
runs the docker-composestop
removes the docker-compose containers and networksdb_files
makes a data dir if not already created to store the mysql datadb_rm
removes/clean all the persisted data of mysql db
Docker Image
REST-Endpoints
- create/store a user
curl -X POST localhost:8080/demo/add -d name=Sourik -d email=xyz@gmail.com
- list all the stored user
curl localhost:8080/demo/all
Steps to deploy on Docker Swarm
docker swarm init
docker stack deploy --compose-file=docker-compose.yml backend-spring
Interact with docker swarm
docker stack ls
- this will list all the stack deployeddocker stack rm <stack_name/s>
- this removes the deployed stack.If want to remove all the stack then add$(docker stack ls -q)