Skip to main content

Bemba Administration Guide

This guide is for the system administrators who install, deploy, back up and monitor Bemba, the management information system of the Projeto Capital Humano.

Overview​

ComponentTechnologyRole
FrontendReact 18 + TypeScript, served by NginxApplication (SPA) and public website
BackendSymfony 7 + PHP 8.3 (PHP-FPM + Nginx in the same container)REST API, asynchronous jobs (Messenger), scheduler
DatabasePostgreSQL 15 + PostGIS 3.4Business and geographic data
CacheRedis 7Application cache, rate limiting
Reverse proxyTraefik 2.10HTTPS (Let's Encrypt) and host-based routing
DocumentationDocusaurus, served by NginxThis site (docubemba.ucp-pch.org)
LogsLoki + PromtailOne-year log retention

Deployment architecture

Servers​

ServerAddressRoleHost names
Production51.75.79.112 (OVH VPS, Ubuntu)main branchbemba.ucp-pch.org, mariacare.ucp-pch.org, ucp-pch.org, docubemba.ucp-pch.org
Pre-production51.75.77.220 (OVH VPS, Ubuntu)staging branch, testingsig-preprod.ucp-pch.org, KoboToolbox (kf/kc/ee.kobo.ucp-pch.org), Survey Solutions, GitLab (gitlab.ucp-pch.org)
Disaster recovery (DR)axone-dr replica hostPostgreSQL replica of production and encrypted copies (restic)—

Both servers run native Docker (no intermediate virtual machine). The project lives in ~/pch-sig.

Always pass -f to docker compose

docker compose loads compose.yaml before docker-compose.yml. Run without -f from ~/pch-sig, it starts the Symfony skeleton (a database with the default password) instead of the application. Always:

docker compose -f docker-compose.prod.yml … # production
docker compose -f docker-compose.preprod.yml … # pre-production

Production containers​

ContainerImageRole
pch_traefiktraefik:v2.10Ports 80/443, certificates, redirects
pch_frontendnginx:alpineReact build (bind-mounted from frontend/build)
pch_backendbuilt image (backend/Dockerfile.prod)PHP-FPM + Nginx + Messenger workers (supervisord)
pch_postgrespostgis/postgis:15-3.4-alpinepch_sig database
pch_redisredis:7-alpineCache
pch_documentationnginx:alpineDocumentation site
pch_loki, pch_promtailgrafana/loki, grafana/promtail 2.9Log collection and retention
pch_cadvisor, pch_node_exporter, pch_postgres_exporter, pch_redis_exporterPrometheus exportersMetrics, ports bound to 127.0.0.1
pch_pg_dr_proxysocat (outside compose)DR host access to PostgreSQL for replication
smtp_relayboky/postfix (~/smtp-relay)SMTP relay reserved for the 220 server (KoboToolbox)

Access​

Servers are reached over SSH with a key (user ubuntu). Credentials (application accounts, database, API keys) never appear in the documentation: they are kept in the secrets manager. The secrets inventory and rotation are described in docs/ROTATION_SECRETS.md in the repository.

Sections of this guide​