# 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](/v2.0/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: 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/bootstrap-servers.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.
