> For the complete documentation index, see [llms.txt](https://documentation.opencrvs.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://documentation.opencrvs.org/technical/guides/installation/deploy-set-up-a-server-hosted-environment/bootstrap-servers.md).

# Bootstrap servers

## General information

These are the steps you need to perform after receiving a server IP address and an SSH user before you can run the provisioning scripts for any given environment. E.G: **qa, backup, staging, production (1, 2, 3 or 5 server cluster).**

Use command produced by create environment script (\`yarn environment:init) to bootstrap servers:

* [#bootstrap-kubernetes-single-node-master-node](#bootstrap-kubernetes-single-node-master-node "mention")
* [#bootstrap-kubernetes-worker-nodes-backup-server](#bootstrap-kubernetes-worker-nodes-backup-server "mention")

## Bootstrap Kubernetes single node / master node

{% hint style="info" %}
Use code snippet generated by the `yarn environment:init` script in the [Create a GitHub environment step](/technical/guides/installation/deploy-set-up-a-server-hosted-environment/create-a-github-environment.md)
{% endhint %}

1. SSH into your server as a user with sudo access or as root
2. Run the following command on the VM:

   ```bash
   curl -sfL https://raw.githubusercontent.com/opencrvs/infrastructure/refs/heads/develop/scripts/bootstrap/opencrvs-bootstrap.sh \
        -o opencrvs-bootstrap.sh && \
   bash opencrvs-bootstrap.sh --owner <org name> \
               --repo <repo name> \
               --env <env name> \
               --token <github token> \
               --enable-runner
   ```

{% hint style="info" %}
The script will install a self-hosted Github runner and set up a user on your server called **provision**. At the end of this process the script will display that provision user's public SSH key, which you will need to use in the next step if you are setting up a backup integration (required for a PII - staging / production environment) or a cluster.

Example output:

```
✅ Runner 'prod-runner' is installed and started!


⚠️ ⚠️ ⚠️ ⚠️ ⚠️ Store the following public key for later usage ⚠️ ⚠️ ⚠️ ⚠️ ⚠️
⚙️  provision SSH key pair public key (add on worker nodes if needed):

ssh-ed25519 AAAAC3NzaC....F5uYOPl+ provision@prod1

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 ✅ Node bootstrap complete for tmp-prod1.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
```

{% endhint %}

**Checklist for script execution**

1. Verify `provision` user was created:

   ```
   su - provision
   whoami
   ```

   Example output:

   ```
   provision$ whoami 
   provision
   ```
2. In your GitHub repository, navigate to **Settings → Actions → Runners** and verify that the runner appears as a self-hosted runner.

## Bootstrap Kubernetes worker nodes / backup server

1. SSH into your server as a user with sudo access or as root
2. Run following command to bootstrap server

   ```
   curl -sfL https://raw.githubusercontent.com/opencrvs/infrastructure/refs/heads/develop/scripts/bootstrap/opencrvs-bootstrap.sh -o opencrvs-bootstrap.sh && \
       bash opencrvs-bootstrap.sh --ssh-public-key "<public key from master node>"
   ```


---

# 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://documentation.opencrvs.org/technical/guides/installation/deploy-set-up-a-server-hosted-environment/bootstrap-servers.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.
