Reputation: 2401
I have this Rails 4 API which is using Postgresql, Sidekiq (and therefore Redis) and Puma server.
I need to deploy it to Heroku and I deployed it successfully following the oficcial doc. However first I don't know why it was telling me that there was no web process running.
2010-10-06T21:51:37-07:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=myapp.herokuapp.com fwd=17.17.17.17 dyno= connect= service= status=503 bytes=
So I had to turn ON dyno manually.
And since that heroku logs just keep telling me that App crashed
2010-10-06T21:51:12-07:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=myapp.herokuapp.com fwd=17.17.17.17 dyno= connect= service= status=503 bytes=
What I did before due to other tutorials is:
Set up config/puma.rb
file
workers Integer(ENV['WEB_CONCURRENCY'] || 2)
threads_count = Integer(ENV['RAILS_MAX_THREADS'] || 5)
threads threads_count, threads_count
preload_app!
rackup DefaultRackup
port ENV['PORT'] || 3000
environment ENV['RACK_ENV'] || 'development'
on_worker_boot do
# Worker specific setup for Rails 4.1+
# See: https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server#on-worker-boot
ActiveRecord::Base.establish_connection
end
Set up Procfile
web: bundle exec puma -C config/puma.rb
Set up app.json
{
"name": "Cool name",
"description": "Really meaningful description",
"image": "heroku/ruby",
"addons": [
"heroku-postgresql"
]
}
My docker-compose.yml
web:
build: .
command: puma
ports:
- "9292:9292"
links:
- db
- redis
volumes:
- .:/app_name
stdin_open: true
tty: true
sidekiq:
build: .
volumes:
- .:/app_name
command: bundle exec sidekiq
links:
- db
- redis
env_file:
- .env
db:
image: postgres
redis:
image: redis
.env
file
REDIS_HOST=redis://redis:6379/0
So could anyone tell me what is wronf with my setup for it deployed successfuly to Heroku but can't run there anyway?
Upvotes: 0
Views: 765
Reputation: 33
Currently Heroku's container-based approach does not match cleanly with the Docker Compose workflow.
What does your Dockerfile look like? When deploying using Docker, the Procfile is not used at all, so you have to have add the start command using CMD
in your Dockerfile.
CMD bundle exec puma -C config/puma.rb
This also means that for running Sidekiq, you need to build a separate Docker image with a different CMD
. You need a second Dockerfile in another (sub-)directory in order to accomplish that with Heroku's CLI.
Upvotes: 1