Я пытаюсь заставить его работать на контейнерах проекта в EC2 AWS, и я работаю безуспешно.
проект RoR зависит от sidekiq, postgres и redis, поэтому я создал «рабочий образ» с помощью docker для rails (веб-сервис) и sidekiq (сервис sidekiq), и в настоящее время я пытаюсь заставить его работать с docker-compose для производства
Скажу сразу, все на моей локальной машине работает нормально. Разработка и «производственные» изображения работают, как и ожидалось, проблема возникает при составлении «производственных» изображений (web и sidekiq) на машине ECS AWS.
Я получаю эту ошибку:
production_sidekiq | No such file or directory @ rb_sysopen - /my_app/tmp/pids/sidekiq.pid
production_sidekiq | /usr/local/bundle/gems/sidekiq-4.2.10/lib/sidekiq/cli.rb:370:in `initialize'
production_sidekiq | /usr/local/bundle/gems/sidekiq-4.2.10/lib/sidekiq/cli.rb:370:in `open'
production_sidekiq | /usr/local/bundle/gems/sidekiq-4.2.10/lib/sidekiq/cli.rb:370:in `write_pid'
production_sidekiq | /usr/local/bundle/gems/sidekiq-4.2.10/lib/sidekiq/cli.rb:43:in `parse'
production_sidekiq | /usr/local/bundle/gems/sidekiq-4.2.10/bin/sidekiq:11:in `<top (required)>'
production_sidekiq | /usr/local/bundle/bin/sidekiq:23:in `load'
production_sidekiq | /usr/local/bundle/bin/sidekiq:23:in `<top (required)>'
production_sidekiq | /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.16.6/lib/bundler/cli/exec.rb:74:in `load'
production_sidekiq | /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.16.6/lib/bundler/cli/exec.rb:74:in `kernel_load'
production_sidekiq | /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.16.6/lib/bundler/cli/exec.rb:28:in `run'
production_sidekiq | /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.16.6/lib/bundler/cli.rb:424:in `exec'
production_sidekiq | /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.16.6/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
production_sidekiq | /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.16.6/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
production_sidekiq | /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.16.6/lib/bundler/vendor/thor/lib/thor.rb:387:in `dispatch'
production_sidekiq | /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.16.6/lib/bundler/cli.rb:27:in `dispatch'
production_sidekiq | /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.16.6/lib/bundler/vendor/thor/lib/thor/base.rb:466:in `start'
production_sidekiq | /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.16.6/lib/bundler/cli.rb:18:in `start'
production_sidekiq | /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.16.6/exe/bundle:30:in `block in <top (required)>'
production_sidekiq | /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.16.6/lib/bundler/friendly_errors.rb:124:in `with_friendly_errors'
production_sidekiq | /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.16.6/exe/bundle:22:in `<top (required)>'
production_sidekiq | /usr/local/bin/bundle:23:in `load'
production_sidekiq | /usr/local/bin/bundle:23:in `<main>'
В моем docker-compose.yml для производства на EC2 у меня есть это:
version: '3'
services:
postgres:
image: postgres:10.5
environment:
POSTGRES_DB: my_app_production
env_file:
- ~/production.env
redis:
image: redis:4.0.11
web:
container_name: prod_web
image: prod_my_app:latest
command: bundle exec rails server -p 3000 -b '0.0.0.0' -e production
ports:
- '80:3000'
depends_on:
- postgres
- redis
environment:
RAILS_ENV: production
RACK_ENV: production
RAILS_LOG_TO_STDOUT: 'true'
RAILS_SERVE_STATIC_FILES: 'true'
EXECJS_RUNTIME: Disabled
SECRET_KEY_BASE: token
DEVISE_SECRET_KEY: token
env_file:
- ~/production.env
restart: always
sidekiq:
container_name: production_sidekiq
image: prod_my_app_sidekiq:latest
command: bundle exec sidekiq -C config/sidekiq.yml
depends_on:
- postgres
- redis
environment:
RAILS_ENV: production
RACK_ENV: production
RAILS_LOG_TO_STDOUT: 'true'
RAILS_SERVE_STATIC_FILES: 'true'
EXECJS_RUNTIME: Disabled
SECRET_KEY_BASE: token
DEVISE_SECRET_KEY: token
env_file:
- ~/production.env
restart: always`
А в config / sidekiq.yml
:verbose: true
:concurrency: 1
:pidfile: ./tmp/pids/sidekiq.pid
staging:
:concurrency: 10
production:
:concurrency: 20
:queues:
- default
- mailers
Я застрял, я думал, что это проблема томов, так как у меня есть другой файл для «тестовых образов локального производства» и связанных томов: -.: / My_app внутри sidekiq и веб-сервисов, поэтому в процессе работы я удалил эти строки как упоминание Docker Compose в Production , но я получаю ошибку production_sidekiq | No such file or directory @ rb_sysopen - /my_app/tmp/pids/sidekiq.pid
Сервер Puma на веб-сервисе работает нормально.
Есть идеи, что происходит?