@@ -1,3 +1,5 @@
|
||||
/target/
|
||||
.env
|
||||
.openstock/
|
||||
ops/gitea-runner/.env
|
||||
ops/gitea-runner/data/
|
||||
|
||||
@@ -55,6 +55,30 @@ git push origin main v0.1.0
|
||||
| act runner | `ubuntu-latest` job을 실행할 runner가 등록되어 있어야 합니다. |
|
||||
| release permission | workflow의 `${{ secrets.GITEA_TOKEN }}`가 release 생성/asset 업로드 권한을 가져야 합니다. |
|
||||
|
||||
### Runner
|
||||
|
||||
Docker 기반 Gitea act runner 구성은 `ops/gitea-runner`에 있습니다. 등록 토큰은 Gitea repository settings의 Actions runner 화면에서 발급받아 로컬 `.env`에만 저장합니다.
|
||||
|
||||
```bash
|
||||
cp ops/gitea-runner/.env.example ops/gitea-runner/.env
|
||||
vi ops/gitea-runner/.env
|
||||
./scripts/runner-up.sh
|
||||
```
|
||||
|
||||
러너 상태와 로그:
|
||||
|
||||
```bash
|
||||
./scripts/runner-logs.sh
|
||||
```
|
||||
|
||||
중지:
|
||||
|
||||
```bash
|
||||
./scripts/runner-down.sh
|
||||
```
|
||||
|
||||
runner는 `/var/run/docker.sock`을 mount하므로 이 머신의 Docker 권한을 가진 신뢰 가능한 저장소에만 연결해야 합니다. `ops/gitea-runner/.env`와 `ops/gitea-runner/data/`는 registration token과 runner state를 포함할 수 있어 git에서 제외합니다.
|
||||
|
||||
## Architecture
|
||||
|
||||
| Layer | Path | Role |
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
GITEA_INSTANCE_URL=https://git.hananakick.cc
|
||||
GITEA_RUNNER_REGISTRATION_TOKEN=replace-with-repository-runner-token
|
||||
GITEA_RUNNER_NAME=openstock-runner
|
||||
GITEA_RUNNER_LABELS=ubuntu-latest:docker://docker.gitea.com/runner-images:ubuntu-latest
|
||||
@@ -0,0 +1,13 @@
|
||||
services:
|
||||
openstock-runner:
|
||||
image: docker.io/gitea/act_runner:latest
|
||||
container_name: openstock-gitea-runner
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
GITEA_INSTANCE_URL: ${GITEA_INSTANCE_URL}
|
||||
GITEA_RUNNER_REGISTRATION_TOKEN: ${GITEA_RUNNER_REGISTRATION_TOKEN}
|
||||
GITEA_RUNNER_NAME: ${GITEA_RUNNER_NAME:-openstock-runner}
|
||||
GITEA_RUNNER_LABELS: ${GITEA_RUNNER_LABELS:-ubuntu-latest:docker://docker.gitea.com/runner-images:ubuntu-latest}
|
||||
volumes:
|
||||
- ./data:/data
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
Executable
+7
@@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env sh
|
||||
set -eu
|
||||
|
||||
RUNNER_DIR="$(CDPATH= cd -- "$(dirname -- "$0")/../ops/gitea-runner" && pwd)"
|
||||
|
||||
cd "$RUNNER_DIR"
|
||||
docker compose down
|
||||
Executable
+7
@@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env sh
|
||||
set -eu
|
||||
|
||||
RUNNER_DIR="$(CDPATH= cd -- "$(dirname -- "$0")/../ops/gitea-runner" && pwd)"
|
||||
|
||||
cd "$RUNNER_DIR"
|
||||
docker compose logs -f openstock-runner
|
||||
Executable
+21
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env sh
|
||||
set -eu
|
||||
|
||||
RUNNER_DIR="$(CDPATH= cd -- "$(dirname -- "$0")/../ops/gitea-runner" && pwd)"
|
||||
ENV_FILE="$RUNNER_DIR/.env"
|
||||
|
||||
if [ ! -f "$ENV_FILE" ]; then
|
||||
cp "$RUNNER_DIR/.env.example" "$ENV_FILE"
|
||||
echo "created: $ENV_FILE" >&2
|
||||
echo "edit GITEA_RUNNER_REGISTRATION_TOKEN before starting the runner" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if grep -q 'replace-with-repository-runner-token' "$ENV_FILE"; then
|
||||
echo "missing GITEA_RUNNER_REGISTRATION_TOKEN in $ENV_FILE" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd "$RUNNER_DIR"
|
||||
docker compose up -d
|
||||
docker compose ps
|
||||
Reference in New Issue
Block a user