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)¶
- Configure Secrets in the
valera7623/AI-medical-assistantrepository: VPS_HOST,VPS_USER,VPS_SSH_KEYSECRET_KEY,APP_PORT,CORS_ORIGINS- Push to
maintriggers.github/workflows/deploy.yml. - Pipeline: test → deploy (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_URLfromPOSTGRES_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.