Add docker-compose for production deployment
- Add docker-compose.yml with app and postgres services - Add .env.example with required environment variables - Add .env to .gitignore to prevent committing secrets 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
ad138ddb40
commit
2025c87a8c
3 changed files with 68 additions and 0 deletions
14
.env.example
Normal file
14
.env.example
Normal file
|
|
@ -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
|
||||
5
.gitignore
vendored
5
.gitignore
vendored
|
|
@ -35,3 +35,8 @@ localspot-*.tar
|
|||
npm-debug.log
|
||||
/assets/node_modules/
|
||||
|
||||
# Environment files with secrets
|
||||
.env
|
||||
.env.local
|
||||
.env.*.local
|
||||
|
||||
|
|
|
|||
49
docker-compose.yml
Normal file
49
docker-compose.yml
Normal file
|
|
@ -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:
|
||||
Loading…
Reference in a new issue