Local Run => yarn start
React project, it display all the cats you have stored in the Backend with a fetch on a setInterval
you can start a local version with yarn start
App.js is where the main logic is stored and the only file you should have to change to extend the project
Back:
Local Run => docker-compose -f docker-compose.yml -f docker-compose.local.yml up
Node Project that setup a Express REST API
We can create new cats and query them with this api
database.ts Is where the mongo connection and schemas are declared, and the environement variables are used.
We build an image build for each branch we want a dockerfile
dev.Dockerfile we use yarn start
to have live reload and dev environement
The file are localy binded with docker so we can modify them directly
master.Dockerfile copy the project builded version inside the image and serve the site with nginx
docker-compose.yml we use ${}
to escape env variables CI_COMMIT_REF_NAME is provided by gitlab an represent the branch name and CI_HOST that we use to define the host for our service
We provide env PORT to for yarn start
to be on port 80
and REACT_APP_API_HOST for the host the rest api is located at
Same as front we build an image build for each branch we want a dockerfile
dev.Dockerfile We setup node and start the server from nodaemon a live-reload for node The file are localy binded with docker so we can modify them directly
master.Dockerfile We copy the project file to the image and launch the node server
docker-compose.yml we use ${}
to escape env variables CI_HOST that we use to define the host for our service
we also extend this docker-compose with docker-compose.local.yml and docker-compose.prod.yml they give aditional arguments to our deployements.
.prod
adds the labels to our service so it can be deployed by a orchestrator and is registered by traefik
.local
build localy the image and adds the ports of mongo and Redis making debug easier