mirror of
https://github.com/kikootwo/ReadMeABook.git
synced 2026-06-02 20:30:10 +00:00
8.3 KiB
8.3 KiB
ReadMeABook - Docker Deployment Guide
Quick Start
Prerequisites
- Docker Engine 20.10+
- Docker Compose V2
- 2GB+ available disk space
- Ports 3000 available on host
First Time Setup
- Clone the repository
git clone <your-repo-url>
cd ReadMeABook
- Create required directories
mkdir -p config downloads media
- Generate secure secrets
# Generate NEXTAUTH_SECRET (minimum 32 characters)
openssl rand -base64 32
- Edit docker-compose.yml
Update the following environment variables in docker-compose.yml:
environment:
# REQUIRED: Change these values
DATABASE_URL: postgresql://readmeabook:YOUR_SECURE_PASSWORD@postgres:5432/readmeabook
NEXTAUTH_SECRET: YOUR_GENERATED_SECRET_FROM_STEP_3
# Update if not running on localhost
NEXTAUTH_URL: http://localhost:3000
Also update the PostgreSQL password in the postgres service:
postgres:
environment:
POSTGRES_PASSWORD: YOUR_SECURE_PASSWORD # Must match DATABASE_URL
- Start the application
docker compose up -d
- View logs
# Follow all logs
docker compose logs -f
# Or just the application
docker compose logs -f app
- Access the application
Open your browser to:
- Application: http://localhost:3000
- Setup Wizard: http://localhost:3000/setup
Initial Configuration
On first launch, visit http://localhost:3000/setup and configure:
-
Plex Media Server
- Your Plex server URL
- Authentication token
- Audiobook library selection
-
Prowlarr
- Prowlarr server URL
- API key
-
Download Client
- qBittorrent or Transmission
- Server URL and credentials
-
Directory Paths
- Download directory:
/downloads(already mounted) - Media directory:
/media/audiobooks(already mounted)
- Download directory:
Common Operations
View Status
docker compose ps
View Logs
# All services
docker compose logs -f
# Specific service
docker compose logs -f app
docker compose logs -f postgres
docker compose logs -f redis
Restart Application
docker compose restart app
Stop Services
docker compose down
Update Application
# Pull latest changes
git pull
# Rebuild and restart
docker compose up -d --build
# Migrations run automatically on startup
Clean Restart (Preserves Data)
docker compose down
docker compose up -d --build
Complete Reset (DELETES ALL DATA)
docker compose down -v
rm -rf config/*
docker compose up -d
Backup & Restore
Backup Database
# Create backup
docker compose exec postgres pg_dump -U readmeabook readmeabook > backup-$(date +%Y%m%d).sql
# Backup volumes
tar -czf backup-volumes-$(date +%Y%m%d).tar.gz config downloads media
Restore Database
# Restore from backup
docker compose exec -T postgres psql -U readmeabook readmeabook < backup-20240101.sql
# Restore volumes
tar -xzf backup-volumes-20240101.tar.gz
Troubleshooting
Application Won't Start
# Check logs
docker compose logs app
# Verify services are healthy
docker compose ps
# Check migrations
docker compose exec app npx prisma migrate status
# Manually run migrations
docker compose exec app npx prisma migrate deploy
Database Connection Errors
# Test PostgreSQL
docker compose exec postgres pg_isready -U readmeabook
# Check environment variables
docker compose exec app env | grep DATABASE_URL
# Restart PostgreSQL
docker compose restart postgres
Redis Connection Errors
# Test Redis
docker compose exec redis redis-cli ping
# Should return: PONG
# Restart Redis
docker compose restart redis
Port Already in Use
If port 3000 is already in use, edit docker-compose.yml:
app:
ports:
- "8080:3000" # Changed from 3000:3000
Then access at http://localhost:8080
Permission Issues
# Fix permissions on mounted directories
sudo chown -R 1001:1001 config downloads media
Advanced Configuration
Custom Port
Edit docker-compose.yml:
app:
ports:
- "8080:3000"
environment:
NEXTAUTH_URL: http://localhost:8080
External Database
To use an external PostgreSQL instance:
- Remove the
postgresservice fromdocker-compose.yml - Update
DATABASE_URLto point to your external database - Ensure network connectivity
External Redis
To use an external Redis instance:
- Remove the
redisservice fromdocker-compose.yml - Update
REDIS_URLto point to your external Redis - Ensure network connectivity
Resource Limits
Add resource limits in docker-compose.yml:
app:
deploy:
resources:
limits:
cpus: '2.0'
memory: 2G
reservations:
cpus: '1.0'
memory: 512M
Production Deployment
Recommended Changes for Production
-
Use Strong Secrets
- Generate unique NEXTAUTH_SECRET
- Use strong PostgreSQL password
- Never commit secrets to git
-
Enable HTTPS
- Use a reverse proxy (nginx, Traefik, Caddy)
- Obtain SSL certificate (Let's Encrypt)
- Update NEXTAUTH_URL to https://
-
Configure Plex OAuth
- Register application at https://www.plex.tv/
- Add PLEX_CLIENT_ID and PLEX_CLIENT_SECRET
-
Set Up Backups
- Automated database backups
- Volume snapshots
- Off-site backup storage
-
Monitor Resources
- Set up logging aggregation
- Monitor disk space
- Track application performance
Environment Variables Reference
| Variable | Required | Default | Description |
|---|---|---|---|
DATABASE_URL |
Yes | - | PostgreSQL connection string |
REDIS_URL |
Yes | - | Redis connection string |
NEXTAUTH_URL |
Yes | - | Application URL |
NEXTAUTH_SECRET |
Yes | - | JWT secret (min 32 chars) |
PLEX_CLIENT_ID |
No | - | Plex OAuth client ID |
PLEX_CLIENT_SECRET |
No | - | Plex OAuth client secret |
NODE_ENV |
No | production | Node environment |
LOG_LEVEL |
No | info | Logging level |
PORT |
No | 3000 | Application port |
Support
For issues and questions:
- Check logs:
docker compose logs - Verify health: http://localhost:3000/api/health
- Review documentation:
/documentation
Architecture
┌─────────────────────────────────────────────────────────┐
│ Docker Compose │
├─────────────────────────────────────────────────────────┤
│ ┌─────────────────────────────────────────────────┐ │
│ │ readmeabook-app (Next.js) │ │
│ │ Port: 3000 │ │
│ │ Volumes: /config, /downloads, /media │ │
│ └──────────────────┬──────────────┬───────────────┘ │
│ │ │ │
│ ┌──────────────────▼──────┐ ┌───▼──────────────┐ │
│ │ postgres:16-alpine │ │ redis:7-alpine │ │
│ │ Port: 5432 (internal) │ │ Port: 6379 │ │
│ │ Volume: pgdata │ │ Volume: redisdata│ │
│ └─────────────────────────┘ └──────────────────┘ │
└─────────────────────────────────────────────────────────┘
Host Directories:
./config → /app/config (application configuration)
./downloads → /downloads (temporary torrent downloads)
./media → /media (organized audiobook library)
Next Steps
After deployment:
- Complete setup wizard at http://localhost:3000/setup
- Configure external services (Plex, Prowlarr, qBittorrent)
- Create user accounts
- Start requesting audiobooks!