|
| 1 | +# 🚧 Work in Progress |
| 2 | + |
| 3 | +# General documentation |
| 4 | + |
| 5 | +Helm chart to deploy all OpenCRVS services on Kubernetes cluster. |
| 6 | + |
| 7 | +# Dependencies Configuration |
| 8 | + |
| 9 | +<table> |
| 10 | + <thead> |
| 11 | + <tr> |
| 12 | + <th>Name</th> |
| 13 | + <th>Default</th> |
| 14 | + <th>Description</th> |
| 15 | + </tr> |
| 16 | + </thead> |
| 17 | + <tbody> |
| 18 | + <tr> |
| 19 | + <td>elasticsearch_host</td> |
| 20 | + <td>elasticsearch.opencrvs-deps-dev.svc.cluster.local:9200</td> |
| 21 | + <td>Elasticsearch configuration, including the hostname and port. TODO: Consider defining the port as a separate variable.</td> |
| 22 | + </tr> |
| 23 | + <tr> |
| 24 | + <td>influxdb.host</td> |
| 25 | + <td>influxdb-0.influxdb.opencrvs-deps-dev.svc.cluster.local</td> |
| 26 | + <td>InfluxDB hostname configuration.</td> |
| 27 | + </tr> |
| 28 | + <tr> |
| 29 | + <td>influxdb.port</td> |
| 30 | + <td>8086</td> |
| 31 | + <td>InfluxDB port configuration.</td> |
| 32 | + </tr> |
| 33 | + <tr> |
| 34 | + <td>influxdb.db</td> |
| 35 | + <td>ocrvs</td> |
| 36 | + <td>InfluxDB database name.</td> |
| 37 | + </tr> |
| 38 | + <tr> |
| 39 | + <td>fhir_url</td> |
| 40 | + <td>http://hearth.opencrvs-deps-dev.svc.cluster.local:3447/fhir</td> |
| 41 | + <td>FHIR URL Endpoint. TODO: Add description for FHIR URL configuration.</td> |
| 42 | + </tr> |
| 43 | + <tr> |
| 44 | + <td>minio.host</td> |
| 45 | + <td>minio-0.minio.opencrvs-deps-dev.svc.cluster.local</td> |
| 46 | + <td>MinIO hostname configuration.</td> |
| 47 | + </tr> |
| 48 | + <tr> |
| 49 | + <td>minio.port</td> |
| 50 | + <td>3535</td> |
| 51 | + <td>MinIO port configuration.</td> |
| 52 | + </tr> |
| 53 | + <tr> |
| 54 | + <td>mongodb_host</td> |
| 55 | + <td>mongodb-0.mongodb.opencrvs-deps-dev.svc.cluster.local</td> |
| 56 | + <td>MongoDB hostname configuration.</td> |
| 57 | + </tr> |
| 58 | + <tr> |
| 59 | + <td>hostname</td> |
| 60 | + <td>farajaland.com</td> |
| 61 | + <td>Hostname for OpenCRVS application, without wildcard or subdomain. Example: hostname: opencrvs.localhost</td> |
| 62 | + </tr> |
| 63 | + <tr> |
| 64 | + <td>dev_mode</td> |
| 65 | + <td>false</td> |
| 66 | + <td>Developer mode flag. TODO: Check the usage and purpose of this variable.</td> |
| 67 | + </tr> |
| 68 | + <tr> |
| 69 | + <td>env</td> |
| 70 | + <td>{}</td> |
| 71 | + <td>Global environment variables, each variable defined here is available to all workloads (service) deployed by helm chart. See example at [values.yaml](values.yaml)</td> |
| 72 | + </tr> |
| 73 | + <tr> |
| 74 | + <td><service_name>.env</td> |
| 75 | + <td>{}</td> |
| 76 | + <td>Service level environment variables, each variable defined here is available to particular workload (service) only. See example for `config` microservice at [values.yaml](values.yaml)</td> |
| 77 | + </tr> |
| 78 | + <tr> |
| 79 | + <td><service_name>.secrets</td> |
| 80 | + <td>{}</td> |
| 81 | + <td>Mapping kubernetes secrets as environment variables. For more information see [Mapping secrets](#mapping-secrets)</td> |
| 82 | + </tr> |
| 83 | + </tbody> |
| 84 | +</table> |
| 85 | + |
| 86 | +# Microservice environment variables configuration |
| 87 | + |
| 88 | +<pre>Do we need this section?</pre> |
| 89 | + |
| 90 | +Helm chart allows to define environment variables in following scopes: |
| 91 | +- **Global variables** are defined at top level of values file and is added to all containers. See `env` key in [values.yaml](values.yaml) |
| 92 | +- **Service level variables** are defined for each particular service. See `<service_name>.env` key in [values.yaml](values.yaml) |
| 93 | +- **Secret environment variables** are defined at service level as `<service_name>.secrets` key, see [values.yaml](values.yaml). |
| 94 | + |
| 95 | +# Mapping secrets |
| 96 | + |
| 97 | +Suppose we need to store ES_HOST variable as a secret since it contains url with login and password for Elastic search. |
| 98 | +Kubernetes secret is key/value object usually created from `.env` file, for example: |
| 99 | +``` |
| 100 | +ES_HOST=user:randompass@elasticsearch:9200 |
| 101 | +``` |
| 102 | + |
| 103 | +Mapping needs to be added for particular service to access variable inside workload (service), e/g for `search` service to access ES_HOST following configuration is needed: |
| 104 | +``` |
| 105 | +search: |
| 106 | + secrets: |
| 107 | + elasticsearch-secret: |
| 108 | + - ES_HOST |
| 109 | +``` |
| 110 | + |
| 111 | +In some cases variable name (key) stored in kubernetes secret doesn't match with environment variable |
| 112 | +``` |
| 113 | +secrets: |
| 114 | + <secret_name>: |
| 115 | + - <secret_key>:<environment_variable> |
| 116 | +``` |
| 117 | +Summary: |
| 118 | +- `secret_name`, name of Kubernetes secret object |
| 119 | +- `secret_key`, key (variable name) inside Kubernetes secret data property |
| 120 | +- `environment_variable`, environment variable name inside container. If `secret_key` value `environment_variable` are the same, last one can be omitted. |
0 commit comments