Skip to content

Deployment Guide

Overview

This guide covers deployment of Lager Guru to production environments using Docker and Nginx.

Prerequisites

  • Docker and Docker Compose installed
  • Nginx installed (for reverse proxy)
  • Domain name configured (optional)
  • SSL certificate (for HTTPS)

Docker Deployment

Build and Run

bash
# Build Docker image
docker build -t lager-guru:latest .

# Or use docker-compose
docker compose up -d --build

Environment Variables

Create a .env file:

bash
VITE_SUPABASE_URL=https://your-project.supabase.co
VITE_SUPABASE_PUBLISHABLE_KEY=your-anon-key
VITE_WEB_PUSH_PUBLIC_KEY=your-vapid-public-key

Health Check

After deployment, verify the application is running:

bash
curl http://localhost/health.html

Nginx Configuration

Basic Configuration

See deploy/nginx.conf for basic configuration with:

  • Security headers
  • SPA routing support
  • Internal network restrictions

Production Configuration

For production, use deploy/nginx-lager-guru.hashmatrix.de.conf which includes:

  • SSL/TLS configuration
  • Domain-specific settings
  • Optimized caching

Setup Steps

  1. Copy configuration file:
bash
sudo cp deploy/nginx-lager-guru.hashmatrix.de.conf /etc/nginx/sites-available/lager-guru
  1. Create symbolic link:
bash
sudo ln -s /etc/nginx/sites-available/lager-guru /etc/nginx/sites-enabled/
  1. Test configuration:
bash
sudo nginx -t
  1. Reload Nginx:
bash
sudo systemctl reload nginx

CI/CD Deployment

Automated Deployment

Deployment is automated via GitHub Actions when you push a version tag:

bash
git tag -a v1.0.0 -m "Release version 1.0.0"
git push origin v1.0.0

The CI/CD pipeline will:

  1. Build Docker image
  2. Push to GitHub Container Registry
  3. Deploy to production server
  4. Run health checks

Manual Deployment

Use the deployment script on the server:

bash
cd /var/www/lager-guru
./scripts/deploy.sh

Server Setup

Initial Setup

  1. Clone repository:
bash
git clone https://github.com/your-org/lager-guru.git
cd lager-guru
  1. Create .env file with production credentials

  2. Start services:

bash
docker compose up -d

Updating

  1. Pull latest changes:
bash
git pull origin main
  1. Rebuild and restart:
bash
docker compose up -d --build

Monitoring

Health Checks

Monitor the health endpoint:

bash
curl http://your-domain.com/health.html

Logs

View Docker logs:

bash
docker compose logs -f lager-guru

Resource Usage

Check container resources:

bash
docker stats

Troubleshooting

Container Won't Start

  1. Check logs: docker compose logs lager-guru
  2. Verify environment variables
  3. Check port availability
  4. Verify Docker daemon is running

Nginx Errors

  1. Test configuration: sudo nginx -t
  2. Check error logs: sudo tail -f /var/log/nginx/error.log
  3. Verify file permissions
  4. Check firewall rules

Database Connection Issues

  1. Verify Supabase credentials in .env
  2. Check network connectivity
  3. Verify RLS policies
  4. Check Supabase dashboard

Security Considerations

Production Checklist

  • [ ] HTTPS enabled with valid SSL certificate
  • [ ] Security headers configured
  • [ ] Environment variables secured
  • [ ] Database credentials protected
  • [ ] Firewall rules configured
  • [ ] Regular backups scheduled
  • [ ] Monitoring and alerting set up

Network Security

  • Configure allowed IP ranges in Nginx
  • Use VPN for internal access
  • Implement rate limiting
  • Enable DDoS protection

Backup and Recovery

Database Backups

Use the provided backup script:

bash
./scripts/backup-db.sh

Application Backups

Backup Docker volumes:

bash
docker run --rm -v lager-guru_data:/data -v $(pwd):/backup alpine tar czf /backup/backup.tar.gz /data

Recovery

Restore from backup:

bash
docker run --rm -v lager-guru_data:/data -v $(pwd):/backup alpine tar xzf /backup/backup.tar.gz -C /

Scaling

Horizontal Scaling

  1. Deploy multiple instances behind load balancer
  2. Use shared database (Supabase)
  3. Configure sticky sessions if needed

Vertical Scaling

  1. Increase container resources
  2. Optimize database queries
  3. Add caching layer

Performance Optimization

Caching

  • Enable browser caching for static assets
  • Use CDN for global distribution
  • Implement service worker caching

Database Optimization

  • Add appropriate indexes
  • Use materialized views for analytics
  • Optimize RLS policies

Maintenance

Regular Tasks

  • Update dependencies
  • Review and rotate credentials
  • Monitor resource usage
  • Review security logs
  • Test backup and recovery

See Maintenance Guide for detailed checklist.

Released under Commercial License