title: Heroku: Dockerized Rails API Deploying
body: <p>I have this Rails 4 API which is using Postgresql, Sidekiq (and therefore Redis) and Puma server.</p>
  
  <p>I need to deploy it to Heroku and I deployed it successfully following the oficcial <a href="https://devcenter.heroku.com/articles/container-registry-and-runtime" rel="nofollow noreferrer">doc</a>. However first I don't know why it was telling me that there was no web process running. </p>
  
  <pre><code>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=
  </code></pre>
  
  <p>So I had to turn ON dyno manually. </p>
  
  <p>And since that heroku logs just keep telling me that App crashed</p>
  
  <pre><code>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=
  </code></pre>
  
  <p>What I did before due to other tutorials is:</p>
  
  <p>Set up <code>config/puma.rb</code> file</p>
  
  <pre><code>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
  </code></pre>
  
  <p>Set up <code>Procfile</code></p>
  
  <pre><code>web: bundle exec puma -C config/puma.rb
  </code></pre>
  
  <p>Set up <code>app.json</code></p>
  
  <pre><code>{
    "name": "Cool name",
    "description": "Really meaningful description",
    "image": "heroku/ruby",
    "addons": [
      "heroku-postgresql"
    ]
  }
  </code></pre>
  
  <p>My <code>docker-compose.yml</code></p>
  
  <pre><code>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
  </code></pre>
  
  <p><code>.env</code> file</p>
  
  <pre><code>REDIS_HOST=redis://redis:6379/0
  </code></pre>
  
  <p>So could anyone tell me what is wronf with my setup for it deployed successfuly to Heroku but can't run there anyway?</p>