Skip to content

Deployment (Administrator)

Guide for DevOps and system administrators.

Deployment options

Method When to use
GitHub Actions Production (recommended)
deploy.sh Manual deploy on VPS
Docker Compose Local / staging

Quick production deploy (GitHub Actions)

  1. Configure Secrets in the valera7623/AI-medical-assistant repository:
  2. VPS_HOST, VPS_USER, VPS_SSH_KEY
  3. SECRET_KEY, APP_PORT, CORS_ORIGINS
  4. Push to main triggers .github/workflows/deploy.yml.
  5. Pipeline: testdeploy (SSH to VPS).
gh run list --workflow=deploy.yml --limit 1
gh run watch --exit-status

Manual deploy on VPS

ssh aima-vps
cd ~/AI_medical_assistant
git fetch origin && git reset --hard origin/main
./deploy.sh production

The deploy.sh script:

  • pulls latest code;
  • in production builds DATABASE_URL from POSTGRES_PASSWORD;
  • runs compose down + build + up -d (containers recreated with current .env);
  • applies SQL migrations from app/db/migrations/ (or Alembic);
  • runs scripts/docker_cleanup.sh deploy.

Sync new keys from .env.example without overwriting secrets:

python scripts/sync_env_from_example.py

Post-deploy check

curl -s http://localhost:8001/health/ready
# {"status":"ready","database":"ok","redis":"ok"}

VPS layout

~/AI_medical_assistant/
├── .env                 # secrets (not in git)
├── docker-compose.prod.yml
├── site/                # MkDocs (mounted :ro)
├── storage/             # encrypted files + DICOM
├── backups/             # age archives
└── deploy.sh

Ports

Service Port (default)
FastAPI (app) 8001
Redis (host) 6380 → 6379 in container

Nginx/Caddy/Traefik on the VPS proxies HTTPS → localhost:8001.

More detail