Skip to content

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

  1. Start the Application: Run the following command to start all services in detached mode:

    Bash
    docker compose up -d
    

  2. 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:

    Bash
    docker 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 STATUS column. All containers should display healthy or running.
  • 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:

Bash
docker compose logs

2. Monitor Resource Usage

To monitor resource usage (CPU, memory, etc.) for all running containers:

Bash
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:

Bash
docker logs -f <container_name>
- Replace <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:

Bash
docker restart <container_name>

5. Check Container Health Status

Inspect the health status of a specific container to understand why it might be unhealthy:

Bash
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:

Bash
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):

Bash
docker compose down -v


Example Debugging Workflow

1. Start the application:

Bash
docker compose up -d

2. Verify container status:

Bash
docker ps

3. Check logs for errors:

View global logs:

Bash
docker compose logs
View logs for a specific container:
Bash
docker logs -f <container_name>

4. Monitor resource usage:

Bash
docker stats

5. Restart an unhealthy container:

Bash
docker restart <container_name>

6. Inspect health status:

Bash
docker inspect --format='{{json .State.Health}}' <container_name>

7. Rebuild and restart containers (if necessary):

Bash
docker compose up -d --build


Notes

  • Health Checks: Ensure that health checks are correctly configured in the docker-compose.yml file for all services. This helps Docker determine the health status of containers.
  • Container Names: Use docker ps to list all running containers and identify their names or IDs.