4.9 KiB
EuchreCamp CasaOS Deployment Guide
This guide explains how to deploy EuchreCamp on your CasaOS server.
Prerequisites
- CasaOS installed on your server
- Docker and Docker Compose available in CasaOS
- Port 3000 available for the web interface
- Port 5432 available for PostgreSQL (or use external database)
Quick Start
Option 1: Using CasaOS App Store (Recommended)
-
Open CasaOS Dashboard
-
Go to App Store → Custom App
-
Click Install and configure the following:
Basic Settings:
- App Name:
EuchreCamp - Image:
euchre-camp:latest(build locally first) - Port:
3000
Environment Variables:
BETTER_AUTH_SECRET=your-secret-key-here BETTER_AUTH_URL=http://your-casaos-ip:3000 TRUSTED_ORIGINS=http://your-casaos-ip:3000 - App Name:
-
Click Install
Option 2: Using Docker Compose
-
Build the Docker image:
docker-compose -f docker-compose.casaos.yml build -
Start the application:
docker-compose -f docker-compose.casaos.yml up -d -
Check logs:
docker-compose -f docker-compose.casaos.yml logs -f
Configuration
Required Environment Variables
| Variable | Description | Example |
|---|---|---|
BETTER_AUTH_SECRET |
Secret key for session encryption (generate with openssl rand -base64 32) |
your-generated-secret |
BETTER_AUTH_URL |
Public URL of your application | http://192.168.1.100:3000 |
TRUSTED_ORIGINS |
Comma-separated list of trusted origins | http://192.168.1.100:3000 |
Optional Environment Variables
| Variable | Description | Default |
|---|---|---|
POSTGRES_PASSWORD |
PostgreSQL password (change from default!) | euchrepassword |
Database Management
First-Time Setup
-
The PostgreSQL container will automatically initialize on first run
-
Database migrations will be applied automatically
-
Default admin user can be created via script:
docker exec -it euchre-camp node scripts/create-admin-via-api.js
Accessing the Database
# Connect to PostgreSQL container
docker exec -it euchre-camp-postgres psql -U euchre_camp -d euchre_camp
# List tables
\dt
# Exit
\q
Backing Up Data
# Backup PostgreSQL data
docker exec euchre-camp-postgres pg_dump -U euchre euchre_camp > backup.sql
# Backup uploaded files
tar -czf euchre_camp_files.tar.gz /var/lib/docker/volumes/euchre_camp_app_data
Security Considerations
Change Default Passwords
-
PostgreSQL Password:
- Edit
docker-compose.casaos.ymlor set via CasaOS environment variables - Update
POSTGRES_PASSWORDto a strong password
- Edit
-
Better Auth Secret:
openssl rand -base64 32- Use this value for
BETTER_AUTH_SECRET
- Use this value for
HTTPS Setup
For production use with HTTPS:
-
Option A: CasaOS Reverse Proxy
- Configure CasaOS to use HTTPS
- Update
BETTER_AUTH_URLtohttps://your-domain.com
-
Option B: External Reverse Proxy (Nginx, Traefik)
- Configure your reverse proxy
- Update
TRUSTED_ORIGINSto include your domain
Firewall Rules
Ensure only necessary ports are exposed:
- Port 3000: Web interface (HTTP/HTTPS)
- Port 5432: PostgreSQL (only if external access needed)
Troubleshooting
Database Connection Issues
# Check PostgreSQL logs
docker logs euchre-camp-postgres
# Check if PostgreSQL is healthy
docker exec euchre-camp-postgres pg_isready -U euchre -d euchre_camp
Application Not Starting
# Check application logs
docker logs euchre-camp
# Check if Prisma migrations are applied
docker exec euchre-camp npx prisma migrate status
Permission Issues
If you see permission errors:
# Fix volume permissions
docker exec euchre-camp chown -R euchre:euchre /app/public/uploads
Performance Tuning
PostgreSQL Optimization
Add to docker-compose.casaos.yml under postgres service:
environment:
- POSTGRES_SHARED_BUFFERS=256MB
- POSTGRES_WORK_MEM=16MB
Application Optimization
The Dockerfile is already optimized with:
- Multi-stage build (smaller image size)
- Non-root user for security
- Health checks
- Production-ready settings
Updating
To update EuchreCamp:
# Pull latest changes
git pull origin main
# Rebuild and restart
docker-compose -f docker-compose.casaos.yml down
docker-compose -f docker-compose.casaos.yml build --no-cache
docker-compose -f docker-compose.casaos.yml up -d
Monitoring
View Logs
docker-compose -f docker-compose.casaos.yml logs -f
Check Container Status
docker ps | grep euchre
Resource Usage
docker stats euchre-camp euchre-camp-postgres
Support
For issues or questions:
- Check the application logs first
- Verify environment variables are set correctly
- Ensure PostgreSQL is running and accessible
- Check CasaOS app logs for deployment issues