- Overview
- Technology Stack
- Prerequisites
- Repository Structure
- Deployment Guide
- Application Architecture
- Usage Guide
- Troubleshooting
- Maintenance
The DHIS2 HEAT+ Dashboard is a comprehensive data visualization and analysis platform designed to fetch, process, and visualize health equity data from DHIS2 systems. The application provides:
- Secure authentication and user management
- Data fetching from DHIS2 instances
- Interactive visualizations including charts, maps, and tables
- Data cleaning and transformation tools
- Export capabilities to multiple formats
The system is containerized using Docker for easy deployment and scalability.
graph TD
A[Client Browser] --> B[LiteSpeed/Web Server]
B --> C[NGINX Proxy]
C --> D[Shiny Application]
D --> E[DHIS2 API]
D --> F[(SQLite Database)]
subgraph Host Server
B
end
subgraph Docker Containers
C
D
end
subgraph External Services
E
end
- Shiny (R): Primary application framework
- HTML/CSS/JavaScript: UI components and styling
- Plotly: Interactive visualizations
- Leaflet/Mapbox: Geographic visualizations
graph LR
A[Shiny UI] --> B[HTML/CSS]
A --> C[JavaScript]
A --> D[Shiny Widgets]
B --> E[bslib Themes]
C --> F[Plotly.js]
C --> G[Leaflet/Mapbox]
- R: Data processing and analysis
- Shiny Server: Application hosting
- NGINX: Reverse proxy and SSL termination
- SQLite: Local user database
graph LR
A[Shiny Server] --> B[R Runtime]
B --> C[httr API Calls]
B --> D[dplyr Data Wrangling]
B --> E[ggplot2 Visualizations]
B --> F[RSQLite Database]
C --> G[DHIS2 REST API]
- Docker: Containerization
- Docker Compose: Orchestration
- LiteSpeed Web Server: Host web server (optional)
graph TB
A[Docker Host] --> B[Shiny Container]
A --> C[NGINX Container]
B --> D[Rocky Linux Base]
B --> E[Shiny Server]
C --> F[NGINX]
C --> G[SSL Termination]
A --> H[Host Web Server]
sequenceDiagram
participant C as Client
participant L as LiteSpeed
participant N as NGINX
participant S as Shiny
participant D as DHIS2
C->>L: HTTPS Request
L->>N: Proxy Pass
N->>S: Forward Request
S->>D: API Call
D-->>S: JSON Data
S-->>N: HTML Response
N-->>L: Proxy Return
L-->>C: Rendered Page
shinydashboard,shinyWidgets,DT,httr,jsonlite,arrow,dplyr,ggplot2
- Linux server (Ubuntu 20.04/22.04 recommended)
- Docker Engine (v20.10+)
- Docker Compose (v2.0+)
- Git
- SSL certificates (Let's Encrypt recommended)
- Minimum hardware:
- 4 CPU cores
- 8GB RAM
- 50GB disk space
- Ports 80, 443, 3939, 8939, 9443 open
- Domain name with DNS configured
DHIS2HEAT/
βββ app/ # Shiny application
β βββ db/ # SQLite database directory
β βββ dbackup/ # Database backups
β βββ fetched_data/ # Cached DHIS2 data
β βββ module/ # Shiny modules
β βββ saved_setting/ # Application settings
β βββ www/ # Static assets
β βββ app.R # Main application file
β βββ server.R # Server logic
β βββ ui.R # UI components
β βββ ... # Other R source files
βββ nginx_app/ # NGINX configuration
β βββ configuration/
β βββ certs/ # SSL certificates
β βββ nginx/nginx.conf # NGINX config
βββ .env # Environment variables
βββ docker-compose.yml # Docker compose config
βββ Dockerfile.shiny # Shiny container build
βββ init.deploy.sh # Initial deployment script
βββ shiny-server.conf # Shiny server config
βββ ... # Other configuration files
-
Clone the repository:
git clone https://github.com/MIKEINTOSHSYSTEMS/DHIS2HEAT.git cd DHIS2HEAT -
Set up SSL certificates:
mkdir -p nginx_app/configuration/certs # Place your certs (fullchain.pem and privkey.pem) in the certs directory -
Configure environment variables: Edit the
.envfile with your DHIS2 credentials:DHIS2_BASE_URL=https://your.dhis2.instance DHIS2_USERNAME=admin DHIS2_PASSWORD=district
-
Build and start containers:
docker-compose -p dhis2heat up -d --build
-
Verify containers are running:
docker-compose -p dhis2heat ps
-
Initialize the application:
docker exec -it moheatpdhis2 /srv/shiny-server/init.deploy.sh
-
Configure your web server (LiteSpeed example shown in original config):
- Set up reverse proxy to forward traffic to NGINX (port 8939 for HTTP, 9443 for HTTPS)
- Configure SSL termination at both LiteSpeed and NGINX levels
-
Verify SSL:
curl -v https://heat.merqconsultancy.org:9443
graph TD
A[Client] --> B[LiteSpeed:443]
B --> C[NGINX:9443]
C --> D[Shiny:3939]
D --> E[DHIS2 API]
D --> F[SQLite Database]
- Client accesses
https://heat.merqconsultancy.org - LiteSpeed handles SSL termination and forwards to NGINX
- NGINX proxies requests to Shiny Server
- Shiny Server serves the application and connects to:
- DHIS2 API for data fetching
- SQLite for user management
- 80: HTTP β 302 redirect to HTTPS
- 443: HTTPS (LiteSpeed)
- 3939: Shiny application port (internal)
- 8939: NGINX HTTP port (internal)
- 9443: NGINX HTTPS port (external)
- Access the application at
https://yourdomain.com - Register an admin account (first user becomes admin)
- Configure DHIS2 connection in Settings β Fetcher Setting
- Save settings and fetch initial data
- Data Preview: View and filter fetched data
- Visualizations: Interactive charts and maps
- Data Management: Clean and transform datasets
- User Management: Create and manage user accounts
- Export: Download data in Excel or Parquet format
Restart services:
docker-compose -p dhis2heat restartView logs:
docker-compose -p dhis2heat logs -fFull cleanup:
docker-compose -p dhis2heat down --volumes --rmi allUpdate application:
git pull origin main
docker-compose -p dhis2heat up -d --build1. SSL Errors
- Verify certificates are in
nginx_app/configuration/certs/ - Check permissions on certificate files
- Ensure NGINX config points to correct cert paths
2. Connection Timeouts
- Verify DHIS2 credentials in
.env - Check network connectivity to DHIS2 instance
- Increase timeout values in NGINX config if needed
3. Blank Dashboard
- Check Shiny server logs:
docker logs moheatpdhis2 - Verify data was fetched successfully
- Ensure required R packages are installed
- Shiny Server:
docker logs moheatpdhis2 - NGINX:
docker logs moheatpdhis2proxy - Application:
/srv/shiny-server/app/shiny_app_monitor.log
-
Database backup:
docker exec moheatpdhis2 sqlite3 /srv/shiny-server/app/db/data.sqlite ".backup '/srv/shiny-server/app/dbackup/backup.sqlite'"
-
Data backup:
docker exec moheatpdhis2 tar czvf /srv/shiny-server/app/dbackup/data_$(date +%Y%m%d).tar.gz /srv/shiny-server/app/fetched_data/
-
Pull latest changes:
git pull origin main
-
Rebuild containers:
docker-compose -p dhis2heat up -d --build
-
Restart services:
docker-compose -p dhis2heat restart
- Set up monitoring for:
- Container health
- DHIS2 API response times
- Disk space for data storage
- Application logs for errors
This documentation provides a comprehensive guide to deploying and maintaining the DHIS2 HEAT+ Dashboard. For additional support, please open an issue on the GitHub repository.
# Start
docker-compose --env-file .env -f prod.docker-compose.yml up -d
# Stop
docker-compose --env-file .env -f prod.docker-compose.yml down --volumes --rmi all
# Rebuild and restart
docker-compose --env-file .env -f prod.docker-compose.yml down && \
docker-compose --env-file .env -f prod.docker-compose.yml up -d --buildAccess your app:
- π Shiny App: https://heat.merqconsultancy.org
- π§© SQLite Browser: https://your-server-ip:3001
Verify SSL connection:
curl -v https://heat.merqconsultancy.org:9443Certificates should exist at:
nginx_app/configuration/certs/fullchain.pem
nginx_app/configuration/certs/privkey.pem
graph TD
A[Client] --> B[LiteSpeed:443]
B --> C[NGINX:9443]
C --> D[Shiny:3939]
D --> E[DHIS2 API]
D --> F[SQLite DB]
Flow:
- User connects via HTTPS to LiteSpeed
- LiteSpeed proxies to NGINX (9443)
- NGINX forwards to Shiny server (3939)
- Shiny interacts with SQLite + DHIS2 API
- Visit https://heat.merqconsultancy.org
- Register the first admin user
- Go to Settings β Fetcher Setting
- Add DHIS2 credentials and test connection
- Fetch DHIS2 data β Start exploring visualizations!
# Restart services
docker-compose --env-file .env -f prod.docker-compose.yml restart
# View live logs
docker-compose --env-file .env -f prod.docker-compose.yml logs -f
# Update app code
git pull origin main
docker-compose --env-file .env -f prod.docker-compose.yml up -d --build| Issue | Likely Cause | Resolution |
|---|---|---|
| SSL not working | Missing or invalid certs | Verify nginx_app/configuration/certs |
| Timeout fetching DHIS2 data | Invalid API credentials | Update .env or fetcher settings |
| Blank dashboard | Shiny crash or missing R packages | docker logs moheatpdhis2 |
| SQLite locked | Simultaneous writes | Wait or restart app |
Logs:
docker logs moheatpdhis2 # Shiny
docker logs moheatpdhis2proxy # NGINX
docker logs sqlitebrowser # SQLite browserdocker exec moheatpdhis2 sqlite3 /srv/shiny-server/app/db/data.sqlite \
".backup '/srv/shiny-server/app/dbackup/backup.sqlite'"docker exec moheatpdhis2 tar czvf /srv/shiny-server/app/dbackup/data_$(date +%Y%m%d).tar.gz \
/srv/shiny-server/app/fetched_data/docker psβ container healthdocker statsβ CPU/memory usage- Disk space:
df -h /var/lib/docker - Logs and alert checks (weekly)
Maintained by: MIKEINTOSH SYSTEMS | Michael Kifle Teferra For support or issues, visit GitHub Issues

