Dockerise all services
DomVinyard opened this issue · 0 comments
DomVinyard commented
Task:
We currently have a full-stack application with a database and Hasura in Docker, but our Node API and React Web packages are not yet in Docker. In order to improve the portability, scalability and ease of deployment of our application, we would like to dockerize these components as well.
The goal of this ticket is to dockerize our Node API and React Web packages so that the entire application is running within Docker containers. The following tasks need to be completed:
- Move the
docker-compose.yaml
file into the project root directory and update any file paths so it still functions correctly and the database still loads - Add 2 new services to Docker Compose to run the containers for the Node API, and React Web packages
- Start the api after the database. Start the web service after the api service. (Google
Docker compose depends_on
) - Test the application to ensure that everything is working as expected
- Running
npm start
in the root directory should start all services. You will need to create a newpackage.json
file in the root directory to define this start script. - Ensure that hot reloading works, aka, when you modify your code you get automatically updated preview of your changes. For the api package this is handled by nodemon and for the web package this is handled by react-scripts. You will need to look into Docker Volumes for this.
Once this ticket is completed, we should be able to deploy our application in any environment that supports Docker with a single command.
Acceptance Criteria
- The entire application can be run with a single command
npm start
from the project's root directory and all components are running as expected. - The Docker Compose file has been updated to include services for the Node API and React Web packages alongside the two existing services (database engine and database api)
- The services are started in the correct order.
- The API endpoints can be accessed from the React Web package and the data is displayed correctly on the frontend.
- The application is able to interact with the database and Hasura service without any issues.
- Hot reloading works, when you make a change to your code the correct service automatically restarts.