Skip to content
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

启动服务出现报错 #14

Closed
InjoyDeng opened this issue Mar 7, 2024 · 6 comments
Closed

启动服务出现报错 #14

InjoyDeng opened this issue Mar 7, 2024 · 6 comments

Comments

@InjoyDeng
Copy link

InjoyDeng commented Mar 7, 2024

我使用 ./deploy 创建的 .env 和容器

Current OS: Darwin x86_64
Docker version: 25.0.3
Docker Compose version: 2.24.5

.env 配置:

ZEALOT_DOMAIN=zealot.localtest.com
# ZEALOT_CERT_EMAIL=
# ZEALOT_CERT=
# ZEALOT_CERT_KEY=
# 其他默认配置...

执行 docker-compose upzealot-1 服务出现报错:

Attaching to postgres-1, redis-1, zealot-1
redis-1     | 1:C 07 Mar 2024 12:45:20.059 * oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
redis-1     | 1:C 07 Mar 2024 12:45:20.059 * Redis version=7.2.4, bits=64, commit=00000000, modified=0, pid=1, just started
redis-1     | 1:C 07 Mar 2024 12:45:20.059 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
redis-1     | 1:M 07 Mar 2024 12:45:20.059 * monotonic clock: POSIX clock_gettime
redis-1     | 1:M 07 Mar 2024 12:45:20.060 * Running mode=standalone, port=6379.
redis-1     | 1:M 07 Mar 2024 12:45:20.061 * Server initialized
redis-1     | 1:M 07 Mar 2024 12:45:20.061 * Loading RDB produced by version 7.2.4
redis-1     | 1:M 07 Mar 2024 12:45:20.061 * RDB age 5949 seconds
redis-1     | 1:M 07 Mar 2024 12:45:20.062 * RDB memory usage when created 0.83 Mb
redis-1     | 1:M 07 Mar 2024 12:45:20.062 * Done loading RDB, keys loaded: 0, keys expired: 0.
redis-1     | 1:M 07 Mar 2024 12:45:20.062 * DB loaded from disk: 0.000 seconds
redis-1     | 1:M 07 Mar 2024 12:45:20.062 * Ready to accept connections tcp
postgres-1  | 
postgres-1  | PostgreSQL Database directory appears to contain a database; Skipping initialization
postgres-1  | 
postgres-1  | 2024-03-07 12:45:20.114 UTC [1] LOG:  starting PostgreSQL 14.11 on x86_64-pc-linux-musl, compiled by gcc (Alpine 13.2.1_git20231014) 13.2.1 20231014, 64-bit
postgres-1  | 2024-03-07 12:45:20.114 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
postgres-1  | 2024-03-07 12:45:20.114 UTC [1] LOG:  listening on IPv6 address "::", port 5432
postgres-1  | 2024-03-07 12:45:20.119 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
postgres-1  | 2024-03-07 12:45:20.127 UTC [22] LOG:  database system was shut down at 2024-03-07 11:06:11 UTC
postgres-1  | 2024-03-07 12:45:20.139 UTC [1] LOG:  database system is ready to accept connections
zealot-1    | [s6-init] making user provided files available at /var/run/s6/etc...exited 0.
zealot-1    | [s6-init] ensuring user provided files have correct perms...exited 0.
zealot-1    | [fix-attrs.d] applying ownership & permissions fixes...
zealot-1    | [fix-attrs.d] 11-crontab-dir: applying... 
zealot-1    | [fix-attrs.d] 11-crontab-dir: exited 1.
zealot-1    | [fix-attrs.d] done.
zealot-1    | [cont-init.d] executing container initialization scripts...
zealot-1    | [cont-init.d] 01-set-timezone: executing... 
zealot-1    | [cont-init.d] 01-set-timezone: exited 0.
zealot-1    | [cont-init.d] 11-set-crontab: executing... 
zealot-1    | [cont-init.d] 11-set-crontab: exited 0.
zealot-1    | [cont-init.d] 12-logrotate: executing... 
zealot-1    | [cont-init.d] 12-logrotate: exited 0.
zealot-1    | [cont-init.d] 20-init-zealot: executing... 
zealot-1    | [cont-init.d] 20-init-zealot: exited 0.
zealot-1    | [cont-init.d] 21-fix-caddy-format: executing... 
zealot-1    | [cont-init.d] 21-fix-caddy-format: exited 0.
zealot-1    | [cont-init.d] 25-upgrade-zealot: executing... 
zealot-1    | bin/rails aborted!
zealot-1    | Psych::SyntaxError: (<unknown>): did not find expected comment or line break while scanning a block scalar at line 14 column 20
zealot-1    | /app/vendor/bundle/ruby/3.0.0/gems/psych-5.1.2/lib/psych/parser.rb:62:in `_native_parse'
zealot-1    | /app/vendor/bundle/ruby/3.0.0/gems/psych-5.1.2/lib/psych/parser.rb:62:in `parse'
zealot-1    | /app/vendor/bundle/ruby/3.0.0/gems/psych-5.1.2/lib/psych.rb:455:in `parse_stream'
zealot-1    | /app/vendor/bundle/ruby/3.0.0/gems/psych-5.1.2/lib/psych.rb:399:in `parse'
zealot-1    | /app/vendor/bundle/ruby/3.0.0/gems/psych-5.1.2/lib/psych.rb:272:in `unsafe_load'
zealot-1    | /app/vendor/bundle/ruby/3.0.0/gems/railties-7.1.3.1/lib/rails/secrets.rb:30:in `block in parse'
zealot-1    | /app/vendor/bundle/ruby/3.0.0/gems/railties-7.1.3.1/lib/rails/secrets.rb:26:in `each'
zealot-1    | /app/vendor/bundle/ruby/3.0.0/gems/railties-7.1.3.1/lib/rails/secrets.rb:26:in `each_with_object'
zealot-1    | /app/vendor/bundle/ruby/3.0.0/gems/railties-7.1.3.1/lib/rails/secrets.rb:26:in `parse'
zealot-1    | /app/vendor/bundle/ruby/3.0.0/gems/railties-7.1.3.1/lib/rails/application.rb:451:in `secrets'
zealot-1    | /app/vendor/bundle/ruby/3.0.0/gems/devise-4.9.3/lib/devise/secret_key_finder.rb:12:in `find'
zealot-1    | /app/vendor/bundle/ruby/3.0.0/gems/devise-4.9.3/lib/devise/rails.rb:41:in `block in <class:Engine>'
zealot-1    | /app/vendor/bundle/ruby/3.0.0/gems/railties-7.1.3.1/lib/rails/initializable.rb:32:in `instance_exec'
zealot-1    | /app/vendor/bundle/ruby/3.0.0/gems/railties-7.1.3.1/lib/rails/initializable.rb:32:in `run'
zealot-1    | /app/vendor/bundle/ruby/3.0.0/gems/railties-7.1.3.1/lib/rails/initializable.rb:61:in `block in run_initializers'
zealot-1    | /app/vendor/bundle/ruby/3.0.0/gems/railties-7.1.3.1/lib/rails/initializable.rb:60:in `run_initializers'
zealot-1    | /app/vendor/bundle/ruby/3.0.0/gems/railties-7.1.3.1/lib/rails/application.rb:426:in `initialize!'
zealot-1    | /app/config/environment.rb:7:in `<main>'
zealot-1    | /app/vendor/bundle/ruby/3.0.0/gems/bootsnap-1.17.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
zealot-1    | /app/vendor/bundle/ruby/3.0.0/gems/bootsnap-1.17.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
zealot-1    | /app/vendor/bundle/ruby/3.0.0/gems/zeitwerk-2.6.13/lib/zeitwerk/kernel.rb:34:in `require'
zealot-1    | /app/vendor/bundle/ruby/3.0.0/gems/railties-7.1.3.1/lib/rails/application.rb:402:in `require_environment!'
zealot-1    | /app/vendor/bundle/ruby/3.0.0/gems/railties-7.1.3.1/lib/rails/application.rb:588:in `block in run_tasks_blocks'
zealot-1    | /app/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `block in execute'
zealot-1    | /app/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `each'
zealot-1    | /app/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `execute'
zealot-1    | /app/vendor/bundle/ruby/3.0.0/gems/sentry-ruby-5.15.2/lib/sentry/rake.rb:24:in `execute'
zealot-1    | /app/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/task.rb:219:in `block in invoke_with_call_chain'
zealot-1    | /app/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/task.rb:199:in `synchronize'
zealot-1    | /app/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/task.rb:199:in `invoke_with_call_chain'
zealot-1    | /app/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/task.rb:243:in `block in invoke_prerequisites'
zealot-1    | /app/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/task.rb:241:in `each'
zealot-1    | /app/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/task.rb:241:in `invoke_prerequisites'
zealot-1    | /app/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/task.rb:218:in `block in invoke_with_call_chain'
zealot-1    | /app/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/task.rb:199:in `synchronize'
zealot-1    | /app/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/task.rb:199:in `invoke_with_call_chain'
zealot-1    | /app/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/task.rb:188:in `invoke'
zealot-1    | /app/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/application.rb:160:in `invoke_task'
zealot-1    | /app/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `block (2 levels) in top_level'
zealot-1    | /app/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `each'
zealot-1    | /app/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `block in top_level'
zealot-1    | /app/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/application.rb:125:in `run_with_threads'
zealot-1    | /app/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/application.rb:110:in `top_level'
zealot-1    | /app/vendor/bundle/ruby/3.0.0/gems/railties-7.1.3.1/lib/rails/commands/rake/rake_command.rb:27:in `block (2 levels) in perform'
zealot-1    | /app/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/application.rb:186:in `standard_exception_handling'
zealot-1    | /app/vendor/bundle/ruby/3.0.0/gems/railties-7.1.3.1/lib/rails/commands/rake/rake_command.rb:27:in `block in perform'
zealot-1    | /app/vendor/bundle/ruby/3.0.0/gems/railties-7.1.3.1/lib/rails/commands/rake/rake_command.rb:44:in `block in with_rake'
zealot-1    | /app/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/rake_module.rb:59:in `with_application'
zealot-1    | /app/vendor/bundle/ruby/3.0.0/gems/railties-7.1.3.1/lib/rails/commands/rake/rake_command.rb:41:in `with_rake'
zealot-1    | /app/vendor/bundle/ruby/3.0.0/gems/railties-7.1.3.1/lib/rails/commands/rake/rake_command.rb:20:in `perform'
zealot-1    | /app/vendor/bundle/ruby/3.0.0/gems/railties-7.1.3.1/lib/rails/command.rb:156:in `invoke_rake'
zealot-1    | /app/vendor/bundle/ruby/3.0.0/gems/railties-7.1.3.1/lib/rails/command.rb:73:in `block in invoke'
zealot-1    | /app/vendor/bundle/ruby/3.0.0/gems/railties-7.1.3.1/lib/rails/command.rb:149:in `with_argv'
zealot-1    | /app/vendor/bundle/ruby/3.0.0/gems/railties-7.1.3.1/lib/rails/command.rb:69:in `invoke'
zealot-1    | /app/vendor/bundle/ruby/3.0.0/gems/railties-7.1.3.1/lib/rails/commands.rb:18:in `<main>'
zealot-1    | /app/vendor/bundle/ruby/3.0.0/gems/bootsnap-1.17.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
zealot-1    | /app/vendor/bundle/ruby/3.0.0/gems/bootsnap-1.17.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
zealot-1    | Tasks: TOP => zealot:precheck => environment
zealot-1    | (See full trace by running task with --trace)
zealot-1    | [cont-init.d] 25-upgrade-zealot: exited 0.
zealot-1    | [cont-init.d] done.
zealot-1    | [services.d] starting services
zealot-1    | Starting Zealot Worker
zealot-1    | Starting Caddy
zealot-1    | Starting Zealot
zealot-1    | [services.d] done.
zealot-1    | [342] Puma starting in cluster mode...
zealot-1    | [342] * Puma version: 6.4.2 (ruby 3.0.6-p216) ("The Eagle of Durango")
zealot-1    | [342] *  Min threads: 5
zealot-1    | [342] *  Max threads: 5
zealot-1    | [342] *  Environment: production
zealot-1    | [342] *   Master PID: 342
zealot-1    | [342] *      Workers: 2
zealot-1    | [342] *     Restarts: (✔) hot (✔) phased
zealot-1    | [342] * Listening on http://127.0.0.1:3000
zealot-1    | [342] Use Ctrl-C to stop
zealot-1    | [342] * Starting control server on http://0.0.0.0:9293
zealot-1    | [363] ! Unable to start worker
zealot-1    | [363] (<unknown>): did not find expected comment or line break while scanning a block scalar at line 14 column 20
zealot-1    | [363] /app/vendor/bundle/ruby/3.0.0/gems/psych-5.1.2/lib/psych/parser.rb:62:in `_native_parse'
zealot-1    |     /app/vendor/bundle/ruby/3.0.0/gems/psych-5.1.2/lib/psych/parser.rb:62:in `parse'
zealot-1    |     /app/vendor/bundle/ruby/3.0.0/gems/psych-5.1.2/lib/psych.rb:455:in `parse_stream'
zealot-1    |     /app/vendor/bundle/ruby/3.0.0/gems/psych-5.1.2/lib/psych.rb:399:in `parse'
zealot-1    |     /app/vendor/bundle/ruby/3.0.0/gems/psych-5.1.2/lib/psych.rb:272:in `unsafe_load'
zealot-1    |     /app/vendor/bundle/ruby/3.0.0/gems/railties-7.1.3.1/lib/rails/secrets.rb:30:in `block in parse'
zealot-1    |     /app/vendor/bundle/ruby/3.0.0/gems/railties-7.1.3.1/lib/rails/secrets.rb:26:in `each'
zealot-1    |     /app/vendor/bundle/ruby/3.0.0/gems/railties-7.1.3.1/lib/rails/secrets.rb:26:in `each_with_object'
zealot-1    |     /app/vendor/bundle/ruby/3.0.0/gems/railties-7.1.3.1/lib/rails/secrets.rb:26:in `parse'
zealot-1    |     /app/vendor/bundle/ruby/3.0.0/gems/railties-7.1.3.1/lib/rails/application.rb:451:in `secrets'
zealot-1    |     /app/vendor/bundle/ruby/3.0.0/gems/devise-4.9.3/lib/devise/secret_key_finder.rb:12:in `find'
zealot-1    |     /app/vendor/bundle/ruby/3.0.0/gems/devise-4.9.3/lib/devise/rails.rb:41:in `block in <class:Engine>'
zealot-1    |     /app/vendor/bundle/ruby/3.0.0/gems/railties-7.1.3.1/lib/rails/initializable.rb:32:in `instance_exec'
zealot-1    |     /app/vendor/bundle/ruby/3.0.0/gems/railties-7.1.3.1/lib/rails/initializable.rb:32:in `run'
zealot-1    |     /app/vendor/bundle/ruby/3.0.0/gems/railties-7.1.3.1/lib/rails/initializable.rb:61:in `block in run_initializers'
zealot-1    |     /usr/local/lib/ruby/3.0.0/tsort.rb:228:in `block in tsort_each'
zealot-1    |     /usr/local/lib/ruby/3.0.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
zealot-1    |     /usr/local/lib/ruby/3.0.0/tsort.rb:431:in `each_strongly_connected_component_from'
zealot-1    |     /usr/local/lib/ruby/3.0.0/tsort.rb:349:in `block in each_strongly_connected_component'
zealot-1    |     /usr/local/lib/ruby/3.0.0/tsort.rb:347:in `each'
zealot-1    |     /usr/local/lib/ruby/3.0.0/tsort.rb:347:in `call'
zealot-1    |     /usr/local/lib/ruby/3.0.0/tsort.rb:347:in `each_strongly_connected_component'
zealot-1    |     /usr/local/lib/ruby/3.0.0/tsort.rb:226:in `tsort_each'
zealot-1    |     /usr/local/lib/ruby/3.0.0/tsort.rb:205:in `tsort_each'
zealot-1    |     /app/vendor/bundle/ruby/3.0.0/gems/railties-7.1.3.1/lib/rails/initializable.rb:60:in `run_initializers'
zealot-1    |     /app/vendor/bundle/ruby/3.0.0/gems/railties-7.1.3.1/lib/rails/application.rb:426:in `initialize!'
zealot-1    |     /app/config/environment.rb:7:in `<top (required)>'
zealot-1    |     config.ru:3:in `require_relative'
zealot-1    |     config.ru:3:in `block in <main>'
zealot-1    |     /app/vendor/bundle/ruby/3.0.0/gems/rack-3.0.9.1/lib/rack/builder.rb:103:in `eval'
zealot-1    |     /app/vendor/bundle/ruby/3.0.0/gems/rack-3.0.9.1/lib/rack/builder.rb:103:in `new_from_string'
zealot-1    |     /app/vendor/bundle/ruby/3.0.0/gems/rack-3.0.9.1/lib/rack/builder.rb:94:in `load_file'
zealot-1    |     /app/vendor/bundle/ruby/3.0.0/gems/rack-3.0.9.1/lib/rack/builder.rb:64:in `parse_file'
zealot-1    |     /app/vendor/bundle/ruby/3.0.0/gems/puma-6.4.2/lib/puma/configuration.rb:368:in `load_rackup'
zealot-1    |     /app/vendor/bundle/ruby/3.0.0/gems/puma-6.4.2/lib/puma/configuration.rb:290:in `app'
zealot-1    |     /app/vendor/bundle/ruby/3.0.0/gems/puma-6.4.2/lib/puma/runner.rb:173:in `app'
zealot-1    |     /app/vendor/bundle/ruby/3.0.0/gems/puma-6.4.2/lib/puma/runner.rb:177:in `start_server'
zealot-1    |     /app/vendor/bundle/ruby/3.0.0/gems/puma-6.4.2/lib/puma/cluster/worker.rb:60:in `run'
zealot-1    |     /app/vendor/bundle/ruby/3.0.0/gems/puma-6.4.2/lib/puma/cluster.rb:216:in `worker'
zealot-1    |     /app/vendor/bundle/ruby/3.0.0/gems/puma-6.4.2/lib/puma/cluster.rb:97:in `block in spawn_worker'
zealot-1    |     /app/vendor/bundle/ruby/3.0.0/gems/puma-6.4.2/lib/puma/cluster.rb:97:in `fork'
zealot-1    |     /app/vendor/bundle/ruby/3.0.0/gems/puma-6.4.2/lib/puma/cluster.rb:97:in `spawn_worker'
zealot-1    |     /app/vendor/bundle/ruby/3.0.0/gems/puma-6.4.2/lib/puma/cluster.rb:81:in `block in spawn_workers'
zealot-1    |     /app/vendor/bundle/ruby/3.0.0/gems/puma-6.4.2/lib/puma/cluster.rb:74:in `times'
zealot-1    |     /app/vendor/bundle/ruby/3.0.0/gems/puma-6.4.2/lib/puma/cluster.rb:74:in `spawn_workers'
zealot-1    |     /app/vendor/bundle/ruby/3.0.0/gems/puma-6.4.2/lib/puma/cluster.rb:430:in `run'
zealot-1    |     /app/vendor/bundle/ruby/3.0.0/gems/puma-6.4.2/lib/puma/launcher.rb:194:in `run'
zealot-1    |     /app/vendor/bundle/ruby/3.0.0/gems/puma-6.4.2/lib/puma/cli.rb:75:in `run'
zealot-1    |     /app/vendor/bundle/ruby/3.0.0/gems/puma-6.4.2/bin/puma:10:in `<top (required)>'
zealot-1    |     ./bin/puma:29:in `load'
zealot-1    |     ./bin/puma:29:in `<main>'
zealot-1    | [363] Early termination of worker

我尝试将 docker-compose.yml 的 image 改为最新的 ghcr.io/tryzealot/zealot:nightly-2024-03-07 依然出现该问题。
同时我注意到《自建服务指南》中提两项配置,当前 master 中的 docker-compose.yml 都没有:

  1. service 缺少 zealot-worker
  2. volume 缺少 zealot-data

如果是 docker-compose.yml 配置问题,我在哪可以找到可参考的配置?

@icyleaf
Copy link
Member

icyleaf commented Mar 7, 2024

详细步骤的文档年久失修有些过时了,service zealot-worker 合并到主服务里面了,volume zealot-data 拆分成了 zealot-uploadszealot-backup

完整的范例大概是这样的:

version: "3.8"

x-restart-policy: &restart_policy
  restart: unless-stopped

x-defaults: &defaults
  <<: *restart_policy
  image: ghcr.io/tryzealot/zealot:nightly
  depends_on:
    - redis
    - postgres
  env_file: .env
  volumes:
    - zealot-uploads:/app/public/uploads
    - zealot-backup:/app/public/backup
    - ./log:/app/log                        # 持久化日志文件,可选
  healthcheck:
    test: ["CMD-SHELL", "wget -q --spider --proxy=off localhost/health || exit 1"]

services:
  redis:
    <<: *restart_policy
    image: redis:7-alpine
    command: redis-server
    volumes:
      - zealot-redis:/data
    healthcheck:
      test: ["CMD", "redis-cli", "ping"]
  postgres:
    <<: *restart_policy
    image: postgres:14-alpine
    volumes:
      - zealot-postgres:/var/lib/postgresql/data
    environment:
      POSTGRES_PASSWORD: ze@l0t
    healthcheck:
      test: ["CMD", "pg_isready", "-U", "postgres"]
  zealot:
    <<: *defaults
    # 无需反代可开启端口映射,与下面 web 反代服务互斥
    ports:
      - "80:80"
  # 可选:使用反代托管 SSL 证书和服务
  web:
    image: caddy:2-alpine
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ./caddy/etc/caddy/Caddyfile:/etc/caddy/Caddyfile:ro
      - ./caddy/etc/caddy/certs:/etc/caddy/certs:ro
    env_file: .env
    environment:
      ACME_AGREE: "true"


# 持久化有三种方式:
volumes:
  # 1. docker compose 内部自动生成 volumes
  - zealot-uploads
  - zealot-backup
  - zealot-redis
  - zealot-postgres

  # 2. docker compose 外部创建的 volumes
  zealot-uploads:
    external: true
  zealot-backup:
    external: true
  zealot-redis:
    external: true
  zealot-postgres:
    external: true


  # 3. 挂载自定义本地路径
  zealot-uploads:
    driver: local
    driver_opts:
      o: bind
      type: none
      device: /tmp/zealot/uploads
  zealot-backup:
    driver: local
    driver_opts:
      o: bind
      type: none
      device: /tmp/zealot/backup
  zealot-redis:
    driver: local
    driver_opts:
      o: bind
      type: none
      device: /tmp/redis
  zealot-postgres:
    driver: local
    driver_opts:
      o: bind
      type: none
      device: /tmp/postgres

@icyleaf
Copy link
Member

icyleaf commented Mar 7, 2024

感谢反馈,最新修正的文档已经更新

@InjoyDeng
Copy link
Author

InjoyDeng commented Mar 8, 2024

service zealot-worker 合并到主服务里面了,volume zealot-data 拆分成了 zealot-uploads 和 zealot-backup

那这样的话,我认为可能不是 docker-compose.yml 的问题。我根据你提供的模版重新配置了一份 docker-compose.yml 后并启动服务,依然会出现上面的报错日志。

did not find expected comment or line break while scanning a block scalar at line 14 column 20

我猜测或许是 zealot 中某个 yml 格式有问题,但排查 puma 启动链路的代码,目前没有排查出有异常的 yml 配置。我初次接触 ruby on rails,所以可能排查过程中遗漏了某些东西。

现在对于上面的报错日志,我没有明确的排查思路。我想问问,这份配置在你电脑上可以正常工作吗?

version: "3.8"

x-restart-policy: &restart_policy
  restart: unless-stopped

x-defaults: &defaults
  <<: *restart_policy
  image: ghcr.io/tryzealot/zealot:nightly
  depends_on:
    - redis
    - postgres
  env_file: .env
  volumes:
    - zealot-uploads:/app/public/uploads
    - zealot-backup:/app/public/backup
    - ./log:/app/log
  healthcheck:
    test: ["CMD-SHELL", "wget -q --spider --proxy=off localhost/health || exit 1"]

services:
  redis:
    <<: *restart_policy
    image: redis:7-alpine
    command: redis-server
    volumes:
      - zealot-redis:/data
    healthcheck:
      test: ["CMD", "redis-cli", "ping"]
  postgres:
    <<: *restart_policy
    image: postgres:14-alpine
    volumes:
      - zealot-postgres:/var/lib/postgresql/data
    environment:
      POSTGRES_PASSWORD: ze@l0t
    healthcheck:
      test: ["CMD", "pg_isready", "-U", "postgres"]
  zealot:
    <<: *defaults
    # image: zealot:latest
    # pull_policy: never
    ports:
      - "80:80"
  # web:
  #   image: caddy:2-alpine
  #   ports:
  #     - "80:80"
  #     - "443:443"
  #   volumes:
  #     - ./caddy/etc/caddy/Caddyfile:/etc/caddy/Caddyfile:ro
  #     - ./caddy/etc/caddy/certs:/etc/caddy/certs:ro
  #   env_file: .env
  #   environment:
  #     ACME_AGREE: "true"

volumes:
  zealot-uploads:
    external: true
  zealot-backup:
    external: true
  zealot-redis:
    external: true
  zealot-postgres:
    external: true

@InjoyDeng
Copy link
Author

我应该找到了问题所在,是 config/secrets.yml 中 ERB 标签 <%= %> 插入环境变量时出现问题,同时排查了 .env 中 SECRET_TOKEN 配置没有问题。

目前我通过将 secrets.yml 中配置设置默认值的方式规避该报错。

@icyleaf
Copy link
Member

icyleaf commented Mar 8, 2024

噢,应该是生成的 secret 字符串有 yaml 无法解析的特殊字符。

icyleaf added a commit to tryzealot/zealot that referenced this issue Mar 8, 2024
@InjoyDeng
Copy link
Author

generate-secret-key.sh 的 tr 命令参数改为 tr -dc "a-z0-9" 后解决了该问题。

icyleaf added a commit to tryzealot/zealot that referenced this issue Jun 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants