New act runner run in docker lead to error 500 on server #11834

Closed
opened 2025-11-02 09:49:15 -06:00 by GiteaMirror · 6 comments
Owner

Originally created by @falkolab on GitHub (Oct 11, 2023).

Description

I'm trying to start runner in docker.
As the docs say:
If you are using the docker image, behaviour will be slightly different. Registration and running are combined into one step in this case, so you need to specify the registration information when running the act runner.

Runner doesn't register, and server throws the 500 error
It happened after reseting registration token. I'm trying to register new runner with the new token.
Gitea running in docker on another host then runner.

Runner start command:

docker run \
    -v $PWD/config.yaml:/config.yaml \
    -v $PWD/data:/data \
    -v /var/run/docker.sock:/var/run/docker.sock \
    --restart unless-stopped \
    -e CONFIG_FILE=/config.yaml \
    -e GITEA_INSTANCE_URL=http://gitea.***.ru:3000/ \
    -e GITEA_RUNNER_REGISTRATION_TOKEN=*** \
    -e GITEA_RUNNER_NAME=docker01 \
    --name act_runner \
    -d gitea/act_runner:nightly

Gitea Version

1.20.4

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

https://gist.github.com/falkolab/17d5af280ef09e98856c5e998713625f

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

version: "3"

networks:
  gitea:
    external: false

services:
  server:
    image: gitea/gitea:latest
    container_name: gitea
    environment:
      - USER_UID=1000
      - USER_GID=1000
      - GITEA__database__DB_TYPE=postgres
      - GITEA__database__HOST=db:5432
      - GITEA__database__NAME=gitea
      - GITEA__database__USER=gitea
      - GITEA__database__PASSWD=***
    restart: always
    networks:
      - gitea
    volumes:
      - ./gitea:/data
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    ports:
      - "3000:3000"
      - "222:22"

    depends_on:
      - db

  db:
    image: postgres:14
    restart: always
    environment:
      - POSTGRES_USER=gitea
      - POSTGRES_PASSWORD=***
      - POSTGRES_DB=gitea
    networks:
      - gitea
    volumes:
      - ./postgres:/var/lib/postgresql/data

Database

None

Originally created by @falkolab on GitHub (Oct 11, 2023). ### Description I'm trying to start runner in docker. As the docs say: ` If you are using the docker image, behaviour will be slightly different. Registration and running are combined into one step in this case, so you need to specify the registration information when running the act runner.` Runner doesn't register, and server throws the 500 error It happened after reseting registration token. I'm trying to register new runner with the new token. Gitea running in docker on another host then runner. Runner start command: ``` docker run \ -v $PWD/config.yaml:/config.yaml \ -v $PWD/data:/data \ -v /var/run/docker.sock:/var/run/docker.sock \ --restart unless-stopped \ -e CONFIG_FILE=/config.yaml \ -e GITEA_INSTANCE_URL=http://gitea.***.ru:3000/ \ -e GITEA_RUNNER_REGISTRATION_TOKEN=*** \ -e GITEA_RUNNER_NAME=docker01 \ --name act_runner \ -d gitea/act_runner:nightly ``` ### Gitea Version 1.20.4 ### Can you reproduce the bug on the Gitea demo site? No ### Log Gist https://gist.github.com/falkolab/17d5af280ef09e98856c5e998713625f ### Screenshots _No response_ ### Git Version _No response_ ### Operating System _No response_ ### How are you running Gitea? ``` version: "3" networks: gitea: external: false services: server: image: gitea/gitea:latest container_name: gitea environment: - USER_UID=1000 - USER_GID=1000 - GITEA__database__DB_TYPE=postgres - GITEA__database__HOST=db:5432 - GITEA__database__NAME=gitea - GITEA__database__USER=gitea - GITEA__database__PASSWD=*** restart: always networks: - gitea volumes: - ./gitea:/data - /etc/timezone:/etc/timezone:ro - /etc/localtime:/etc/localtime:ro ports: - "3000:3000" - "222:22" depends_on: - db db: image: postgres:14 restart: always environment: - POSTGRES_USER=gitea - POSTGRES_PASSWORD=*** - POSTGRES_DB=gitea networks: - gitea volumes: - ./postgres:/var/lib/postgresql/data ``` ### Database None
GiteaMirror added the type/bugissue/needs-feedback labels 2025-11-02 09:49:15 -06:00
Author
Owner

@lunny commented on GitHub (Oct 11, 2023):

Once you reset the register token, all old register token will be invalid and cannot be used to register runners.
All registered runners should not be affected because after registered a runner token has been generated from Gitea side which is unrelated with register token.

@lunny commented on GitHub (Oct 11, 2023): Once you reset the register token, all old register token will be invalid and cannot be used to register runners. All registered runners should not be affected because after registered a runner token has been generated from Gitea side which is unrelated with register token.
Author
Owner

@falkolab commented on GitHub (Oct 11, 2023):

@lunny thank you for the quick answer but I wrote it's a new runner with new token did you read description?

@falkolab commented on GitHub (Oct 11, 2023): @lunny thank you for the quick answer but I wrote it's a new runner with new token did you read description?
Author
Owner

@techknowlogick commented on GitHub (Oct 11, 2023):

Thanks for including logs, looking at the server providing a 500 error the log is only for the router: 2023/10/11 12:42:28 ...eb/routing/logger.go:102:func1() [I] router: completed POST /api/actions/runner.v1.RunnerService/FetchTask for <ip>:51638, 500 Internal Server Error in 2.4ms @ <autogenerated>:1(http.Handler.ServeHTTP-fm)

Could you provide additional logs with more details? Here is a guide that can help with that: https://docs.gitea.com/help/support#more-config-options-for-logs as it will show why the router is responding with a 500

@techknowlogick commented on GitHub (Oct 11, 2023): Thanks for including logs, looking at the server providing a 500 error the log is only for the router: `2023/10/11 12:42:28 ...eb/routing/logger.go:102:func1() [I] router: completed POST /api/actions/runner.v1.RunnerService/FetchTask for <ip>:51638, 500 Internal Server Error in 2.4ms @ <autogenerated>:1(http.Handler.ServeHTTP-fm)` Could you provide additional logs with more details? Here is a guide that can help with that: https://docs.gitea.com/help/support#more-config-options-for-logs as it will show why the router is responding with a 500
Author
Owner

@falkolab commented on GitHub (Oct 11, 2023):

The logs I posted in gist before was made with Trace level, nothing different with your instruction applied, the log file contains same lines without additional info...
Nothing showing in Stacktrace on 6060 port

wget http://127.0.0.1:6060/debug/pprof/goroutine?debug=1
--2023-10-11 18:29:35--  http://127.0.0.1:6060/debug/pprof/goroutine?debug=1
Connecting to 127.0.0.1:6060... connected.
HTTP request sent, awaiting response... No data received.
Retrying.

--2023-10-11 18:29:36--  (try: 2)  http://127.0.0.1:6060/debug/pprof/goroutine?debug=1
Connecting to 127.0.0.1:6060... connected.
HTTP request sent, awaiting response... Read error (Connection reset by peer) in headers.
Retrying.

app.ini logs section:

[log]
;MODE = console
;LEVEL = info
ROOT_PATH = /data/gitea/log
LEVEL=debug
MODE=console,file

Do you need some results from db tables? Could you provide query?

@falkolab commented on GitHub (Oct 11, 2023): The logs I posted in gist before was made with Trace level, nothing different with your instruction applied, the log file contains same lines without additional info... Nothing showing in Stacktrace on 6060 port ``` wget http://127.0.0.1:6060/debug/pprof/goroutine?debug=1 --2023-10-11 18:29:35-- http://127.0.0.1:6060/debug/pprof/goroutine?debug=1 Connecting to 127.0.0.1:6060... connected. HTTP request sent, awaiting response... No data received. Retrying. --2023-10-11 18:29:36-- (try: 2) http://127.0.0.1:6060/debug/pprof/goroutine?debug=1 Connecting to 127.0.0.1:6060... connected. HTTP request sent, awaiting response... Read error (Connection reset by peer) in headers. Retrying. ``` app.ini logs section: ``` [log] ;MODE = console ;LEVEL = info ROOT_PATH = /data/gitea/log LEVEL=debug MODE=console,file ``` Do you need some results from db tables? Could you provide query?
Author
Owner

@falkolab commented on GitHub (Oct 11, 2023):

I solved with steps:

On the server:

docker compose exec -it db psql -U gitea -W gitea

psql> DELETE FROM "public"."action_runner"

Yes I know it would be good to investigate deeper and no so dirty.
But I had no production runners and safely delete all.

On the runner side:
Deleted runner registration from runner's data volume:

rm -rf ./.runner

Started runner container register/run again with proper token.

I have thoughts how it was possible:
I copied runner config from one server to another, I didn't notice I copied it with .runner folder.
The reseting token was superfluous step, but issue reason was made buy copying .runner folder, I shouldn't have done this.

Probably this case should be handled by server somehow more descriptive.

@falkolab commented on GitHub (Oct 11, 2023): I solved with steps: **On the server:** ``` docker compose exec -it db psql -U gitea -W gitea psql> DELETE FROM "public"."action_runner" ``` Yes I know it would be good to investigate deeper and no so dirty. But I had no production runners and safely delete all. **On the runner side:** Deleted runner registration from runner's data volume: ``` rm -rf ./.runner ``` Started runner container register/run again with proper token. I have thoughts how it was possible: I copied runner config from one server to another, I didn't notice I copied it with `.runner` folder. The reseting token was superfluous step, but issue reason was made buy copying `.runner` folder, I shouldn't have done this. Probably this case should be handled by server somehow more descriptive.
Author
Owner

@lunny commented on GitHub (Oct 12, 2023):

Yes, that's the problem. Never copy .runner file.

@lunny commented on GitHub (Oct 12, 2023): Yes, that's the problem. Never copy `.runner` file.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#11834