> For the complete documentation index, see [llms.txt](https://docs.digit.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.digit.org/complaints-management/deploy/setup/production-setup/deploy.md). Agents can also search and read this documentation through its [MCP server](https://docs.digit.org/~gitbook/mcp).

# Deploy

### Hardware Requirements

1. CPU - 8vCPU+
2. RAM - 32GB+
3. Free Disk - 100GB+
4. OS - Ubuntu 22.04+

### Clone the repository (ideally a tagged release)

```
git clone --branch v2.12-beta --depth 1 \
  https://github.com/egovernments/Citizen-Complaint-Resolution-System.git
cd Citizen-Complaint-Resolution-System
```

### Install Prerequisites

```
cd local-setup/scripts
./install-prereqs.sh
```

### Configure Ansible Variables

#### Create a copy of the default variables file

```
cd ../ansible                 # local-setup/ansible
cp inventory/host_vars/quickstart.yml.example inventory/host_vars/mycity.yml
```

#### Update the variables listed below for deployment (the rest are best defaults)

<table><thead><tr><th width="170.70703125">Setting</th><th width="371.69140625">What it is</th><th>Example</th></tr></thead><tbody><tr><td><code>state_root</code></td><td>Your top-level tenant: the country or state. Lowercase, no dots. Creating it is what the deploy does.</td><td><code>kenya</code></td></tr><tr><td><code>state_tenant_id</code></td><td>The tenant the browser apps authenticate against. Keep it the same as <code>state_root</code>.</td><td><code>kenya</code></td></tr><tr><td><code>tenant_id</code></td><td>Your <strong>city</strong> tenant, where complaints actually live. Must start with <code>&#x3C;state_root>.</code></td><td><code>kenya.nairobi</code></td></tr><tr><td><code>boot_tenant</code></td><td>Default tenant for the citizen app. Same as <code>tenant_id</code> is right.</td><td><code>kenya.nairobi</code></td></tr><tr><td><code>ui_state_tenant_id</code></td><td>The tenant the app lands on after login. Point at the <strong>city</strong>.</td><td><code>kenya.nairobi</code></td></tr><tr><td><code>login_tenant_allowlist</code></td><td>Which tenants appear in the login screen's City dropdown. List both.</td><td><code>[kenya, kenya.nairobi]</code></td></tr><tr><td><code>map_center</code></td><td>Where the complaint map opens. <strong>Required — the deploy fails without it.</strong></td><td><code>{lat: -1.2864, lng: 36.8172}</code></td></tr><tr><td><code>pgr_boundary_highest_level</code><br><code>pgr_boundary_lowest_level</code><br><code>boundary_type</code></td><td>What your administrative areas are called, largest first. These are labels on the complaint form, so use the words your staff use.</td><td><code>County</code>, <code>Ward</code>, <code>Ward</code></td></tr><tr><td><code>core_mobile_configs</code></td><td>Your country's phone-number rule. Get this wrong and every citizen signup is rejected.</td><td><code>+254</code> / <code>^0?[17][0-9]{8}$</code></td></tr><tr><td><code>core_postal_configs</code></td><td>Your country's postcode rule.</td><td><code>^[0-9]{5}$</code></td></tr><tr><td><code>secrets_path</code></td><td>Where this deployment's secrets are filed inside the secret store. Just a path.</td><td><code>kv/digit/mycity</code></td></tr><tr><td><code>ansible_host</code></td><td>IP of the machine, if deploying on a remote machine. Remove <code>ansible_connection: local</code> line in this case</td><td></td></tr><tr><td><code>domain</code></td><td>If needs to be deployed on a domain name vs localhost. Also, set <code>tls_enabled:true</code> in this case</td><td></td></tr><tr><td><code>bootstrap_user</code></td><td>Admin Username (defaults to ADMIN)</td><td></td></tr><tr><td><code>bootstrap_password</code></td><td>Admin Password (defaults to eGov@123)</td><td></td></tr></tbody></table>

### Start Deployment

```
./deploy.sh mycity (name of vars file)
```

It takes around 60 minutes; use `tail -f /opt/digit/digit-stack-up.mycity.progress` to view logs

### Access Services

<table><thead><tr><th width="184.0390625">What</th><th width="268.140625">URL (local deployment)</th><th>Login Details</th></tr></thead><tbody><tr><td>Employee app</td><td><a href="http://localhost/digit-ui/employee">http://localhost/digit-ui/employee</a></td><td>Admin Username, Admin Password</td></tr><tr><td>Citizen app</td><td><a href="http://localhost/digit-ui/citizen">http://localhost/digit-ui/citizen</a></td><td>Mobile Number with OTP (default otp 123456 if unchanged)</td></tr><tr><td>Configurator</td><td><a href="http://localhost/configurator/">http://localhost/configurator/</a></td><td>Admin Username, Admin Password, State Tenant ID</td></tr><tr><td>Health dashboard</td><td><a href="http://localhost/status/">http://localhost/status/</a></td><td></td></tr><tr><td>Dashboards (Grafana)</td><td><a href="http://localhost/grafana/">http://localhost/grafana/</a></td><td>Username - admin, for password use <code>sudo docker exec -e BAO_TOKEN="$(sudo jq -r .root_token /opt/digit/.openbao/init.json)" openbao bao kv get -field=grafana_admin_password kv/digit/mycity</code></td></tr></tbody></table>

Use the domain name instead of localhost if you used one during configuration.

### Enable Notifications

[Refer to this page ](https://docs.digit.org/complaints-management/deploy/configure/notifications.md)to enable notifications.

## Kubernetes Deployment (AWS)

The steps above run everything on a single machine — great for a demo or a small city. For a bigger, always-on deployment that can grow with demand, DIGIT can run on Amazon's managed Kubernetes (EKS). This path sets up the cloud infrastructure for you and then installs DIGIT onto it.

It's more involved than the single-machine path, so it assumes you're comfortable with an AWS account and a terminal.

### What you'll need

* An AWS account and permission to create things in it. There's a ready-made permissions file at `devops/infra-as-code/terraform/sample-aws/deploy-iam-policy.json` — hand it to your AWS admin to attach to your user once, and it covers everything from creating the setup to tearing it down.
* A few command-line tools installed: `terraform`, the `aws` CLI, `kubectl`, `helm`, and `helmfile`.

{% hint style="info" %}
**One thing to watch: tool versions.** Use **Helm 3** and **Helmfile 0.x**. The newest Helm (4) and Helmfile (1.x) changed things these charts depend on and will fail. If you hit a strange error right at the start, this is almost always why.
{% endhint %}

### Step 1 — Create the cloud infrastructure

This sets up the whole environment: the network, the Kubernetes cluster, a Postgres database, and the file storage. It's two quick parts.

**First, give Terraform a place to keep its notes.** Terraform records what it builds (its "state") in an S3 bucket, with a small table alongside it so two people can't run it at the same time. A helper creates both — you just pick a name:

```
cd devops/infra-as-code/terraform/sample-aws/remote-state
terraform init
terraform apply -var="bucket_name=mycity-tfstate-4821"   # must be globally unique
cd ..
```

Then open `main.tf` and, near the top, replace the two `<terraform_state_bucket_name>` markers with that same name **in quotes**:

```
    bucket         = "mycity-tfstate-4821"
    dynamodb_table = "mycity-tfstate-4821"
```

{% hint style="info" %}
**About the `<...>` markers.** Throughout these files, anything in angle brackets is a "fill this in" placeholder. Always replace it with a real value **in quotes** — leaving the brackets, or dropping the quotes, is the most common cause of a confusing error at this first step.
{% endhint %}

**Now create everything.** Copy the example settings file and fill it in:

```
cp terraform.tfvars.example terraform.tfvars
```

Open `terraform.tfvars` and set:

<table><thead><tr><th>Setting</th><th width="347.0546875">What it is</th><th>Example</th></tr></thead><tbody><tr><td><code>cluster_name</code></td><td>A name for your Kubernetes cluster.</td><td><code>"mycity"</code></td></tr><tr><td><code>db_name</code></td><td>A name for the database (no hyphens).</td><td><code>"ccrsdb"</code></td></tr><tr><td><code>db_username</code></td><td>The database's admin username.</td><td><code>"ccrs"</code></td></tr><tr><td><code>db_password</code></td><td>A strong database password. <strong>Avoid <code>/</code>, <code>@</code>, <code>"</code>, and spaces</strong> — RDS rejects those. This file stays out of git, so it's safe to put here.</td><td></td></tr></tbody></table>

Everything else has sensible defaults (region, Kubernetes version, database size, number of servers) in `variables.tf` — leave them unless you have a reason to change them. Then:

```
terraform init
terraform plan      # shows what it will create
terraform apply     # creates it (takes ~20-30 minutes)
```

When it finishes, connect your terminal to the new cluster:

```
aws eks update-kubeconfig --name <your-cluster-name> --region <your-region>
```

{% hint style="info" %}
**If `terraform init` / `apply` errors:**

* `S3 bucket "..." does not exist` — you skipped the state-backend step. Create it first (`cd remote-state && terraform apply -var="bucket_name=..."`), using the **same name** you put in `main.tf`, then re-run `terraform init`.
* `MasterUserPassword is not a valid password` — your `db_password` has a character RDS rejects (`/`, `@`, `"`, or a space). Pick one without those.
* `dynamodb_table is deprecated` — harmless warning on newer Terraform; ignore it.
  {% endhint %}

### Step 2 — Fill in your deployment details

Two files under `devops/deploy-as-code/charts/environments/` hold your settings.

In **`env.yaml`**, replace the placeholders:

<table><thead><tr><th width="176.375">Setting</th><th width="343.64453125">What it is</th><th>Example</th></tr></thead><tbody><tr><td><code>domain</code></td><td>The web address people will use to reach the apps.</td><td><code>cms.mydomain.com</code></td></tr><tr><td><code>db-host</code></td><td>The address of the database you just created (Terraform prints it at the end).</td><td><code>mycity-db.xxxx.rds.amazonaws.com</code></td></tr><tr><td><code>fixed-bucketname</code></td><td>The storage bucket for uploaded files (photos on complaints, etc.).</td><td><code>mycity-filestore</code></td></tr><tr><td><code>assets_s3_bucket</code></td><td>The storage bucket that serves the app's front-end files.</td><td><code>mycity-assets</code></td></tr><tr><td><code>tenant_id</code></td><td>Your tenant's short name. The bundled sample data uses <code>pg</code>; keep that unless you know you need your own.</td><td><code>pg</code></td></tr></tbody></table>

In **`env-secrets.yaml`**, set your database username and password.

{% hint style="info" %}
**A note on secrets.** This file lives in the public code, so it must **not** contain real passwords for anything sensitive. For the notification service (novu), you create its keys yourself and keep them in the cluster only. Create novu's namespace first (the deploy reuses it), then the secret, before deploying:

```
kubectl create namespace novu
kubectl -n novu create secret generic novu-secrets \
  --from-literal=jwt-secret=$(openssl rand -hex 24) \
  --from-literal=store-encryption-key=$(openssl rand -hex 16) \
  --from-literal=novu-secret-key=$(openssl rand -hex 24)
```

{% endhint %}

### Step 3 — Install DIGIT

DIGIT starts with a ready-made set of sample data (roles, labels, a default tenant). To load it, open `charts/backbone-services/backboneservices-helmfile.yaml` and set the `db-seed` entry to `installed: true`. Then install everything:

```
cd devops/deploy-as-code
helmfile -f digit-helmfile.yaml -e env apply
```

The first run takes a while — the services set up their databases and start up one by one. Watch progress with `kubectl get pods -A`; you're waiting for everything to reach `Running`. The admin account is created for you in the background once the user service is ready.

**Want the dashboards too?** Monitoring (Grafana) and the health page (Gatus) are off by default. To turn them on, uncomment the monitoring line in `digit-helmfile.yaml`, switch the `monitoring` toggles on in `env.yaml` (including `gatus`), create the `grafana-admin` secret in the **`monitoring`** namespace, and run the install command again:

```
kubectl create namespace monitoring
kubectl -n monitoring create secret generic grafana-admin \
  --from-literal=admin-user=admin \
  --from-literal=admin-password=<a-password>
```

### Step 4 — Add your city

Open the **Configurator** at `https://<your-domain>/configurator/` and sign in with the admin user (`ADMIN` / `eGov@123` unless you changed it) and your tenant name. From there you upload your city and boundary sheets to get it running — exactly like the single-machine setup. See [`docs/onboarding-example/`](https://github.com/egovernments/Citizen-Complaint-Resolution-System/blob/master/docs/onboarding-example) for sample sheets (boundaries, masters, complaint hierarchy, employees) you can copy and adapt.

{% hint style="info" %}
Setting up a whole new **country/state** (rather than a city under the sample one) needs a few extra setup steps behind the scenes — ask the DIGIT team if that's what you need.
{% endhint %}

### Access Services

<table><thead><tr><th width="193.3203125">What</th><th>URL</th><th>Login Details</th></tr></thead><tbody><tr><td>Employee app</td><td><code>https://&#x3C;your-domain>/digit-ui/</code></td><td>Admin Username, Admin Password</td></tr><tr><td>Citizen app</td><td><code>https://&#x3C;your-domain>/citizen</code></td><td>Mobile Number with OTP</td></tr><tr><td>Configurator</td><td><code>https://&#x3C;your-domain>/configurator/</code></td><td>Admin Username, Admin Password, Tenant name</td></tr><tr><td>Health dashboard</td><td><code>https://&#x3C;your-domain>/status/</code></td><td></td></tr><tr><td>Dashboards (Grafana)</td><td><code>https://&#x3C;your-domain>/monitoring</code></td><td>Username <code>admin</code>, password from the <code>grafana-admin</code> secret</td></tr></tbody></table>

## Destroy Infrastructure

When you want to remove everything, there's **one important step first**: delete the load balancers Kubernetes created *before* tearing down the infrastructure. If you skip this, a leftover load balancer keeps the network alive, and the teardown gets stuck.

```
kubectl delete svc -A --field-selector spec.type=LoadBalancer
cd devops/infra-as-code/terraform/sample-aws
terraform destroy
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.digit.org/complaints-management/deploy/setup/production-setup/deploy.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
