docs: update CasaOS deployment guide with PostgreSQL setup
This commit is contained in:
+69
-16
@@ -9,13 +9,22 @@ This guide explains how to deploy EuchreCamp on your CasaOS server.
|
||||
3. **Port 3000** available for the web interface
|
||||
4. **Port 5432** available for PostgreSQL (or use external database)
|
||||
|
||||
## Prerequisites
|
||||
|
||||
**External PostgreSQL Database Required**
|
||||
- PostgreSQL 15 or higher
|
||||
- Database name: `euchre_camp`
|
||||
- User: `euchre_camp`
|
||||
- Privileges: ALL on database `euchre_camp`
|
||||
|
||||
## Quick Start
|
||||
|
||||
### Option 1: Using CasaOS App Store (Recommended)
|
||||
|
||||
1. Open CasaOS Dashboard
|
||||
2. Go to **App Store** → **Custom App**
|
||||
3. Click **Install** and configure the following:
|
||||
1. **Set up PostgreSQL database first** (see below)
|
||||
2. Open CasaOS Dashboard
|
||||
3. Go to **App Store** → **Custom App**
|
||||
4. Click **Install** and configure the following:
|
||||
|
||||
**Basic Settings:**
|
||||
- App Name: `EuchreCamp`
|
||||
@@ -24,36 +33,78 @@ This guide explains how to deploy EuchreCamp on your CasaOS server.
|
||||
|
||||
**Environment Variables:**
|
||||
```
|
||||
DATABASE_URL=postgresql://euchre_camp:password@your-postgres-host:5432/euchre_camp
|
||||
DATABASE_SHADOW_URL=postgresql://euchre_camp:password@your-postgres-host:5432/euchre_camp_shadow
|
||||
BETTER_AUTH_SECRET=your-secret-key-here
|
||||
BETTER_AUTH_URL=http://your-casaos-ip:3000
|
||||
TRUSTED_ORIGINS=http://your-casaos-ip:3000
|
||||
```
|
||||
|
||||
4. Click **Install**
|
||||
5. Click **Install**
|
||||
|
||||
### Option 2: Using Docker Compose
|
||||
|
||||
1. **Build the Docker image:**
|
||||
1. **Set up PostgreSQL database first** (see below)
|
||||
2. **Build the Docker image:**
|
||||
```bash
|
||||
docker-compose -f docker-compose.casaos.yml build
|
||||
```
|
||||
|
||||
2. **Start the application:**
|
||||
3. **Start the application:**
|
||||
```bash
|
||||
docker-compose -f docker-compose.casaos.yml up -d
|
||||
```
|
||||
|
||||
3. **Check logs:**
|
||||
4. **Check logs:**
|
||||
```bash
|
||||
docker-compose -f docker-compose.casaos.yml logs -f
|
||||
```
|
||||
|
||||
## PostgreSQL Database Setup
|
||||
|
||||
### Option A: External PostgreSQL Server
|
||||
|
||||
Connect to your PostgreSQL server and run:
|
||||
|
||||
```sql
|
||||
-- Create database
|
||||
CREATE DATABASE euchre_camp;
|
||||
|
||||
-- Create user
|
||||
CREATE USER euchre_camp WITH PASSWORD 'your-strong-password';
|
||||
|
||||
-- Grant privileges
|
||||
GRANT ALL PRIVILEGES ON DATABASE euchre_camp TO euchre_camp;
|
||||
|
||||
-- Connect to database
|
||||
\c euchre_camp
|
||||
|
||||
-- Grant schema privileges
|
||||
GRANT ALL ON SCHEMA public TO euchre_camp;
|
||||
```
|
||||
|
||||
### Option B: CasaOS PostgreSQL Container
|
||||
|
||||
If you want to run PostgreSQL in CasaOS:
|
||||
|
||||
1. Install PostgreSQL from CasaOS App Store
|
||||
2. Configure it with:
|
||||
- Database: `euchre_camp`
|
||||
- User: `euchre_camp`
|
||||
- Password: `your-strong-password`
|
||||
3. Use the connection string in your EuchreCamp configuration:
|
||||
```
|
||||
DATABASE_URL=postgresql://euchre_camp:your-strong-password@192.168.1.100:5432/euchre_camp
|
||||
```
|
||||
(Replace `192.168.1.100` with your CasaOS IP)
|
||||
|
||||
## Configuration
|
||||
|
||||
### Required Environment Variables
|
||||
|
||||
| Variable | Description | Example |
|
||||
|----------|-------------|---------|
|
||||
| `DATABASE_URL` | PostgreSQL connection string (REQUIRED) | `postgresql://euchre_camp:pass@host:5432/euchre_camp` |
|
||||
| `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` |
|
||||
@@ -62,16 +113,18 @@ This guide explains how to deploy EuchreCamp on your CasaOS server.
|
||||
|
||||
| Variable | Description | Default |
|
||||
|----------|-------------|---------|
|
||||
| `POSTGRES_PASSWORD` | PostgreSQL password (change from default!) | `euchrepassword` |
|
||||
| `DATABASE_SHADOW_URL` | Shadow database for migrations | Same as DATABASE_URL with `_shadow` suffix |
|
||||
|
||||
## Database Management
|
||||
|
||||
### First-Time Setup
|
||||
|
||||
1. The PostgreSQL container will automatically initialize on first run
|
||||
2. Database migrations will be applied automatically
|
||||
3. Default admin user can be created via script:
|
||||
|
||||
1. **Create the database and user** (see PostgreSQL Setup above)
|
||||
2. **Run database migrations:**
|
||||
```bash
|
||||
docker exec -it euchre-camp npx prisma migrate deploy
|
||||
```
|
||||
3. **Create admin user:**
|
||||
```bash
|
||||
docker exec -it euchre-camp node scripts/create-admin-via-api.js
|
||||
```
|
||||
@@ -79,8 +132,8 @@ This guide explains how to deploy EuchreCamp on your CasaOS server.
|
||||
### Accessing the Database
|
||||
|
||||
```bash
|
||||
# Connect to PostgreSQL container
|
||||
docker exec -it euchre-camp-postgres psql -U euchre_camp -d euchre_camp
|
||||
# Connect to external PostgreSQL server
|
||||
psql -h your-postgres-host -U euchre_camp -d euchre_camp
|
||||
|
||||
# List tables
|
||||
\dt
|
||||
@@ -92,8 +145,8 @@ docker exec -it euchre-camp-postgres psql -U euchre_camp -d euchre_camp
|
||||
### Backing Up Data
|
||||
|
||||
```bash
|
||||
# Backup PostgreSQL data
|
||||
docker exec euchre-camp-postgres pg_dump -U euchre euchre_camp > backup.sql
|
||||
# Backup PostgreSQL data (run on your PostgreSQL server)
|
||||
pg_dump -h your-postgres-host -U euchre_camp euchre_camp > backup.sql
|
||||
|
||||
# Backup uploaded files
|
||||
tar -czf euchre_camp_files.tar.gz /var/lib/docker/volumes/euchre_camp_app_data
|
||||
|
||||
Reference in New Issue
Block a user