新增 Service:GiteaRunner
71
Service%EF%BC%9AGiteaRunner.md
Normal file
71
Service%EF%BC%9AGiteaRunner.md
Normal file
@@ -0,0 +1,71 @@
|
||||
# 安裝需要的套件
|
||||
|
||||
```bash
|
||||
apt update && apt install -y nodejs
|
||||
```
|
||||
|
||||
# 下載 Gitea Runner
|
||||
|
||||
```bash
|
||||
wget https://gitea.com/gitea/act_runner/releases/download/v0.2.13/act_runner-0.2.13-linux-amd64 -O /usr/local/bin/act_runner
|
||||
```
|
||||
|
||||
將 act_runner 設定為可執行檔
|
||||
|
||||
```bash
|
||||
chmod +x /usr/local/bin/act_runner
|
||||
```
|
||||
|
||||
# 註冊 Gitea Runner
|
||||
|
||||
設定參數
|
||||
|
||||
```bash
|
||||
GITEA_URL='https://gitea.jsc.idv.tw'
|
||||
```
|
||||
|
||||
```bash
|
||||
REGISTER_TOKEN='SsbiLdBK5icOPcmrFgt78XAkOyu2lWSZRQbr5D21'
|
||||
```
|
||||
|
||||
```bash
|
||||
RUNNER_LABELS='ct-docker'
|
||||
```
|
||||
|
||||
```bash
|
||||
RUNNER_NAME='ct-docker'
|
||||
```
|
||||
|
||||
```bash
|
||||
act_runner register --no-interactive --instance $GITEA_URL --token $REGISTER_TOKEN --labels $RUNNER_LABELS --name $RUNNER_NAME
|
||||
```
|
||||
|
||||
# 設計 Gitea Runner 服務
|
||||
|
||||
```bash
|
||||
nano /etc/systemd/system/act_runner.service
|
||||
```
|
||||
|
||||
服務檔內容
|
||||
|
||||
```ini
|
||||
[Unit]
|
||||
Description=Gitea Actions runner
|
||||
|
||||
[Service]
|
||||
Environment=HOME=/root
|
||||
Type=simple
|
||||
WorkingDirectory=/root
|
||||
ExecStart=/usr/local/bin/act_runner daemon
|
||||
Restart=always
|
||||
User=root
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
```
|
||||
|
||||
啟動服務
|
||||
|
||||
```bash
|
||||
systemctl daemon-reload && systemctl enable act_runner.service && systemctl start act_runner.service && systemctl status act_runner.service
|
||||
```
|
||||
Reference in New Issue
Block a user