- 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
.env
file 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 restart
View logs:
docker-compose -p dhis2heat logs -f
Full cleanup:
docker-compose -p dhis2heat down --volumes --rmi all
Update application:
git pull origin main
docker-compose -p dhis2heat up -d --build
1. 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.