-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add DooD GitHub self-hosted runners config #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
abbfd11
38bdd00
c5aefe5
7bc17ce
f19b5de
f200121
c789b74
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| REPOSITORY_OWNER=TourmalineCore | ||
| REG_TOKEN=<TO_BE_MODIFIED!!!> | ||
| RUNNER_GROUP=Default | ||
| LABELS=self-hosted |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| .gitattributes |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| .env |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| FROM ubuntu:24.04 | ||
|
|
||
| RUN apt-get update -y && \ | ||
| apt-get upgrade -y && \ | ||
| apt-get install -y \ | ||
| curl \ | ||
| sudo \ | ||
| ca-certificates | ||
|
|
||
| ARG DOCKER_VERSION="28.5.2" | ||
|
|
||
| # Install Docker | ||
| RUN install -m 0755 -d /etc/apt/keyrings && \ | ||
| curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc && \ | ||
| chmod a+r /etc/apt/keyrings/docker.asc && \ | ||
| # Add the repository to Apt sources: | ||
| echo \ | ||
| "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \ | ||
| $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}") stable" | \ | ||
| tee /etc/apt/sources.list.d/docker.list > /dev/null && \ | ||
| apt-get update && \ | ||
| apt install -y --no-install-recommends \ | ||
| containerd.io \ | ||
| docker-buildx-plugin \ | ||
| docker-ce-cli=5:${DOCKER_VERSION}-1~ubuntu.24.04~noble \ | ||
| docker-compose-plugin && \ | ||
| rm -rf /var/lib/apt/lists/* | ||
|
|
||
| # Add a user named runner and add it to sudoers | ||
| RUN useradd -m runner && \ | ||
| usermod -aG sudo runner && \ | ||
| echo "%sudo ALL=(ALL:ALL) NOPASSWD:ALL" > /etc/sudoers | ||
|
|
||
| ARG TARGETARCH | ||
| ARG RUNNER_VERSION="2.334.0" | ||
|
|
||
| # Set up the actions runner | ||
| RUN ARCH=$([ "$TARGETARCH" = "amd64" ] && echo x64 || echo arm64) && \ | ||
| cd /home/runner && \ | ||
| mkdir actions-runner && \ | ||
| cd actions-runner && \ | ||
| curl -o actions-runner-linux-${ARCH}-${RUNNER_VERSION}.tar.gz -L https://github.com/actions/runner/releases/download/v${RUNNER_VERSION}/actions-runner-linux-${ARCH}-${RUNNER_VERSION}.tar.gz && \ | ||
| tar xzf ./actions-runner-linux-${ARCH}-${RUNNER_VERSION}.tar.gz | ||
|
|
||
| # Install the dependencies required to run the runner | ||
| RUN /home/runner/actions-runner/bin/installdependencies.sh | ||
|
|
||
| USER runner | ||
|
|
||
| # Copy the script and make it executable | ||
| COPY start.sh /start.sh | ||
| RUN sudo chmod +x /start.sh | ||
|
|
||
| ENTRYPOINT ["/start.sh"] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| #!/bin/bash | ||
|
|
||
| cd /home/runner/actions-runner || exit | ||
|
|
||
| ./config.sh --url https://github.com/${REPOSITORY_OWNER} --token ${REG_TOKEN} --runnergroup $RUNNER_GROUP --labels $LABELS | ||
|
|
||
| # Get the ID of the group to which the file belongs | ||
| export DOCKER_GID=$(stat -c '%g' /var/run/docker.sock) | ||
|
|
||
| # Checking if a group exists | ||
| if getent group "${DOCKER_GID}" >/dev/null; then | ||
| # Adding a user to the group because it has already been created | ||
| export DOCKER_GNAME=$(stat -c '%G' /var/run/docker.sock) | ||
| sudo usermod -aG ${DOCKER_GNAME} runner | ||
| else | ||
| # Create a group if one doesn't already exist, and add the user to it | ||
| sudo groupadd -g ${DOCKER_GID} docker | ||
| sudo usermod -aG docker runner | ||
| fi | ||
|
|
||
| cleanup() { | ||
| echo "Removing runner..." | ||
| ./config.sh remove --token ${REG_TOKEN} | ||
| } | ||
|
|
||
| trap 'cleanup' TERM | ||
|
|
||
| # Start a new session for the runner user to make new group settings accessible in the runner and start runner | ||
| sudo -E -u runner bash -c ./run.sh & wait $! |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,46 @@ | ||
| # github-self-hosted-runners-template | ||
| # github-self-hosted-runners-template | ||
|
|
||
| > These repositories helped us create this repository: | ||
| > 1. [Groupe-3D/self-hosted-runner](https://github.com/Groupe-3D/self-hosted-runner) | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| 1. Install Docker Desktop (Windows, macOS) or Docker Engine (Linux) | ||
|
|
||
| ## Configuring runners | ||
|
|
||
| 1. Open `github-self-hosted-runners-template` repo folder | ||
|
|
||
| 2. Copy .env.example file with env variables as .env | ||
|
|
||
| 3. Get runner registration token from GitHub -> <ORGANIZATION_NAME> -> Settings -> Actions -> Runners -> New runner | ||
|
|
||
| Or use this link: https://github.com/organizations/<ORGANIZATION_NAME>/settings/actions/runners/new | ||
| >Change `<ORGANIZATION_NAME>` to your organization name | ||
|
|
||
| 4. Open .env file | ||
|
|
||
| 4. Paste the copied token instead of `<TO_BE_MODIFIED!!!>` | ||
|
|
||
| 5. Change TourmalineCore to your organization name | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please add info about another env variales in file and why its needed and how i can use it (that this variables means) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. especially for labels |
||
|
|
||
| ## Run runners | ||
|
|
||
| To run runners execute the following command: | ||
| ```bash | ||
| docker compose up -d --build | ||
| ``` | ||
|
|
||
| ## Troubleshooting on Mac | ||
|
|
||
| ### 1. Runner is unavailable when the Mac screen turns off | ||
| This issue occurs because the Mac and its apps go into sleep mode when the screen turns off due to inactivity. To fix this, enable the following setting: | ||
| > `System Settings -> Energy -> Prevent automatic sleeping when the display is off` | ||
|
|
||
| ### 2. Once the power goes out, you need to go to the Mac and turn it on manually | ||
| To make your Mac enable when powered on, enable the following setting: | ||
| > `System Settings -> Energy -> Start up automatically after power failure` | ||
|
|
||
| ### 3. Docker and runner won't start until a password is entered | ||
| Yes, on a Mac, apps only launch after you enter your password. To avoid entering a password and automatically log in when the Mac starts, enable the following setting: | ||
| > `System Settings -> Users & Groups -> Automatically log in as` | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| services: | ||
| runner: | ||
| build: | ||
| dockerfile: Dockerfile | ||
| context: ./DockerImage | ||
| restart: unless-stopped | ||
| env_file: .env | ||
| deploy: | ||
| mode: replicated | ||
| replicas: 2 | ||
| resources: | ||
| limits: | ||
| cpus: '2' | ||
| memory: 2G | ||
| reservations: | ||
| cpus: '0.1' | ||
| memory: 256M | ||
|
Comment on lines
+10
to
+17
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please add to readme info about these options for configuration runners count and resources |
||
| volumes: | ||
| - /var/run/docker.sock:/var/run/docker.sock | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add info about place where i can find tis token on page