Operations

Environment Variables

Variable Default Description

PORT

8080

HTTP server listen port

LOG_LEVEL

info

Log verbosity (debug, info, warn, error)

DATABASE_URL

PostgreSQL connection string (e.g. postgres://user:pass@host/db)

ESCHER_DISABLED

false

Set to true to disable Escher authentication (dev/test only)

ESCHER_CREDENTIAL_SCOPE

Escher credential scope

ESCHER_KEY_DB

Escher key database (JSON)

PG_NAME

Cloud SQL database name (used with Cloud SQL Auth Proxy)

PG_USER

Cloud SQL database user

PG_INSTANCE_CONNECTION_NAME

Cloud SQL instance connection name

When DATABASE_URL is set it takes precedence over the PG_* Cloud SQL variables.

Deployment

The service is deployed via GAP. The deployment pipeline:

  1. Builds the Docker image

  2. Runs cmd/migrate as a pre-deploy job to apply any pending database migrations

  3. Deploys the cmd/api HTTP server

  4. Keeps cmd/maintenance running as a cron job every 10 minutes

Service accounts:

  • Staging: me-e2e@ems-mobile-engage-staging.iam.gserviceaccount.com

  • Production: me-e2e@ems-mobile-engage.iam.gserviceaccount.com

Database Migrations

Migrations are managed with goose. To run manually:

make build-migrate
./bin/migrate

Or against a specific database:

DATABASE_URL=postgres://... ./bin/migrate

Building Locally

# Build all binaries
make build-all

# Run tests (also runs migrations)
make test-all

# Regenerate Swagger docs from code comments
make generate-docs

Healthcheck

# Basic liveness
curl http://localhost:8080/healthcheck

# Liveness + database reachability
curl http://localhost:8080/healthcheckDependencies

Both return {"success":true} on success.

Error Codes

HTTP Status Code When

400

INVALID_REQUEST

Malformed request body or parameters

401

AUTHENTICATION_ERROR

Invalid or missing Escher signature

404

NOT_FOUND

Resource does not exist

500

GENERIC_ERROR

Unexpected internal error