Production Deployment on AWS Lightsail
Infrastructureโ
Lightsail Instance (8 GB RAM, $40/month)
RDS PostgreSQL (db.t4g.small, $25/month)
ECR (container registry, ~$0.10/month)
Step 1 โ Create RDS PostgreSQLโ
AWS Console โ RDS โ Create database:
- Engine: PostgreSQL 16
- Instance:
db.t4g.small - DB name:
ajsmart - Create two databases:
smartfhirandhapifhir
Step 2 โ Create Lightsail instanceโ
- OS: Ubuntu 24.04
- Plan: 8 GB RAM ($40/month)
- Attach static IP
Open firewall ports: 80, 443, 22
Step 3 โ Install Dockerโ
ssh ubuntu@your-static-ip
sudo apt update && sudo apt install -y docker.io docker-compose-plugin nginx certbot python3-certbot-nginx
sudo usermod -aG docker ubuntu
Step 4 โ Configure and startโ
git clone https://github.com/AKHester-Technologies/aj-smart-fhir-platform
cd aj-smart-fhir-platform
cp .env.example .env
# Edit .env with your RDS endpoint, passwords, and domain URLs
SPRING_PROFILES_ACTIVE=prod docker compose up -d
Step 5 โ SSL with Let's Encryptโ
sudo certbot --nginx \
-d fhir.demo.ajfhir.org \
-d auth.demo.ajfhir.org \
--non-interactive --agree-tos -m you@ajfhir.org
Step 6 โ RSA keystore (important)โ
Without a keystore all tokens become invalid on restart:
keytool -genkeypair -alias smart-fhir-server \
-keyalg RSA -keysize 2048 -storetype PKCS12 \
-keystore ./keystore/smart-fhir-server.p12 -validity 3650
# Add to .env:
KEYSTORE_PATH=/app/keystore/smart-fhir-server.p12
KEYSTORE_PASSWORD=your-password