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:
- Test โ runs all tests (
mvn test) - Build + push โ Docker image โ Amazon ECR
- 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.