Liking cljdoc? Tell your friends :D

Deployment

For systemd, nginx, Fly.io and Render — with the reference configs from resources/deploy/ — see Deployment Patterns.

Build an uberjar

clojure -T:build clean && clojure -T:build uber

This produces target/wagoe-*.jar.

Run the server

export JWT_SECRET="your-production-secret-min-32-chars"
export WAG_ENV="production"
export POSTGRES_HOST="db.example.com" POSTGRES_DB="myapp" POSTGRES_USER="myapp"
export POSTGRES_PASSWORD="..."

java -jar target/wagoe-*.jar server

Environment variables

VariableRequiredDescription

JWT_SECRET

Yes

Minimum 32 characters. Used for signing JWT tokens.

WAG_ENV

Yes

development, test, acc, or production.

POSTGRES_HOST, POSTGRES_DB, POSTGRES_USER, POSTGRES_PASSWORD

Production

PostgreSQL connection. POSTGRES_PORT defaults to 5432.

SENTRY_DSN

Production, unless ERROR_REPORTING_PROVIDER=no-op

The prod profile reports errors to Sentry and refuses to boot without a DSN.

REDIS_HOST, REDIS_PORT, REDIS_PASSWORD

When using Redis

Redis connection.

Database migrations

clojure -M:migrate up

Run migrations before starting the server in production; the prod profile does not migrate on start, and the jar has no migrate command.

Docker

wagoe new writes a Dockerfile:

docker build -t my-wagoe-app .
docker run -e JWT_SECRET="..." -e WAG_ENV=production -p 3000:3000 my-wagoe-app

Configuration per environment

Aero reads from resources/conf/{WAG_ENV}/config.edn. The production config uses environment variables for all secrets:

;; resources/conf/prod/config.edn
:wagoe/postgresql
{:host     #env "POSTGRES_HOST"
 :port     #long #or [#env "POSTGRES_PORT" 5432]
 :dbname   #env "POSTGRES_DB"
 :user     #env "POSTGRES_USER"
 :password #env "POSTGRES_PASSWORD"}

JWT_SECRET is read from the environment directly, not from the config.

To read secrets that Docker or Kubernetes mount as files, use #secret: #secret [:file "db-password"] reads /run/secrets/db-password. See config for the sources and how to add one.

Database recommendations

Wagoe supports PostgreSQL, SQLite and MySQL 8, and H2 for tests. Switch a generated app with bb setup --database mysql.

EnvironmentDatabase

Development

SQLite (zero config)

Tests

H2 in-memory

Staging / Production

PostgreSQL (recommended)

PostgreSQL is required for multi-tenancy (wagoe-tenant). Search (wagoe-search) uses PostgreSQL full-text search there and a LIKE match elsewhere. On SQLite, MySQL or H2, an application with :wagoe/tenant in its config refuses to boot; a test profile on H2 sets :allow-h2? true under :wagoe/tenant.

Can you improve this documentation? These fine people already did:
thijscreemers & Thijs Creemers
Edit on GitHub

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close