Both install scripts now source lib/common.sh instead of duplicating detect_latest_alpine_template(), find_existing_lxc(), and the tty1 autologin block. Since these scripts are distributed via curl one-liner and piped into `pct exec` inside the LXC, there is no local checkout to source from in those contexts — lib/common.sh is sourced from disk when a local checkout is available (BASH_SOURCE resolves to a real path), otherwise fetched over HTTP next to SCRIPT_URL. Both scripts already require outbound network to curl themselves and to download their respective binaries, so this adds no new failure mode. openbao/install.sh is a behavioral no-op: same log output, same control flow. One inline apk update/upgrade is intentionally left as-is in update_lxc() — refresh_os_packages() is a bash function in this process and can't run over `pct exec ... sh -c` without shipping the function definition into the container. gitea-runner/install.sh fixes the actual bug: TEMPLATE was hardcoded to a specific dated Alpine release, so create_lxc() would keep trying to provision a stale/absent template. TEMPLATE now defaults to empty and create_lxc() calls detect_latest_alpine_template() when unset, mirroring openbao. Also renamed HOSTNAME -> HOSTNAME_LXC and added LXC_TAG to match openbao's naming, since a follow-up (issue #15) will wire up find_existing_lxc()-based update detection here. Closes #12, Closes #14
72 lines
2.1 KiB
Markdown
72 lines
2.1 KiB
Markdown
# Gitea Act Runner
|
|
|
|
Automated installation script for a Gitea Actions runner in an Alpine LXC on Proxmox.
|
|
|
|
### Features
|
|
|
|
Single script, three automatic modes:
|
|
|
|
| Context | Action |
|
|
|---------|--------|
|
|
| From Proxmox host | Creates Alpine LXC + installs everything |
|
|
| From empty LXC | Installs Docker + act_runner + OpenRC service |
|
|
| From LXC with act_runner installed | Updates binary to latest version |
|
|
|
|
### Usage
|
|
|
|
#### Full install (from Proxmox shell)
|
|
|
|
```bash
|
|
bash -c "$(curl -fsSL https://gitea.arnodo.fr/Damien/infra-scripts/raw/branch/main/gitea-runner/install.sh)"
|
|
```
|
|
|
|
The script automatically creates an Alpine LXC (template auto-detected from `pveam available`) with Docker and act_runner.
|
|
|
|
#### Customization
|
|
|
|
Environment variables to override defaults:
|
|
|
|
```bash
|
|
CTID=120 HOSTNAME=runner-02 CORES=4 RAM=4096 bash -c "$(curl -fsSL https://gitea.arnodo.fr/Damien/infra-scripts/raw/branch/main/gitea-runner/install.sh)"
|
|
```
|
|
|
|
| Variable | Default | Description |
|
|
|----------|---------|-------------|
|
|
| `CTID` | auto | Container ID |
|
|
| `RUNNER_HOSTNAME` | `gitea-runner` | LXC Hostname |
|
|
| `TEMPLATE` | auto-detected | Alpine template; auto-detected from `pveam available` |
|
|
| `CORES` | `2` | CPU cores |
|
|
| `RAM` | `2048` | RAM in MiB |
|
|
| `DISK` | `8` | Disk in GB |
|
|
| `STORAGE` | `local-lvm` | Proxmox storage for the LXC |
|
|
| `BRIDGE` | `vmbr0` | Network bridge |
|
|
|
|
#### Runner registration
|
|
|
|
After installation, enter the LXC and register the runner:
|
|
|
|
```bash
|
|
pct enter <CTID>
|
|
cd /var/lib/gitea-runner
|
|
su -s /bin/bash gitea-runner -c "act_runner register"
|
|
rc-service gitea-runner start
|
|
```
|
|
|
|
#### Update
|
|
|
|
From inside the LXC:
|
|
|
|
```bash
|
|
curl -fsSL https://gitea.arnodo.fr/Damien/infra-scripts/raw/branch/main/gitea-runner/install.sh | bash
|
|
```
|
|
|
|
The script detects that act_runner is already installed and switches to update mode automatically.
|
|
|
|
### Architecture
|
|
|
|
- **OS**: Alpine 3.23 (LXC non-privileged, nesting active)
|
|
- **Docker**: installed via apk, OpenRC service
|
|
- **act_runner**: official binary from gitea.com/gitea/act_runner
|
|
- **Service**: OpenRC with logs in `/var/log/gitea-runner.log`
|
|
- **User**: `gitea-runner` (group `docker`)
|