Skip to main content

Deployment

Local developmentโ€‹

docker compose up    # starts all four services

Production โ€” AWS Lightsailโ€‹

The recommended production topology uses AWS Lightsail:

Lightsail Instance (8 GB RAM, $40/month)
โ”œโ”€โ”€ docker-compose.yml
โ”‚ โ”œโ”€โ”€ hapi-fhir (hapiproject/hapi:v7.4.0)
โ”‚ โ””โ”€โ”€ auth-server (your ECR image)
โ””โ”€โ”€ nginx (reverse proxy + Let's Encrypt SSL)

RDS PostgreSQL (db.t4g.small, $25/month)
โ”œโ”€โ”€ database: smartfhir (auth server)
โ””โ”€โ”€ database: hapifhir (HAPI)

Subdomains:
fhir.demo.ajsmart.com โ†’ HAPI :8080
auth.demo.ajsmart.com โ†’ Auth server :9000

See the production deployment guide for step-by-step instructions.

CI/CD โ€” GitHub Actionsโ€‹

Three jobs run on every push to main:

  1. Test โ€” runs all tests (mvn test)
  2. Build + push โ€” Docker image โ†’ Amazon ECR
  3. Deploy โ€” Lightsail container service updated

GitHub Secrets required: AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, DB_URL, DB_USER, DB_PASSWORD, FHIR_BASE_URL, ISSUER_URL

RSA key persistenceโ€‹

Without a keystore, a new RSA key is generated on every restart โ€” all tokens become invalid.

keytool -genkeypair -alias smart-fhir-server \
-keyalg RSA -keysize 2048 -storetype PKCS12 \
-keystore ./keystore/smart-fhir-server.p12 -validity 3650

Set KEYSTORE_PATH and KEYSTORE_PASSWORD in .env.