diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..f589086 --- /dev/null +++ b/.env.example @@ -0,0 +1,14 @@ +# LocalSpot Environment Configuration +# Copy this file to .env and update the values + +# Required: Generate with `mix phx.gen.secret` +SECRET_KEY_BASE= + +# Database configuration +DATABASE_URL=postgres://postgres:postgres@db:5432/localspot +POSTGRES_USER=postgres +POSTGRES_PASSWORD=postgres +POSTGRES_DB=localspot + +# Application host (your domain) +PHX_HOST=localhost diff --git a/.gitignore b/.gitignore index 652cc1a..677d52c 100644 --- a/.gitignore +++ b/.gitignore @@ -35,3 +35,8 @@ localspot-*.tar npm-debug.log /assets/node_modules/ +# Environment files with secrets +.env +.env.local +.env.*.local + diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..124ead2 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,49 @@ +# Docker Compose configuration for LocalSpot production deployment +# +# Usage: +# 1. Copy .env.example to .env and configure your settings +# 2. Run: docker compose up -d +# +# For first-time setup, run migrations: +# docker compose exec localspot /app/bin/migrate + +services: + localspot: + image: forgejo.sivic.me/kevinsivic/localspot:latest + # Or build locally: + # build: . + restart: unless-stopped + ports: + - "4000:4000" + environment: + - DATABASE_URL=${DATABASE_URL:-postgres://postgres:postgres@db:5432/localspot} + - SECRET_KEY_BASE=${SECRET_KEY_BASE} + - PHX_HOST=${PHX_HOST:-localhost} + - PORT=4000 + depends_on: + db: + condition: service_healthy + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:4000/"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 40s + + db: + image: postgres:16-alpine + restart: unless-stopped + volumes: + - postgres_data:/var/lib/postgresql/data + environment: + - POSTGRES_USER=${POSTGRES_USER:-postgres} + - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-postgres} + - POSTGRES_DB=${POSTGRES_DB:-localspot} + healthcheck: + test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-postgres}"] + interval: 10s + timeout: 5s + retries: 5 + +volumes: + postgres_data: