Knowledge Base – Deployment Guide

Overview

This guide walks you through deploying the application to production environments, covering prerequisites, step‑by‑step procedures, rollback strategies, and best practices.

Prerequisites

  • Operating System: Ubuntu 22.04 LTS or later
  • Docker Engine ≥ 20.10
  • Docker Compose ≥ 2.5
  • Access to the private container registry
  • Environment variables configured for production

Deployment Steps

1️⃣ Pull Latest Images
docker pull myregistry.example.com/app:latest
2️⃣ Create .env File
# .env.production
APP_ENV=production
DB_HOST=db-prod.example.com
DB_USER=app_user
DB_PASS=strong_password
3️⃣ Deploy with Docker Compose
docker compose -f docker-compose.prod.yml up -d --remove-orphans
4️⃣ Verify Deployment
docker ps --filter "ancestor=myregistry.example.com/app:latest"

Rollback Procedure

If the new version causes issues, revert to the previous stable tag.

docker compose -f docker-compose.prod.yml down
docker pull myregistry.example.com/app:stable
docker compose -f docker-compose.prod.yml up -d

FAQ

❓ How do I view container logs?
docker logs -f <container_name>
❓ What to do if the database connection fails?
Check that DB_HOST, DB_USER, and DB_PASS are correct in the .env.production file and ensure the DB server allows connections from the application host.