Setting up a free background service on Heroku

See http://nofail.de/2011/07/heroku-cedar-background-jobs-for-free/


heroku apps:create janus-worker --stack cedar --remote worker
git push worker master
heroku scale web=0 worker=1 --app=janus-worker
heroku config:add `heroku config -s --app=face-dev | grep redis` --app=janus-worker

Useful commands


heroku logs --tail --app face-dev
eroku ps --app face-dev
heroku ps --app janus-worker

Rails App with Docker and Fig

This is the tutorial I followed:
https://robots.thoughtbot.com/rails-on-docker

Tried this tutorial which has a separate worker for sidekiq as well, but didn’t manage to get it working:
http://khanetor.com/2015/02/dockerize-a-rails-app-with-background-processing/

As I didn’t manage to get this running:
* http://dev.chaione.com/rapid-rails-setup-with-docker-and-fig/
* http://www.fig.sh/rails.html


fig build
fig run web RAILS_ENV=production rake db:create (Only once)
fig run web RAILS_ENV=production rake db:migrate
fig run web rake assets:precompile
fig up -d

fig build needs to be called every time the Dockerfile or Gemfile is changed.

The app should be reachable under something like
http://192.168.59.103:3000

You can get the IP address using ‘boot2docker ip’.

Get env variables
fig run web env

Wanna check out what is going on in your dockerized app?
fig run web rails c

Run all commands as root on Ubuntu.

sudo fig run web rails c

Logilfes kann man direkt lesen

tailf log/development.log

These are the used images
* https://registry.hub.docker.com/_/rails/
* https://registry.hub.docker.com/_/postgres/

Upgrade Postgres 9.3 to 9.4 on Heroku

Follow this instructions:
https://devcenter.heroku.com/articles/upgrading-heroku-postgres-databases

Here is what I did

heroku addons:add heroku-postgresql:hobby-dev --version=9.4
heroku pg:info
heroku maintenance:on
heroku pg:promote HEROKU_POSTGRESQL_CHARCOAL_URL (Change CHARCOAL accordingly)
heroku pg:promote HEROKU_POSTGRESQL_CHARCOAL_URL (Again adapt CHARCOAL)
heroku maintenance:off

Rails Minitest with Capybara

References

Gemfile
group :test do
  gem 'minitest-rails-capybara'
  gem 'minitest-reporters'
  gem 'mocha'
  gem 'guard'
  gem 'guard-minitest'
  gem 'terminal-notifier'
  gem 'terminal-notifier-guard', '~> 1.6.1'
end

An example for a feature test

require "test_helper"

feature "Customer List" do
  scenario "shows a list of customers" do
    visit customers_path
    page.has_css?('ul.customers')
  end
end