Dynamically spawns woodpecker ci build agents in hetzner cloud.
The deployment will use helm and the chart in chart/woodpecker-autoscaler
.
You will need a hcloud api token, a woodpecker agent secret, a woodpecker api token and a definition of the build agents to be created.
Expose these information to the floater as described in this example:
env:
- name: WOODPECKER_AUTOSCALER_LOGLEVEL
value: "Info"
- name: WOODPECKER_AUTOSCALER_CHECK_INTERVAL
value: "15"
- name: WOODPECKER_AUTOSCALER_WOODPECKER_LABEL_SELECTOR
value: "uploadfilter24.eu/instance-role=Woodpecker"
- name: WOODPECKER_AUTOSCALER_WOODPECKER_INSTANCE
value: "define_it"
- name: WOODPECKER_AUTOSCALER_WOODPECKER_AGENT_SECRET
value: "define_it"
- name: WOODPECKER_AUTOSCALER_WOODPECKER_API_TOKEN
value: "define_it"
- name: WOODPECKER_AUTOSCALER_HCLOUD_TOKEN
value: "define_it"
- name: WOODPECKER_AUTOSCALER_HCLOUD_INSTANCE_TYPE
value: "cpx21"
- name: WOODPECKER_AUTOSCALER_HCLOUD_LOCATION
value: "define_it"
- name: WOODPECKER_AUTOSCALER_HCLOUD_SSH_KEY
value: "define_it"
- name: WOODPECKER_AUTOSCALER_COST_OPTIMIZED
value: "true"
you can also create a secret manually with these information and reference the existing secret like this in the values.yaml
:
externalConfigSecret:
enabled: true
name: "my-existing-secret"
Now you are able to deploy:
kubectl create namespace woodpecker-autoscaler
cd chart/woodpecker-autoscaler
helm upgrade --install -f values.yaml -n woodpecker-autoscaler woodpecker-autoscaler ./
Download the binary from the release section and place it somewhere on your system; /usr/bin/woodpecker-autoscaler
for example.
Create a systemd service like the one in this template:
[Unit]
Description=Dynamically spawn woodpecker ci build agents in hetzner cloud
[Service]
Type=simple
Nice=10
ExecStart=/usr/bin/woodpecker-autoscaler
EnvironmentFile="/etc/default/woodpecker-autoscaler.env"
Now place the environment variable configuration in the specified file:
WOODPECKER_AUTOSCALER_LOGLEVEL=Info
WOODPECKER_AUTOSCALER_CHECK_INTERVAL=15
WOODPECKER_AUTOSCALER_WOODPECKER_LABEL_SELECTOR="uploadfilter24.eu/instance-role=Woodpecker"
WOODPECKER_AUTOSCALER_WOODPECKER_INSTANCE="define_it"
WOODPECKER_AUTOSCALER_WOODPECKER_AGENT_SECRET="define_it"
WOODPECKER_AUTOSCALER_WOODPECKER_API_TOKEN="define_it"
WOODPECKER_AUTOSCALER_HCLOUD_TOKEN="define_it"
WOODPECKER_AUTOSCALER_HCLOUD_INSTANCE_TYPE=cpx21
WOODPECKER_AUTOSCALER_HCLOUD_LOCATION="define_it"
WOODPECKER_AUTOSCALER_HCLOUD_SSH_KEY="define_it"
WOODPECKER_AUTOSCALER_COST_OPTIMIZED="true"
Now reload the systemd daemons and start the service:
sudo systemctl daemon-reload
sudo systemctl enable woodpecker-autoscaler
sudo systemctl start woodpecker-autoscaler
Made with ♡ by the folkes at uploadfilter24.eu :)