Skip to content

Commit

Permalink
Add frontend to docker compose and add 3rd party api key variables to…
Browse files Browse the repository at this point in the history
… example env
  • Loading branch information
shrir committed Nov 29, 2024
1 parent f624a41 commit dda2e8d
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 17 deletions.
31 changes: 24 additions & 7 deletions .env.docker.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ LITESTAR_DEBUG=true
LITESTAR_HOST=0.0.0.0
LITESTAR_PORT=8000
APP_URL=http://localhost:${LITESTAR_PORT}

LOG_LEVEL=10

# Database
DATABASE_ECHO=true
DATABASE_ECHO_POOL=true
DATABASE_POOL_DISABLE=false
DATABASE_POOL_MAX_OVERFLOW=5
DATABASE_POOL_SIZE=5
DATABASE_POOL_TIMEOUT=30
DATABASE_URL=postgresql+asyncpg://app:app@db:5432/app
DATABASE_URL=postgresql+asyncpg://app_user:app_password@db:5432/chapter-app-db

# Cache
REDIS_URL=redis://cache:6379/0
Expand All @@ -23,8 +23,25 @@ SAQ_WEB_ENABLED=True
SAQ_BACKGROUND_WORKERS=1
SAQ_CONCURRENCY=1

VITE_HOST=localhost
VITE_PORT=3006
VITE_HOT_RELOAD=True
VITE_DEV_MODE=True
ALLOWED_CORS_ORIGINS=["localhost:3006","localhost:8000"]
# 3rd party tokens

# logo.dev
LOGO_DEV_TOKEN=

# scraperapi.com
SCRAPERAPI_API_KEY=

# openai.com
OPENAI_MODEL_NAME=
OPENAI_API_KEY=

# peopledatalabs.com
PDL_API_KEY=

# pitchbook.com
PB_API_KEY=

# Frontend
NEXT_PUBLIC_POSTHOG_KEY=
NEXT_PUBLIC_POSTHOG_HOST= https://eu.posthog.com
NEXT_PUBLIC_CHAPTER_API_URL=${APP_URL}/api
37 changes: 29 additions & 8 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ services:
timeout: 3s
retries: 30
db:
image: postgres:latest
image: postgres:16
ports:
- "15432:5432"
hostname: db
environment:
POSTGRES_PASSWORD: "app"
POSTGRES_USER: "app"
POSTGRES_DB: "app"
POSTGRES_PASSWORD: "app_password"
POSTGRES_USER: "app_user"
POSTGRES_DB: "chapter-app-db"
volumes:
- db-data:/var/lib/postgresql/data
restart: unless-stopped
Expand All @@ -43,7 +43,9 @@ services:
- CMD
- pg_isready
- -U
- app
- app_user
- -d
- chapter-app-db
interval: 2s
timeout: 3s
retries: 40
Expand All @@ -63,7 +65,13 @@ services:
environment:
SAQ_USE_SERVER_LIFESPAN: "false"
env_file:
- .env.docker.example
- .env
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
interval: 30s
retries: 3
start_period: 10s
timeout: 5s
worker:
image: app:latest
command: litestar workers run
Expand All @@ -74,18 +82,31 @@ services:
cache:
condition: service_healthy
env_file:
- .env.docker.example
- .env
migrator:
image: app:latest
restart: "no"
command: litestar database upgrade --no-prompt
env_file:
- .env.docker.example
- .env
depends_on:
db:
condition: service_healthy
cache:
condition: service_healthy
frontend:
build:
context: .
dockerfile: deploy/docker/run/Dockerfile.frontend
image: frontend:latest
restart: always
depends_on:
app:
condition: service_healthy
ports:
- "3000:3000"
env_file:
- .env
volumes:
db-data: {}
cache-data: {}
5 changes: 3 additions & 2 deletions frontend/next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const nextConfig = {
images: {
domains: ["img.logo.dev"], // Add the domain you want to allow
},
};
output: "standalone",
}

export default nextConfig;
export default nextConfig

0 comments on commit dda2e8d

Please sign in to comment.