Skip to content

Commit fa6a0d8

Browse files
authored
Merge pull request #378 from pietroalbini/gha-self-hosted
infra: add documentation for gha-self-hosted
2 parents 7b779f2 + 4b0f594 commit fa6a0d8

File tree

2 files changed

+91
-0
lines changed

2 files changed

+91
-0
lines changed

src/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
- [AWS access management](./infra/docs/aws-access-management.md)
4949
- [Bastion server](./infra/docs/bastion.md)
5050
- [Crater agents](./infra/docs/crater-agents.md)
51+
- [Custom GitHub Actions runners](./infra/docs/gha-self-hosted.md)
5152
- [Discord moderation bot](./infra/docs/discord-mods-bot.md)
5253
- [Domain names and DNS](./infra/docs/dns.md)
5354
- [docs.rs](./infra/docs/docs-rs.md)

src/infra/docs/gha-self-hosted.md

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# Custom GitHub Actions runners
2+
3+
The Infrastructure Team manages a pool of self-hosted GitHub Actions runners,
4+
meant to be used by whitelisted repositories that need to run tests on
5+
platforms not supported by the GitHub-hosted runners. We're currently running
6+
the following machines:
7+
8+
* `ci-arm-1.infra.rust-lang.org`: AArch64 runners, hosted on [packet]
9+
([configuration][host_vars-ci-arm-1]).
10+
11+
The server configuration for the runners is managed with Ansible ([playbook],
12+
[role]), and the source code for the tooling run on the server is in the
13+
[gha-self-hosted] repository.
14+
15+
Please get in touch with the Infrastructure Team if you need to run builds on
16+
this pool for your project in the `rust-lang` organization.
17+
18+
## Maintenance procedures
19+
20+
### Changing the instances configuration
21+
22+
The set of instances available in each host is configured through the
23+
Ansible configuration located in the [simpleinfra repo][simpleinfra]:
24+
25+
```
26+
ansible/envs/prod/host_vars/{hostname}.yml
27+
```
28+
29+
You'll be able to add, remove and resize instances by changing that file and
30+
applying the changes:
31+
32+
```
33+
ansible/apply prod gha-self-hosted
34+
```
35+
36+
### Forcing an update of the source code
37+
38+
The server checks for source code updates every 15 minutes, but it's possible
39+
to start such check in advance. You need to log into the machine you want to
40+
act on, and run the following command:
41+
42+
```
43+
sudo systemctl start gha-self-hosted-update
44+
```
45+
46+
If the contents of the `image/` directory were changed, an image rebuild will
47+
also be started. The new image will be used by each VM after they finish
48+
processing the current job.
49+
50+
### Forcing a rebuild of the images
51+
52+
The server automatically rebuilds the images every week, but it's possible to
53+
rebuild them in advance. You need to log into the machine you want to act on,
54+
and run the following command:
55+
56+
```
57+
sudo systemctl start gha-self-hosted-rebuild-image
58+
```
59+
60+
### Managing the lifecycle of virtual machines
61+
62+
Each virtual machine is assigned a name and its own systemd unit, called
63+
`gha-vm-{name}.service`. For example, the `arm-1-1` VM is managed by the
64+
`gha-vm-arm-1-1.service` systemd unit. You can stop, start and restart the
65+
virtual machine by stopping, starting and restarting the systemd unit.
66+
67+
Virtual machines are configured to restart after each build finishes.
68+
69+
### Logging into the virtual machines
70+
71+
It's possible to log into the virtual machines from localhost to debug builds.
72+
This should be used as the last resort. Each VM binds SSH on a custom port on
73+
the host (configured in the host Ansible configuration), and allows access to
74+
the `manage` user (with password `password`). For example, to log into the VM
75+
with port `2201` you can run:
76+
77+
```
78+
ssh manage@localhost -p 2201
79+
```
80+
81+
Note that the VM image regenerates its own host key every time it boots, so
82+
you'll likely get host key mismatch errors when connecting to a freshly booted
83+
VM.
84+
85+
[gha-self-hosted]: https://github.com/rust-lang/gha-self-hosted
86+
[host_vars-ci-arm-1]: https://github.com/rust-lang/simpleinfra/blob/master/ansible/envs/prod/host_vars/ci-arm-1.infra.rust-lang.org.yml
87+
[packet]: https://www.packet.com
88+
[playbook]: https://github.com/rust-lang/simpleinfra/blob/master/ansible/playbooks/gha-self-hosted.yml
89+
[role]: https://github.com/rust-lang/simpleinfra/blob/master/ansible/playbooks/gha-self-hosted.yml
90+
[simpleinfra]: https://github.com/rust-lang/simpleinfra

0 commit comments

Comments
 (0)