fix: add dynamic config to pages and update Dockerfile for PostgreSQL
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
# CasaOS Optimized Docker Compose Configuration
|
||||
# This file is optimized for deployment on CasaOS
|
||||
# Usage: docker-compose -f docker-compose.casaos.yml up -d
|
||||
#
|
||||
# IMPORTANT: This configuration requires an external PostgreSQL database.
|
||||
# Set DATABASE_URL environment variable to your PostgreSQL connection string.
|
||||
|
||||
services:
|
||||
app:
|
||||
@@ -11,13 +14,12 @@ services:
|
||||
ports:
|
||||
- "3000:3000"
|
||||
environment:
|
||||
# Database Configuration
|
||||
# Database Configuration (REQUIRED: Set via CasaOS environment variables)
|
||||
- DATABASE_PROVIDER=postgresql
|
||||
- DATABASE_URL=postgresql://euchre_camp:euchrepassword@postgresql:5432/euchre_camp
|
||||
- DATABASE_SHADOW_URL=postgresql://euchre_camp:euchrepassword@postgresql:5432/euchre_camp_shadow
|
||||
- DATABASE_URL=${DATABASE_URL:-postgresql://euchre_camp:password@your-postgres-host:5432/euchre_camp}
|
||||
- DATABASE_SHADOW_URL=${DATABASE_SHADOW_URL:-postgresql://euchre_camp:password@your-postgres-host:5432/euchre_camp_shadow}
|
||||
|
||||
# Better Auth Configuration
|
||||
# IMPORTANT: Set these via CasaOS environment variables!
|
||||
- BETTER_AUTH_SECRET=${BETTER_AUTH_SECRET:-change-this-secret-in-production}
|
||||
- BETTER_AUTH_URL=${BETTER_AUTH_URL:-http://localhost:3000}
|
||||
|
||||
@@ -25,13 +27,8 @@ services:
|
||||
- NODE_ENV=production
|
||||
|
||||
# Trusted Origins for Better Auth
|
||||
# IMPORTANT: Update this with your CasaOS IP/hostname
|
||||
- TRUSTED_ORIGINS=${TRUSTED_ORIGINS:-http://localhost:3000,http://127.0.0.1:3000}
|
||||
|
||||
depends_on:
|
||||
postgresql:
|
||||
condition: service_healthy
|
||||
|
||||
volumes:
|
||||
# Persist uploaded files and static content
|
||||
- euchre_camp_app_data:/app/public/uploads
|
||||
@@ -41,32 +38,7 @@ services:
|
||||
networks:
|
||||
- euchre-network
|
||||
|
||||
postgresql:
|
||||
image: postgres:15-alpine
|
||||
container_name: euchre-camp-postgres
|
||||
environment:
|
||||
- POSTGRES_DB=euchre_camp
|
||||
- POSTGRES_USER=euchre_camp
|
||||
# IMPORTANT: Change this password in production!
|
||||
- POSTGRES_PASSWORD=euchrepassword
|
||||
ports:
|
||||
- "5432:5432"
|
||||
volumes:
|
||||
- euchre_camp_postgres_data:/var/lib/postgresql/data
|
||||
- ./scripts/init-postgres.sh:/docker-entrypoint-initdb.d/init-postgres.sh
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U euchre_camp -d euchre_camp"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
start_period: 30s
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- euchre-network
|
||||
|
||||
volumes:
|
||||
euchre_camp_postgres_data:
|
||||
driver: local
|
||||
euchre_camp_app_data:
|
||||
driver: local
|
||||
|
||||
|
||||
+22
-9
@@ -31,6 +31,9 @@ POSTGRES_PASSWORD=$(openssl rand -base64 16 | tr -d '\n')
|
||||
echo "✅ Generated BETTER_AUTH_SECRET: $BETTER_AUTH_SECRET"
|
||||
echo "✅ Generated POSTGRES_PASSWORD: $POSTGRES_PASSWORD"
|
||||
echo ""
|
||||
echo "⚠️ NOTE: The POSTGRES_PASSWORD is for reference only."
|
||||
echo " You must provide your own PostgreSQL connection string via DATABASE_URL."
|
||||
echo ""
|
||||
|
||||
# Create .env file if it doesn't exist
|
||||
if [ ! -f .env ]; then
|
||||
@@ -40,9 +43,10 @@ if [ ! -f .env ]; then
|
||||
# Generated by setup-casaos.sh
|
||||
|
||||
# Database Configuration
|
||||
# IMPORTANT: Update these with your actual PostgreSQL connection details!
|
||||
DATABASE_PROVIDER=postgresql
|
||||
DATABASE_URL=postgresql://euchre_camp:${POSTGRES_PASSWORD}@postgresql:5432/euchre_camp
|
||||
DATABASE_SHADOW_URL=postgresql://euchre_camp:${POSTGRES_PASSWORD}@postgresql:5432/euchre_camp_shadow
|
||||
DATABASE_URL=postgresql://euchre_camp:${POSTGRES_PASSWORD}@your-postgres-host:5432/euchre_camp
|
||||
DATABASE_SHADOW_URL=postgresql://euchre_camp:${POSTGRES_PASSWORD}@your-postgres-host:5432/euchre_camp_shadow
|
||||
|
||||
# Better Auth Configuration
|
||||
BETTER_AUTH_SECRET=${BETTER_AUTH_SECRET}
|
||||
@@ -65,17 +69,26 @@ echo "Setup Complete!"
|
||||
echo "=========================================="
|
||||
echo ""
|
||||
echo "Next steps for CasaOS deployment:"
|
||||
echo "1. Build the Docker image:"
|
||||
echo ""
|
||||
echo "1. Set up your PostgreSQL database (external)"
|
||||
echo " - Create database 'euchre_camp'"
|
||||
echo " - Create user 'euchre_camp' with password"
|
||||
echo " - Grant all privileges on euchre_camp database"
|
||||
echo ""
|
||||
echo "2. Configure CasaOS environment variables:"
|
||||
echo " - DATABASE_URL: postgresql://user:pass@host:5432/euchre_camp"
|
||||
echo " - BETTER_AUTH_SECRET: (generated above)"
|
||||
echo " - BETTER_AUTH_URL: http://your-casaos-ip:3000"
|
||||
echo " - TRUSTED_ORIGINS: http://your-casaos-ip:3000"
|
||||
echo ""
|
||||
echo "3. Build the Docker image:"
|
||||
echo " docker-compose -f docker-compose.casaos.yml build"
|
||||
echo ""
|
||||
echo "2. Start the application:"
|
||||
echo "4. Start the application:"
|
||||
echo " docker-compose -f docker-compose.casaos.yml up -d"
|
||||
echo ""
|
||||
echo "3. Access the application at http://localhost:3000"
|
||||
echo "5. Access the application at http://your-casaos-ip:3000"
|
||||
echo ""
|
||||
echo "4. Create admin user:"
|
||||
echo "6. Create admin user:"
|
||||
echo " docker exec -it euchre-camp node scripts/create-admin-via-api.js"
|
||||
echo ""
|
||||
echo "Important: Update BETTER_AUTH_URL and TRUSTED_ORIGINS in .env"
|
||||
echo "with your CasaOS server's IP address or hostname!"
|
||||
echo ""
|
||||
|
||||
@@ -6,6 +6,8 @@ import { getSession } from "@/lib/auth-simple"
|
||||
import type { Event as EventModel } from "@prisma/client"
|
||||
import { RecalculateEloButton } from "../../components/RecalculateEloButton"
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
export default async function AdminDashboard() {
|
||||
console.log('AdminDashboard rendering...')
|
||||
const session = await getSession()
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { prisma } from "@/lib/prisma"
|
||||
export const dynamic = "force-dynamic";
|
||||
import Navigation from "@/components/Navigation"
|
||||
import Link from "next/link"
|
||||
import { notFound, redirect } from "next/navigation"
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { prisma } from "@/lib/prisma"
|
||||
export const dynamic = "force-dynamic";
|
||||
import Navigation from "@/components/Navigation"
|
||||
import Link from "next/link"
|
||||
import { notFound, redirect } from "next/navigation"
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { prisma } from "@/lib/prisma"
|
||||
export const dynamic = "force-dynamic";
|
||||
import Navigation from "@/components/Navigation"
|
||||
import Link from "next/link"
|
||||
import { notFound, redirect } from "next/navigation"
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { prisma } from "@/lib/prisma"
|
||||
export const dynamic = "force-dynamic";
|
||||
import Navigation from "@/components/Navigation"
|
||||
import Link from "next/link"
|
||||
import { getSession } from "@/lib/auth-simple"
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { prisma } from "@/lib/prisma";
|
||||
export const dynamic = "force-dynamic";
|
||||
import { notFound } from "next/navigation";
|
||||
import Link from "next/link";
|
||||
import Navigation from "@/components/Navigation";
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { prisma } from "@/lib/prisma"
|
||||
export const dynamic = "force-dynamic";
|
||||
import Navigation from "@/components/Navigation"
|
||||
import Link from "next/link"
|
||||
import { notFound } from "next/navigation"
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { prisma } from "@/lib/prisma"
|
||||
export const dynamic = "force-dynamic";
|
||||
import Navigation from "@/components/Navigation"
|
||||
import Link from "next/link"
|
||||
import { notFound } from "next/navigation"
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { prisma } from "@/lib/prisma"
|
||||
export const dynamic = "force-dynamic";
|
||||
import Navigation from "@/components/Navigation"
|
||||
import RankingsClient from "./RankingsClient"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user