Skip to main content

Server Deployment

This guide covers deploying Ody's Rope to a production server.

Deployment Methods

The repository includes a GitHub Actions workflow at .github/workflows/deploy.yml.

QA (automatic)

Merging a pull request into main deploys to QA automatically.

Production (manual)

  1. Go to the Actions tab → Deploy workflow
  2. Click Run workflow
  3. Select Production and the branch to deploy (usually main)
  4. Click Run workflow

You can also run a manual QA deploy from any branch via Run workflowQA.

Manual Deployment

If you prefer manual deployment:

1. SSH to Server

ssh user@your-server.com

2. Clone/Update Repository

cd /var/www/starteralgo
git pull origin main

3. Install Dependencies

pip install -r requirements.txt

4. Run Migrations

alembic upgrade head

5. Restart Application

systemctl restart starteralgo

Docker Deployment

Using Docker Compose

docker-compose up -d

Docker Configuration

The docker-compose.yml file configures:

  • Flask application container
  • Nginx reverse proxy
  • Volume mounts for persistent data

Environment Variables

Set these environment variables in production:

VariableDescription
FLASK_SECRET_KEYFlask secret key
DATABASE_URLDatabase connection string
WORKOS_CLIENT_IDWorkOS client ID
WORKOS_API_KEYWorkOS API key

Nginx Configuration

The default Nginx configuration is in nginx/conf.d/default.conf:

server {
listen 80;
server_name your-domain.com;

location / {
proxy_pass http://127.0.0.1:4000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}

SSL/TLS Setup

For production, always use HTTPS. Use Let's Encrypt for free SSL certificates:

certbot --nginx -d your-domain.com

Monitoring

Application Logs

Logs are stored in the logs/ directory:

tail -f logs/app.log

Process Status

Check if the application is running:

systemctl status starteralgo

Troubleshooting

Application won't start

  1. Check logs: tail -f logs/app.log
  2. Verify environment variables are set
  3. Check database connectivity
  4. Ensure port 4000 is not in use

Database migration errors

  1. Check Alembic migration history: alembic history
  2. Verify database permissions
  3. Run migrations manually: alembic upgrade head

Nginx 502 Bad Gateway

  1. Check if Flask app is running
  2. Verify Nginx configuration
  3. Check firewall rules