Skip to content

API Server Setup

The API server runs at api.pgas.ph and is served via Caddy as a reverse proxy in front of the application container.

api-server/
├── docker-compose.yml
├── Caddyfile
├── .env
└── app/ # API application source or mounted volume
services:
api:
image: # TODO: specify API image
container_name: pgas-api
restart: unless-stopped
env_file:
- .env
expose:
- "3000"
caddy:
image: caddy:2-alpine
container_name: pgas-api-caddy
restart: unless-stopped
ports:
- "80:80"
- "443:443"
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile:ro
- caddy_data:/data
- caddy_config:/config
volumes:
caddy_data:
caddy_config:
api.pgas.ph {
reverse_proxy api:3000
}

Caddy handles TLS automatically via Let’s Encrypt. No additional certificate configuration is needed as long as port 443 is reachable from the internet.

Create a .env file in the project directory:

Terminal window
# TODO: add application-specific environment variables
Terminal window
docker compose pull
docker compose up -d
  • TODO: document the API application itself (language, framework, etc.)
  • TODO: document any database or external service dependencies
  • TODO: document health check endpoint