Avoid creating new action runner token after each update #323

Open
opened 2023-08-03 10:56:21 +00:00 by TheZoker · 6 comments
TheZoker commented 2023-08-03 10:56:21 +00:00 (Migrated from gitea.com)

Every time I update my gitea act runner, the runner can’t connect to the gitea instance anymore, because the token has already been used.

I use docker compose to run the runner:

version: '3.8'
services:
  gitea_runner:
    image: gitea/act_runner
    container_name: GiteaRunner
    restart: always
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    environment:
      - GITEA_RUNNER_NAME=Gitea Runner
      - GITEA_INSTANCE_URL=<my-url>
      - GITEA_RUNNER_REGISTRATION_TOKEN=<my-token>
Every time I update my gitea act runner, the runner can’t connect to the gitea instance anymore, because the token has already been used. I use docker compose to run the runner: ```yaml version: '3.8' services: gitea_runner: image: gitea/act_runner container_name: GiteaRunner restart: always volumes: - /var/run/docker.sock:/var/run/docker.sock environment: - GITEA_RUNNER_NAME=Gitea Runner - GITEA_INSTANCE_URL=<my-url> - GITEA_RUNNER_REGISTRATION_TOKEN=<my-token> ```
sillyguodong commented 2023-08-03 11:00:39 +00:00 (Migrated from gitea.com)

Maybe a reusable register token can resolve it.

Maybe a reusable register token can resolve it.
ChristopherHX commented 2023-08-03 11:10:44 +00:00 (Migrated from gitea.com)

Or preserve the volume of the .runner file

- gitea-runner-data:/data
version: '3.8'
services:
  gitea_runner:
    image: gitea/act_runner
    container_name: GiteaRunner
    restart: always
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - gitea-runner-data:/data
    environment:
      - GITEA_RUNNER_NAME=Gitea Runner
      - GITEA_INSTANCE_URL=<my-url>
      - GITEA_RUNNER_REGISTRATION_TOKEN=<my-token>
Or preserve the volume of the `.runner` file ```yaml - gitea-runner-data:/data ``` ```yaml version: '3.8' services: gitea_runner: image: gitea/act_runner container_name: GiteaRunner restart: always volumes: - /var/run/docker.sock:/var/run/docker.sock - gitea-runner-data:/data environment: - GITEA_RUNNER_NAME=Gitea Runner - GITEA_INSTANCE_URL=<my-url> - GITEA_RUNNER_REGISTRATION_TOKEN=<my-token> ```
TheZoker commented 2023-08-03 12:14:03 +00:00 (Migrated from gitea.com)

@ChristopherHX Thanks for the hint! Maybe this should be added to the README file, so others know about this (I think there is no scenario, where someone does not want this) 🤔

@ChristopherHX Thanks for the hint! Maybe this should be added to the README file, so others know about this (I think there is no scenario, where someone does not want this) 🤔
Ghost commented 2023-08-03 12:57:51 +00:00 (Migrated from gitea.com)

It is mentioned in the docker example and the docker compose example. Though less explicitly in the second one.

It is mentioned in the [docker example](https://gitea.com/gitea/act_runner/src/branch/main/examples/docker) and the [docker compose example](https://gitea.com/gitea/act_runner/src/branch/main/examples/docker-compose). Though less explicitly in the second one.
seepine commented 2023-08-04 14:50:22 +00:00 (Migrated from gitea.com)
@TheZoker Maybe you need https://docs.gitea.com/next/usage/actions/act-runner#%E4%BD%BF%E7%94%A8-docker-compose-%E8%BF%90%E8%A1%8C-runner
seepine commented 2023-08-04 14:52:02 +00:00 (Migrated from gitea.com)

And https://gitea.com/gitea/act_runner/pulls/118#issue-193685

volume /data save .runner config file
volume /root/.cache save actcache and actions cache

docker run -e GITEA_INSTANCE_URL=***                    \
           -e GITEA_RUNNER_REGISTRATION_TOKEN=***       \
           -e GITEA_RUNNER_NAME=***                     \
           -v /var/run/docker.sock:/var/run/docker.sock \
           -v /root/act_runner/data:/data               \
           -v /root/act_runner/cache:/root/.cache       \
           gitea/act_runner
And https://gitea.com/gitea/act_runner/pulls/118#issue-193685 > volume `/data` save `.runner` config file > volume `/root/.cache` save actcache and actions cache ```sh docker run -e GITEA_INSTANCE_URL=*** \ -e GITEA_RUNNER_REGISTRATION_TOKEN=*** \ -e GITEA_RUNNER_NAME=*** \ -v /var/run/docker.sock:/var/run/docker.sock \ -v /root/act_runner/data:/data \ -v /root/act_runner/cache:/root/.cache \ gitea/act_runner ```
Sign in to join this conversation.