From 067053525b200cf5505b72f8ccc059213800e644 Mon Sep 17 00:00:00 2001 From: Joshua Ryder Date: Mon, 6 Oct 2025 17:35:22 -0400 Subject: [PATCH] Docker compose adjustments --- .env.example | 14 --------- README.md | 73 +++++++++++++++++++++++----------------------- docker-compose.yml | 16 +++++----- 3 files changed, 45 insertions(+), 58 deletions(-) delete mode 100644 .env.example diff --git a/.env.example b/.env.example deleted file mode 100644 index e06b837..0000000 --- a/.env.example +++ /dev/null @@ -1,14 +0,0 @@ -# Site Configuration -# The public URL where your application will be hosted -# This is used for QR codes and other absolute URLs -SITE_URL=https://your-domain.com - -# Authentication Secret -# Generate a secure random string for production -# You can use: openssl rand -hex 32 -AUTH_SECRET=change-this-secret-in-production - -# Admin Credentials -# Set your admin username and password here -ADMIN_USERNAME=admin -ADMIN_PASSWORD=admin123 diff --git a/README.md b/README.md index 28edb53..574f78b 100644 --- a/README.md +++ b/README.md @@ -23,24 +23,35 @@ A web application for managing and displaying weekly sermons for New Life Christ ## Configuration -This application uses environment variables for configuration. These must be set before building the Docker image. +This application uses environment variables configured directly in `docker-compose.yml`. Edit the file to customize your deployment settings. ### Environment Variables -| Variable | Description | Required | Default | -|----------|-------------|----------|---------| -| `SITE_URL` | Public URL where the app is hosted (used for QR codes) | Yes | `https://nlcc.rydertech.us` | -| `AUTH_SECRET` | Secret key for authentication sessions | Yes | `change-this-secret-in-production` | -| `ADMIN_USERNAME` | Admin login username | Yes | `admin` | -| `ADMIN_PASSWORD` | Admin login password | Yes | `admin123` | +| Variable | Description | Default | +|----------|-------------|---------| +| `SITE_URL` | Public URL where the app is hosted (used for QR codes) | `https://nlcc.rydertech.us` | +| `AUTH_SECRET` | Secret key for authentication sessions | `change-this-secret-in-production-please` | +| `ADMIN_USERNAME` | Initial admin login username | `admin` | +| `ADMIN_PASSWORD` | Initial admin login password | `Admin123!` | -### Setting Up Environment Variables +### Customizing Configuration -Create a `.env` file in the project root: +Edit `docker-compose.yml` and update the values in both the `build.args` and `environment` sections: -```bash -SITE_URL=https://your-church-domain.com -AUTH_SECRET=your-secure-random-secret-here +```yaml +services: + nlcc-itinerary: + build: + args: + - SITE_URL=https://your-church-domain.com + - AUTH_SECRET=your-secure-random-secret-here + - ADMIN_USERNAME=your-admin-username + - ADMIN_PASSWORD=your-secure-password + environment: + - SITE_URL=https://your-church-domain.com + - AUTH_SECRET=your-secure-random-secret-here + - ADMIN_USERNAME=your-admin-username + - ADMIN_PASSWORD=your-secure-password ``` **Generate a secure AUTH_SECRET:** @@ -62,26 +73,13 @@ git clone cd nlcc-itinerary ``` -2. Create a `.env` file from the example: -```bash -cp .env.example .env -``` +2. Edit `docker-compose.yml` and configure your settings: + - Update `SITE_URL` to your public domain + - Generate and set a secure `AUTH_SECRET` (use `openssl rand -hex 32`) + - Set your desired `ADMIN_USERNAME` and `ADMIN_PASSWORD` + - Make sure to update values in BOTH `build.args` AND `environment` sections -3. Edit `.env` and configure your settings: -```bash -# Required: Set your public URL (used for QR codes) -SITE_URL=https://your-domain.com - -# Required: Set a secure authentication secret -# Generate with: openssl rand -hex 32 -AUTH_SECRET=your-secure-random-secret-here - -# Required: Set your admin credentials -ADMIN_USERNAME=your-admin-username -ADMIN_PASSWORD=your-secure-password -``` - -4. Build and run with Docker Compose: +3. Build and run with Docker Compose: ```bash docker-compose up -d --build ``` @@ -90,15 +88,18 @@ The application will be available at `http://localhost:3002` (or your configured **Important**: The `SITE_URL` must be set correctly for QR codes to work. This should be the public URL where your application is accessible (e.g., `https://church.example.com`). -### Admin Credentials +### Initial Admin Account -Admin credentials are now configured via environment variables (`ADMIN_USERNAME` and `ADMIN_PASSWORD`). Set these in your `.env` file before building the Docker image. +The initial admin account is created automatically on first run using the credentials specified in `docker-compose.yml`: -**Default values** (if not set in `.env`): +**Default values**: - **Username**: admin -- **Password**: admin123 +- **Password**: Admin123! -⚠️ **Important**: Always change these default credentials in production by setting `ADMIN_USERNAME` and `ADMIN_PASSWORD` in your `.env` file. +⚠️ **Important**: +- Change these credentials in `docker-compose.yml` before deploying to production +- After the first build, you can change the admin password through the user management interface +- Additional users can be created through the registration page ## Project Structure diff --git a/docker-compose.yml b/docker-compose.yml index 3d43a11..46d258e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,10 +3,10 @@ services: build: context: . args: - - SITE_URL=${SITE_URL:-https://nlcc.rydertech.us} - - AUTH_SECRET=${AUTH_SECRET:-change-this-secret-in-production} - - ADMIN_USERNAME=${ADMIN_USERNAME:-admin} - - ADMIN_PASSWORD=${ADMIN_PASSWORD:-admin123} + - SITE_URL=https://nlcc.rydertech.us + - AUTH_SECRET=change-this-secret-in-production-please + - ADMIN_USERNAME=admin + - ADMIN_PASSWORD=Admin123! container_name: nlcc-itinerary ports: - "3002:3000" @@ -14,8 +14,8 @@ services: - ./data:/app/data environment: - NODE_ENV=production - - AUTH_SECRET=${AUTH_SECRET:-change-this-secret-in-production} - - SITE_URL=${SITE_URL:-https://nlcc.rydertech.us} - - ADMIN_USERNAME=${ADMIN_USERNAME:-admin} - - ADMIN_PASSWORD=${ADMIN_PASSWORD:-admin123} + - AUTH_SECRET=change-this-secret-in-production-please + - SITE_URL=https://nlcc.rydertech.us + - ADMIN_USERNAME=admin + - ADMIN_PASSWORD=Admin123! restart: unless-stopped