Deployment
Deploying the application is straightforward. Once you've completed the configuration, use the following steps to start and verify the application. Additional debugging options are provided to help troubleshoot any issues during deployment.
Steps to Deploy the Application¶
-
Start the Application: Run the following command to start all services in detached mode:
Bashdocker compose up -d -
Verify Container Status: Check the status of all containers to ensure they are running and healthy. The all applications will be healty about 3-4 minutes:
Bashdocker ps
If the process takes longer than 5 minutes, it may indicate that your CPU does not meet the minimum performance requirements.
- Look for the
STATUScolumn. All containers should displayhealthyorrunning. - If any container shows
unhealthy, proceed to the debugging steps below.
The default users are superuser and user with password password.
Debugging Options¶
If you encounter issues during deployment, use the following commands to identify and resolve problems.
1. View Global Logs¶
To view logs from all containers managed by the docker-compose.yml file:
docker compose logs
2. Monitor Resource Usage¶
To monitor resource usage (CPU, memory, etc.) for all running containers:
docker stats
This is particularly useful for identifying containers that are consuming excessive resources.
3. View Specific Container Logs¶
To view logs for a specific container, use the following command:
docker logs -f <container_name>
<container_name> with the name or ID of the container (e.g., backend, frontend, database).
- The -f option allows you to follow the logs in real time.
4. Restart a Specific Container¶
If a container is not responding or is in an unhealthy state, restart it:
docker restart <container_name>
5. Check Container Health Status¶
Inspect the health status of a specific container to understand why it might be unhealthy:
docker inspect --format='{{json .State.Health}}' <container_name>
6. Check Docker Compose Configuration¶
Validate the docker-compose.yml file to ensure there are no syntax errors:
docker compose config
7. Stop and Remove Containers (if needed)¶
If you need to stop and completely remove all containers (e.g., to clean up before redeployment):
docker compose down -v
Example Debugging Workflow¶
1. Start the application:
docker compose up -d
2. Verify container status:
docker ps
3. Check logs for errors:
View global logs:
docker compose logs
docker logs -f <container_name>
4. Monitor resource usage:
docker stats
5. Restart an unhealthy container:
docker restart <container_name>
6. Inspect health status:
docker inspect --format='{{json .State.Health}}' <container_name>
7. Rebuild and restart containers (if necessary):
docker compose up -d --build
Notes¶
- Health Checks: Ensure that health checks are correctly configured in the
docker-compose.ymlfile for all services. This helps Docker determine the health status of containers. - Container Names: Use
docker psto list all running containers and identify their names or IDs.