我正在尝试在 gitlab-ci 中连接 postgres 和 supabase/realtime 服务,但是运行者在运行 supabase/realtime 时抛出错误:FATAL: No HOST or PORT found
我不明白是什么原因造成的。
这是我的 gitlab-ci.yml 文件:
image: node:16.2.0-buster
stages:
- my_job
my_job:
stage: my
services:
- name: supabase/postgres:13.3.0
command: ['postgres', '-c', 'wal_level=logical']
alias: postgres
- name: registry.shirberenj.ir/realtime:v0.15.0
alias: realtime
variables:
PORT: '4000'
POSTGRES_PORT: '5432'
POSTGRES_HOST: postgres
POSTGRES_PASSWORD: somePassword
POSTGRES_USER: postgres
POSTGRES_DB: ketabchi
MINIO_PORT: '9000'
REAL_TIME_TOKEN: 'SOMESECRET'
REAL_TIME_URL: 'ws://realtime:4000/socket'
DB_HOST: postgres
DB_NAME: ketabchi
DB_USER: postgres
DB_PASSWORD: somePassword
DB_PORT: '5432'
JWT_SECRET: SOMESECRET
SECURE_CHANNELS: 'false'
script:
- echo "hi"
这是完整的输出日志:
Runtime platform arch=amd64 os=linux pid=3947630 revision=8b63c432 version=14.3.1
WARNING: You most probably have uncommitted changes.
WARNING: These changes will not be tested.
Running with gitlab-runner 14.3.1 (8b63c432)
Preparing the "docker" executor
Using Docker executor with image node:16.2.0-buster ...
Starting service supabase/postgres:13.3.0 ...
Pulling docker image supabase/postgres:13.3.0 ...
Using docker image sha256:4c10fb4b98624d9d2ade053692ab5c89f251558063d983c62900a388fb7ccf10 for supabase/postgres:13.3.0 with
digest supabase/postgres@sha256:9161d8cd63641a569acf7f81ac409cbea4cfb0d192ed6bd6e6e326176d2882ed ...
Starting service registry.shirberenj.ir/realtime:v0.15.0 ...
Pulling docker image registry.shirberenj.ir/realtime:v0.15.0 ...
Using docker image sha256:5a9e4db4b86a6803531fc3e2a8c29bbbe12746683c4c1cd422d18b1ae6264de4 for registry.shirberenj.ir/realti
me:v0.15.0 with digest registry.shirberenj.ir/realtime@sha256:43397da2d639338cf795deb141c22fdcbc9a8ce0c48856c69ba886c2ecf45f
32 ...
Waiting for services to be up and running...
*** WARNING: Service runner--project-0-concurrent-0-d3ba2834bd12a52a-registry.shirberenj.ir__realtime-1 probably didn't star
t properly.
Health check error:
service "runner--project-0-concurrent-0-d3ba2834bd12a52a-registry.shirberenj.ir__realtime-1-wait-for-service" health check:
exit code 1
Health check container logs:
2021-10-17T08:55:23.621621102Z FATAL: No HOST or PORT found
Service container logs:
*********
Pulling docker image node:16.2.0-buster ...
Using docker image sha256:7493e35c7ffa6042748fe654285b11f9922684cdace9fdf34de782f0cba75170 for node:16.2.0-buster with digest node@sha256:ddc2ebfc3759299afb2085bba7648416e016b326389323a257c4f8d1da097c9c ...
Preparing environment
Running on runner--project-0-concurrent-0 via laptop...
Getting source from Git repository
ERROR: Failed to cleanup volumes
ERROR: Job failed (system failure): Error response from daemon: Cannot link to a non running container: /runner--project-0-concurrent-0-d3ba2834bd12a52a-registry.shirberenj.ir__realtime-1 AS /runner--project-0-concurrent-0-d3ba2834bd12a52a-predefined-1/registry.shirberenj.ir__realtime (exec.go:57:1s)
FATAL: Error response from daemon: Cannot link to a non running container: /runner--project-0-concurrent-0-d3ba2834bd12a52a-registry.shirberenj.ir__realtime-1 AS /runner--project-0-concurrent-0-d3ba2834bd12a52a-predefined-1/registry.shirberenj.ir__realtime (exec.go:57:1s)
我通过在本地运行 gitlab runner 得到了这个输出,gitlab-runner exec docker my_job
但是本地没有不同,或者在我的服务器中错误是一样的。