Docker Compose Installation¶
For easier self-hosting, you can use Docker Compose to manage the Night Routine Scheduler.
Prerequisites¶
- Docker installed
- Docker Compose installed
Quick Start¶
-
Download the docker-compose.yml file:
Or manually create a
docker-compose.ymlfile with the following content:version: '3.8' services: night-routine: image: ghcr.io/belphemur/night-routine:latest container_name: night-routine restart: unless-stopped ports: - "8080:8080" environment: - GOOGLE_OAUTH_CLIENT_ID=your-client-id-here - GOOGLE_OAUTH_CLIENT_SECRET=your-client-secret-here - CONFIG_FILE=/app/config/routine.toml - ENV=production volumes: - ./config:/app/config - ./data:/app/data -
Create the configuration directory:
-
Create a configuration file:
Download the example configuration or create
config/routine.toml:cat > config/routine.toml << 'EOF' [app] port = 8080 app_url = "http://localhost:8080" public_url = "http://localhost:8080" [parents] parent_a = "Parent1" parent_b = "Parent2" [availability] parent_a_unavailable = ["Wednesday"] parent_b_unavailable = ["Monday"] [schedule] update_frequency = "weekly" look_ahead_days = 30 past_event_threshold_days = 5 [service] state_file = "data/state.db" log_level = "info" EOF -
Edit the docker-compose.yml to set your Google OAuth credentials:
Update these lines with your actual credentials:
-
Edit the configuration file to match your needs:
-
Start the service:
Managing the Service¶
View logs¶
# View all logs
docker-compose logs
# Follow logs in real-time
docker-compose logs -f
# View logs for the last hour
docker-compose logs --since 1h
Stop the service¶
Start the service¶
Restart the service¶
Stop and remove containers¶
Data Preservation
Using docker-compose down will stop and remove containers, but your data in the ./config and ./data directories will be preserved.
Update to latest version¶
Production Deployment¶
For production deployments, consider the following enhancements:
Using Environment Files¶
Create a .env file for your environment variables:
cat > .env << 'EOF'
GOOGLE_OAUTH_CLIENT_ID=your-client-id-here
GOOGLE_OAUTH_CLIENT_SECRET=your-client-secret-here
CONFIG_FILE=/app/config/routine.toml
ENV=production
PORT=8080
EOF
Update your docker-compose.yml to use the environment file:
version: '3.8'
services:
night-routine:
image: ghcr.io/belphemur/night-routine:latest
container_name: night-routine
restart: unless-stopped
ports:
- "${PORT}:8080"
env_file:
- .env
volumes:
- ./config:/app/config
- ./data:/app/data
Security
Make sure to add .env to your .gitignore file to prevent committing sensitive credentials.
Behind a Reverse Proxy¶
When deploying behind a reverse proxy (e.g., nginx, Traefik, Caddy), update your configuration:
version: '3.8'
services:
night-routine:
image: ghcr.io/belphemur/night-routine:latest
container_name: night-routine
restart: unless-stopped
env_file:
- .env
volumes:
- ./config:/app/config
- ./data:/app/data
labels:
- "traefik.enable=true"
- "traefik.http.routers.night-routine.rule=Host(`night-routine.example.com`)"
- "traefik.http.routers.night-routine.entrypoints=websecure"
- "traefik.http.routers.night-routine.tls.certresolver=letsencrypt"
- "traefik.http.services.night-routine.loadbalancer.server.port=8080"
networks:
- traefik
networks:
traefik:
external: true
Update your config/routine.toml to reflect the public URL:
[app]
port = 8080
app_url = "http://localhost:8080" # Internal URL
public_url = "https://night-routine.example.com" # Public URL for webhooks
Directory Structure¶
After setup, your directory structure should look like:
.
├── docker-compose.yml
├── .env (optional)
├── config/
│ └── routine.toml
└── data/
└── state.db (created automatically)
Troubleshooting¶
Container won't start¶
Check the logs:
Permission issues¶
Ensure the data directory is writable:
Cannot access the web interface¶
-
Check if the container is running:
-
Verify port mapping:
-
Check firewall rules if accessing from another machine