Please note that not all features from the Docker Swarm solution are supported yet.
Implemented features
- Data migration
- Data seeding
Limitations:
- Manual Helm installation and upgrade only
- Manual initial user configuration for MinIO, MongoDB, Elasticsearch
- No data reset feature available
- Any kind of secrets (Logins and passwords, etc) should be created manually
This repository is used to store infrastructure code for deploying OpenCRVS.
- 16G RAM
- 8 CPU (at least Intel 8th generation)
- 100G free storage space
Ensure you have one of the following solutions installed on your laptop:
- Recommended for MacOS: Docker Desktop (with Kubernetes enabled): https://www.docker.com/products/docker-desktop/. Please check following:
- Enable host networking
- Enable Kubernetes
- Ensure docker-desktop is configured to use at least 16G of RAM
- Ensure Storage is set up at least 100G
- Recommended for Linux: Minikube (with docker driver): https://minikube.sigs.k8s.io/docs/. NOTE: Docker support is still experimental for minikube, but it gives better performance in comparison to alternative solutions.
Additional settings for linux (Ubuntu) users:
- Add following values to /etc/sysctl.conf:
fs.inotify.max_user_watches = 524288 fs.inotify.max_user_instances = 512
- Start minikube with unlimited amount of memory:
minikube start --memory=no-limits
- Start load balancer (tunnel) on localhost:
minikube tunnel -c --bind-address='127.0.0.1'
- Add following values to /etc/sysctl.conf:
NOTE: Any other Kubernetes solution for desktop should work as well. Please check to LoadBalancer and kubernetes services setup if you are not able to access service.
You will also need the following tools for running the local development environment:
- Git: https://git-scm.com/downloads
- Helm: https://helm.sh/
- Kubectl: https://kubernetes.io/docs/tasks/tools/
- Tilt: https://tilt.dev/
NOTE: This guide does not cover the installation of these prerequisites.
You need to clone the opencrvs-core and infrastructure repositories. If these repositories are already on your laptop, ensure they are in the same folder.
- Create a new folder or use an existing folder to store the repositories.
- Open a terminal (command line) and navigate to the folder.
- Clone the OpenCRVS Core repository:
git clone [email protected]:opencrvs/opencrvs-core.git
- Clone the Infrastructure repository:
NOTE: This step is optional, tilt should be able to checkout infrastructure directory
git clone [email protected]:opencrvs/infrastructure.git
- Change directory to the OpenCRVS Core repository:
cd opencrvs-core
- Run Tilt:
tilt up
- Navigate to http://localhost:10350/
- Once all container images are up and running your environment will be available at http://opencrvs.localhost
Please follow official documentation how to setup your own country configuration at Set-up your own, local, country configuration. You need to fork (clone) the opencrvs-countryconfig repository and clone the infrastructure repository. If repositories are already on your laptop, ensure they are in the same parent folder, for example:
repositories/
infrastructure
opencrvs-countryconfig
...
Step by step instruction
-
Create a new folder or use an existing folder to store the repositories. For example folder could be located at your home directory or in documents:
mkdir ~/Documents/repository
-
Open a terminal (command line) and navigate to the folder.
cd ~/Documents/repository
-
Clone OpenCRVS Country Config repository:
For county config use:
git clone https://github.com/opencrvs/opencrvs-countryconfig
For your own fork use:
git clone [email protected]:<your-github-account>/<your-repository>.git
-
Clone the Infrastructure repository:
git clone [email protected]:opencrvs/infrastructure.git
NOTE: This step is optional, tilt should be able to checkout infrastructure directory
-
Change directory to country config (your own) repository:
For county config use:
cd opencrvs-countryconfig
For your own fork use:
cd <your-repository>
-
Run Tilt:
tilt up
-
Navigate to http://localhost:10350/
-
Once all container images are up and running your environment will be available at http://opencrvs.localhost
- Navigate to http://localhost:10350/
- Scroll to section
2.Data-tasks
and find resourceReset database
- Run resource using reload button
See screenshot for more information:
Check image tag was set properly, use kubectl
, adjust value in kubernetes/opencrvs-services/values-dev.yaml
- Usually for repository your are working tag is
local
, e/g country config repository should havelocal
tag only for countryconfig. - Check tag exists on docker hub (or any other repository)
Draft and working way is to restart docker desktop
- Issue fresh token:
USERNAME=o.admin
SUPER_USER_PASSWORD=password
curl -X POST "http://auth.opencrvs-dev.svc.cluster.local:4040/authenticate-super-user" \
-H "Content-Type: application/json" \
-d '{
"username": "'"${USERNAME}"'",
"password": "'"$SUPER_USER_PASSWORD"'"
}'
- Check gateway host:
GATEWAY_HOST=http://gateway.opencrvs-dev.svc.cluster.local:7070
curl -X GET \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${token}" \
${GATEWAY_HOST}/locations?type=ADMIN_STRUCTURE&_count=0
- Check config host:
curl -v -X GET \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${token}" \
http://config.opencrvs-dev.svc.cluster.local:2021/locations?type=ADMIN_STRUCTURE&_count=0
- Check Hearth:
curl -v http://hearth.opencrvs-deps-dev.svc.cluster.local:3447/fhir/Location
2025/03/19 07:53:38 [error] 15#15: *1 upstream timed out (110: Connection timed out) while connecting to upstream, client: 10.1.3.102, server: localhost, request: "GET /api/countryconfig/login-config.js HTTP/1.1", upstream: "http://10.100.14.175:3040/login-config.js", host: "login.opencrvs.localhost", referrer: "https://login.opencrvs.localhost/"
Solution: restart nginx inside login container or delete login pod
nginx -s reload
Ensure your cluster has a storage class with encryption, or encryption is implemented at the filesystem level:
-
For existing OpenCRVS installations: Make sure the cluster has at least the
hostpath
storage class configured and directories on the filesystem should point to encrypted partitions.hostpath
is the best option for migration from Docker Swarm to Kubernetes; it allows data to remain untouched. Data can be migrated to more robust storage later, such aslocal
ornfs
volumes after OpenCRVS migration to Kubernetes. -
For new installations:
- Please check the available storage options in the official documentation: Kubernetes Volumes Documentation and Kubernetes Storage Classes Documentation.
- The recommended storage class for new installations is NFS.
Additionally, explore all possible options for CSI (Container Storage Interface) at the CSI GitHub repository.
NOTE: Depending on your available hardware resources, you may optimize the installation by splitting data across different types of volumes. For example:
Hostpath
works better for Elasticsearch.NFS
is the best option for MinIO and Mongo (or Postgres).
cert-manager is optional component for traefik and provides an easy way to issue multiple SSL certificates and share it within multiple traefik pods.
If your installation use custom SSL stored as secrets cert-manager is not required.
Recommended way to install cert-manager is a helm chart, see official documentation for more details how to install cert-manager: https://cert-manager.io/docs/installation/helm/
traefik is used to proxy OpenCRVS services behind load balancer on kubernetes cluster.
Please change default traefik certificate with your own wildcard or SANs certificate by following guide at https://doc.traefik.io/traefik/https/tls/#default-certificate
If cert-manager is used create `Certificate manifest at traefik namespace:
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: k8s-opencrvs-dev-ssl
namespace: traefik
spec:
dnsNames:
- '*.<your domain>'
- <your domain>
issuerRef:
kind: ClusterIssuer
name: <dns-cluster-issuer>
secretName: traefik-cert-tls
Make sure certificate was issued.
kubectl get cert
Create default tls store traefik:
apiVersion: traefik.io/v1alpha1
kind: TLSStore
metadata:
name: default
namespace: traefik
spec:
defaultCertificate:
secretName: traefik-cert-tls
TODO: Add steps with middleware installation:
- traefik
- dependencies
- Clone this repository
git clone https://github.com/opencrvs/infrastructure.git
- Create yaml file with custom values for your installation:
NOTE: Please refer to opencrvs-services/README.md for full list of options.
# Kubernetes load balancer domain used by traefik as entrypoint hostname: <you domain> # OpenCRVS Core image tag image: tag: develop # Your country image repository and tag countryconfig: image: name: opencrvs/ocrvs-countryconfig tag: develop
- Install OpenCRVS:
NOTE: Data seed will run only on
helm install opencrvs charts/opencrvs-services
install
, don't useupdate --install
for first installation or run data-seeder manually.
TODO: Migration from docker swarm to kubernetes guide