Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ SESSION_SECRET=your_session_secret_here
# Authorized email addresses (comma separated)
AUTHORIZED_EMAILS=your_email@example.com,another_admin@example.com

# Logging Configuration
LOG_LEVEL=debug
NODE_ENV=production

# Production Configuration (for HTTPS production mode only)
# Only needed when using Caddyfile.https-production
DOMAIN=yourdomain.com
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ jobs:
docker compose exec -T app curl -f http://localhost:3001/ -o /dev/null -s

# Test internal application endpoints
docker compose exec -T app curl -f http://localhost:3001/race-settings -o /dev/null -s
docker compose exec -T app curl -f http://localhost:3001/api/race-settings -o /dev/null -s

echo "✅ Application health test passed"

Expand All @@ -89,7 +89,7 @@ jobs:
curl -f http://localhost/ -o /dev/null -s -v

# Test API endpoints through Caddy
curl -f http://localhost/race-settings -o /dev/null -s
curl -f http://localhost/api/race-settings -o /dev/null -s

# Test that we get proper headers from Caddy
response_headers=$(curl -I http://localhost/ 2>/dev/null)
Expand Down Expand Up @@ -118,7 +118,7 @@ jobs:
}

# Test API endpoints return valid JSON
race_settings=$(curl -s http://localhost/race-settings)
race_settings=$(curl -s http://localhost/api/race-settings)
echo "$race_settings" | jq . > /dev/null || {
echo "❌ Race settings endpoint doesn't return valid JSON"
echo "Response:"
Expand All @@ -127,7 +127,7 @@ jobs:
}

# Test leaderboard endpoint
leaderboard=$(curl -s http://localhost/leaderboard)
leaderboard=$(curl -s http://localhost/api/leaderboard)
echo "$leaderboard" | jq . > /dev/null || {
echo "❌ Leaderboard endpoint doesn't return valid JSON"
echo "Response:"
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ RUN apk add --no-cache curl
# Set the working directory in the container
WORKDIR /usr/src/app

# Copy package*.json files
# Copy package files for dependency installation
COPY package*.json ./

# Install dependencies
RUN npm ci --only=production
# Install dependencies (production only)
RUN npm ci --omit=dev && npm cache clean --force

# Copy the rest of the application code
COPY . .
Expand Down
7 changes: 6 additions & 1 deletion config/Caddyfile.http
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@ http://localhost {
encode gzip

log {
output file /var/log/caddy/access.log
output file /var/log/caddy/access.log {
roll_size 10MB
roll_keep 14
roll_keep_for 720h
}
format json
level INFO
}
}
7 changes: 6 additions & 1 deletion config/Caddyfile.https-production
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,12 @@
encode gzip

log {
output file /var/log/caddy/access.log
output file /var/log/caddy/access.log {
roll_size 10MB
roll_keep 14
roll_keep_for 720h
}
format json
level INFO
}
}
28 changes: 24 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Reusable configuration blocks
x-healthcheck-defaults: &healthcheck-defaults
interval: 30s
timeout: 10s
interval: 10s
timeout: 5s
retries: 3
start_period: 30s

services:
db:
Expand All @@ -13,9 +14,15 @@ services:
POSTGRES_PASSWORD: ${DB_PASSWORD}
volumes:
- db_data:/var/lib/postgresql/data
ports:
- 5432:5432
# Uncomment for database debugging/access from host:
# ports:
# - 5432:5432
restart: unless-stopped
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
healthcheck:
<<: *healthcheck-defaults
test: [CMD-SHELL, "pg_isready -U ${DB_USER} -d ${DB_NAME}"]
Expand All @@ -35,12 +42,20 @@ services:
- GOOGLE_CALLBACK_URL=${GOOGLE_CALLBACK_URL}
- SESSION_SECRET=${SESSION_SECRET}
- AUTHORIZED_EMAILS=${AUTHORIZED_EMAILS}
- LOG_LEVEL=${LOG_LEVEL:-info}
- NODE_ENV=${NODE_ENV:-production}
volumes:
- uploads_shared:/usr/src/app/public/uploads
- ./logs:/usr/src/app/logs
depends_on:
db:
condition: service_healthy
restart: unless-stopped
logging:
driver: "json-file"
options:
max-size: "20m"
max-file: "10"
healthcheck:
<<: *healthcheck-defaults
test: [CMD-SHELL, "curl -f http://localhost:${PORT}/ || exit 1"]
Expand Down Expand Up @@ -74,6 +89,11 @@ services:
db:
condition: service_healthy
restart: unless-stopped
logging:
driver: "json-file"
options:
max-size: "50m"
max-file: "7"
networks:
- app-network

Expand Down
Loading
Loading