# Running Dependencies deployment

{% hint style="warning" %}
A deployment to a **staging** environment is not permitted unless a **production** environment exists in the GitHub environment. Please ensure a **production** environment is configured before proceeding with any **staging** deployment.
{% endhint %}

### Preparation steps

This section explains how to deploy OpenCRVS dependencies grouped in 2 helm charts:

* **Ingress controller:** [Traefik](https://doc.traefik.io/traefik/) helm chart
* **Datastores** (via the [OpenCRVS dependencies Helm chart](https://github.com/opencrvs/infrastructure/tree/develop/charts/opencrvs-services)):
  * MongoDB
  * PostgreSQL
  * Elasticsearch
  * Redis
  * MinIO
  * InfluxDB

Environment configuration script (`yarn environment:init`) prepared configuration files (`values.yaml`) for deployment with default parameters. Navigate to `environments` folder inside infrastructure repository and review configuration files.

Here is an example directory structure for a **development** environment:

```
environments/
├── development
│   ├── dependencies
│   │   └── values.yaml
│   ├── opencrvs-services
│   │   └── values.yaml
│   └── traefik
│       └── values.yaml
└── README.md
```

A default configuration, created by the `yarn environments:init` script, is sufficient for inital deployments, but sometimes you may need to adjust TLS / SSL configuration in `environments/traefik/values.yaml` or tweak some properties here like static storage, etc.

### Run dependencies deployment

1. Navigate to GitHub Actions within `infrastructure` repository
2. Select "Deploy Dependencies" action
3. Select "Target environment" from dropdown menu, all environments created at [Broken mention](broken://pages/Ar8Os7JHqW6KnBmoDslD) step should be listed here.
4. Click "Run workflow" button

### Verification steps

* Verify workflow was completed successfully
* Verify resources are up and running after deployment:
  * `kubectl get namespaces` : You should see 2 new namespaces created (`traefik`, `opencrvs-deps-<env>`).\
    NOTE: Check how to run `kubectl` at [Kubernetes cluster access](broken://pages/Oo19SaQmBF4hLOVclF06).
  * `kubectl get pods -n traefik`: Make sure traefik pod is up and running
  * `kubectl get pods -n opencrvs-deps-<environment>` : make sure datastores are up and running.\
    Example output: If monitoring is enabled, you will also see filebeat, metricbeat, kibana pods.

    ```
    NAME                             READY   STATUS      RESTARTS     AGE
    elasticsearch-0                  1/1     Running     0            8d
    influxdb-0                       1/1     Running     0            8d
    minio-0                          1/1     Running     0            8d
    mongodb-0                        1/1     Running     0            8d
    postgres-0                       1/1     Running     0            8d
    redis-0                          1/1     Running     0            8d
    ```
* Verify that **MinIO** and **Kibana** are available:
  * Kibana URL: `https://kibana.<your domain>`\
    Username and password are stored as Kubernetes secret `elasticsearch-opencrvs-users` in `opencrvs-deps-<environment>` namespace.
  * MinIO URL: `https://minio.<your domain>` . Username and password are stored as Kubernetes secret `minio-opencrvs-users` in `opencrvs-deps-<environment>` namespace.

> NOTE: Credentials are stored at GitHub secrets or can be fetched namespace `opencrvs-deps-<env>`.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://documentation.opencrvs.org/v2.0/technical/guides/installation/deploy-set-up-a-server-hosted-environment/deploy/running-a-dependencies-deployment.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
