Skip to content

Instantly share code, notes, and snippets.

@aquabu
Last active July 29, 2020 20:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aquabu/4ea82094294328aebb3e948b800af8b0 to your computer and use it in GitHub Desktop.
Save aquabu/4ea82094294328aebb3e948b800af8b0 to your computer and use it in GitHub Desktop.

Starting point repos

Forked repo with some modifications to the docker file https://github.com/CoMakery/loomio

Roughly followed instructions here https://github.com/loomio/loomio-deploy

git clone https://github.com/CoMakery/loomio
cd loomio

added a heroku.yml with this content

I did this on the fork of loomio here

build:
  docker:
    web: Dockerfile
run:
  web: ./docker_start.sh
git add heroku.yml 
git commit -m 'add heroku.yml'

create an instance on heroku and get the app name

heroku git:remote -a the-app-name
heroku stack:set container
git push heroku master

Had trouble authenticating to the container so, just went to the heroku web, selected console and ran:

rake db:schema:load

Got to the bash shell on the docker container by running:

heroku login
heroku run bash

Extensions

Attach a free versions of Heroku extensions for:

  • Heroku Redis
  • MailGun SMTP Mail Server
  • Postgres Server

These are the SMTP fields we need from the rails config file

https://github.com/CoMakery/loomio/blob/master/config/application.rb#L104

SSL

Had to switch to Heroku Hobby tier of $7/mo to get free SSL cert. Other SSL addons were > $20/mo. Configuring and maintaing lets encrypt or buying an SSL cert is too much admin

next up

  • Setup MailGun SMTP env variables
  • confirm ssl forwarding is working
  • create admin user
  • add more sys admins

Notes

You can't run rake db:setup because you can't create a new postgres db from the container

It was tricky to get to the heroku container because bin/bash was not installed in the image see: https://stackoverflow.com/questions/46652928/shell-into-a-docker-container-running-on-a-heroku-dyno-how/49489678

Supposedly I coul have added this to the Dockerfile to make heroku ps:exec work but running it from Heroku web didn't fix it:

RUN rm /bin/sh && ln -s /bin/bash /bin/sh

That said you can get to the bash shell on the docker container by running:

heroku login
heroku run bash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment