Skip to content

Commit dd7e468

Browse files
High Availability for VM runner docs
1 parent b639627 commit dd7e468

File tree

1 file changed

+102
-0
lines changed
  • docs/continuous-integration/use-ci/set-up-build-infrastructure/vm-build-infrastructure

1 file changed

+102
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
---
2+
title: High Availability (HA)
3+
description: Set up high availability on VM build infrastructure.
4+
sidebar_position: 45
5+
---
6+
7+
## Minimum Version
8+
9+
In order to use this feature, please ensure that you are using [drone runner](https://github.com/drone-runners/drone-runner-aws/tree/v1.0.0-rc.187?tab=readme-ov-file#high-availablity) version of [`v1.0.0-rc.187`](https://github.com/drone-runners/drone-runner-aws/releases/tag/v1.0.0-rc.187) or greater.
10+
11+
## Setup
12+
13+
When using VM build infrastructure, you can deploy multiple replicas of the runner or infrastructure to ensure high availability. Below is an example of a deployment yaml that deploys 2 replicas of the runner behind a load balancer.
14+
15+
```yaml
16+
---
17+
apiVersion: v1
18+
kind: Namespace
19+
metadata:
20+
name: harness-delegate-ng
21+
---
22+
apiVersion: apps/v1
23+
kind: Deployment
24+
metadata:
25+
name: drone-runner
26+
namespace: harness-delegate-ng
27+
spec:
28+
replicas: 2
29+
selector:
30+
matchLabels:
31+
app: drone-runner
32+
template:
33+
metadata:
34+
labels:
35+
app: drone-runner
36+
spec:
37+
containers:
38+
- name: drone-runner
39+
image: drone/drone-runner-aws:v1.0.0-rc.187
40+
args: ["delegate", "--pool", "/runner/pool.yml"]
41+
env:
42+
- name: DRONE_RUNNER_HA
43+
value: "true"
44+
- name: DRONE_DATABASE_DRIVER
45+
value: postgres
46+
- name: DRONE_DATABASE_DATASOURCE
47+
value: host=runnerha-postgres-service.harness-delegate-ng.svc.cluster.local port=5431 user=admin password=password dbname=dlite sslmode=disable
48+
ports:
49+
- containerPort: 3000
50+
volumeMounts:
51+
- name: config-volume
52+
mountPath: /runner
53+
readOnly: true
54+
volumes:
55+
- name: config-volume
56+
projected:
57+
sources:
58+
- configMap:
59+
name: drone-runner-config
60+
- secret:
61+
name: drone-runner-secret
62+
---
63+
apiVersion: v1
64+
kind: Service
65+
metadata:
66+
name: drone-runner-lb
67+
namespace: harness-delegate-ng
68+
spec:
69+
type: LoadBalancer
70+
selector:
71+
app: drone-runner
72+
ports:
73+
- port: 3000
74+
targetPort: 3000
75+
protocol: TCP
76+
```
77+
78+
The load balancer ip obtained above can be used in delegate with the env variable `RUNNER_URL`. Populate `DRONE_DATABASE_DATASOURCE` accordingly. Note that above yaml mounts a volume config-volume with path `/runner`. Make sure your `pool.yml` file and secrets required are mapped properly. See the following GCP specific `pool.yaml` file used in the deployment above.
79+
80+
```yaml
81+
version: "1"
82+
instances:
83+
- name: linux-amd64
84+
type: google
85+
pool: 2
86+
limit: 10
87+
platform:
88+
os: linux
89+
arch: amd64
90+
spec:
91+
hibernate: false
92+
privateIP: true
93+
account:
94+
project_id: projectname
95+
json_path: runner/gcp-secret.json
96+
image: projects/projectname/global/images/hosted-vm-64
97+
machine_type: e2-medium
98+
zones:
99+
- us-central1-a
100+
disk:
101+
size: 100
102+
```

0 commit comments

Comments
 (0)