Docker Deployment
This section provides detailed information about deploying Snakemon using Docker containers.
Quick Start
The simplest way to get Snakemon running with Docker:
# Clone the repository
git clone https://github.com/bilgehannevruz/snakemon
cd snakemon
# Start the containers
docker-compose up -d
# Access the UI
# Open http://localhost:5173 in your browser
Container Architecture
Snakemon uses a multi-container setup:
Backend Container: * Built from
./Dockerfile* Runs the FastAPI service on port 8000 * Provides the REST API endpoints for Snakemake monitoring * Manages database connections and persistenceFrontend Container: * Built from
./frontend/Dockerfile* Nginx server hosting the React SPA on port 80 (mapped to 5173) * Communicates with the backend API
Container Configuration
Database Configuration
The backend container supports two database options:
SQLite (Default):
environment: DATABASE_URL: "sqlite:///./snakemon.db"Important: For data persistence with SQLite, add a volume mount:
volumes: - ./data:/app/data # Mount a directory to persist the SQLite databasePostgreSQL:
environment: DATABASE_URL: "postgresql://user:password@postgres:5432/snakemon" # Add a postgres service postgres: image: postgres:14 environment: POSTGRES_USER: user POSTGRES_PASSWORD: password POSTGRES_DB: snakemon volumes: - postgres_data:/var/lib/postgresql/data
Custom Network Configuration
For more complex setups, you can customize the network configuration:
networks:
snakemon-network:
driver: bridge
services:
backend:
networks:
- snakemon-network
frontend:
networks:
- snakemon-network
Production Deployment
For production deployments, consider these additional steps:
Use PostgreSQL for database reliability and performance
Set up reverse proxy (like Nginx or Traefik) for HTTPS support
Configure proper volume mounts for data persistence
Add health checks to the containers
Adjust resource limits based on expected load
Example production docker-compose section:
backend:
restart: always
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/api/service-info"]
interval: 30s
timeout: 10s
retries: 3
deploy:
resources:
limits:
cpus: '1'
memory: 1G
Troubleshooting
Database Connection Issues:
Verify the DATABASE_URL environment variable
For PostgreSQL, ensure the database service is running
Check network connectivity between containers
Frontend Can’t Connect to Backend:
Verify that VITE_API_BASE_URL is set correctly
Ensure the backend container is running and healthy
Check if the ports are correctly mapped
Container Fails to Start:
Check logs:
docker-compose logs backendVerify that ports aren’t already in use on the host
Ensure Docker has sufficient resources