Loomio
Wed 27 Feb 2019 2:16PM

Installation on Docker - database "loomio_production" does not exist

SN Stuart North Public Seen by 112

Hi Everyone, I am trying to install Loomio following the instructions at https://github.com/loomio/loomio-deploy.
After a few false starts (completely new to Docker) I've managed to get this far;
Fresh install of Ubuntu 18.04
Install of Docker via Snap (including the instructions on setting new groups from here https://askubuntu.com/questions/907110/docker-snap-cannot-connect-to-the-docker-daemon-is-the-docker-daemon-running-o. I've also done the installation using a standard install of Docker https://docs.docker.com/install/linux/docker-ce/ubuntu/

Installed docker-compose & set permissions.
Cloned the github repo, tried various methods. Using 'sudo su' and just 'sudo', into /root/loomio-deploy and into /home/user/loomio-deploy

Skipped swap space (server has 16GB), and I get error using the script anyway;
dd: failed to open '/swapfile': Text file busy
mkswap: error: /swapfile is mounted; will not make swapspace
swapon: /swapfile: swapon failed: Device or resource busy

Set up env with no errors, configured SMTP
Initialised the database: 'docker-compose run app rake db:setup'. Some errors reported "PG::ConnectionBad: FATAL: database "loomio_production" does not exist"
Setup crontab no problems.
Started services: 'docker-compose up -d'.
When I try connect to the webservice on the host using localhost or using fqdn set up in /etc/hosts I get "500 Internal Server Error".
Obvious errors in docker-compose logs -d;
loomio-db | FATAL: database "loomio_production" does not exist
loomio-worker | rake aborted!
loomio-worker | ActiveRecord::NoDatabaseError: FATAL: database "loomio_production" does not exist

Any ideas what is causing the database to report missing?
Kind regards,
Stuart

N

Naomi Sat 6 Apr 2019 8:21PM

For completeness:

root@vultr:~/loomio-deploy# docker-compose run app db:create
Starting loomio-db ... done
Starting loomio-redis ... done
Error response from daemon: OCI runtime create failed: container_linux.go:348: starting container process caused "exec: \"db:create\": executable file not found in $PATH": unknown
N

Naomi Sun 7 Apr 2019 10:19AM

BTW this is a different server than the original one I tried it on. It's a fresh VPS with Ubuntu 18.10.

N

Naomi Tue 9 Apr 2019 2:57PM

A friend pointed out that instead of run app db:create it should be run app rake db:create. I tried that, and got the "database does not exist" message as usual...

N

Naomi Wed 10 Apr 2019 4:07PM

SUCCESS!! Another friend advised that by "su to postgres" you meant inside the docker thingy rather than in the OS, and that I should run:

docker exec -ti loomio-db su - postgres -c 'createdb loomio_production'

which I did and it worked, i.e. I did the rake db:setup after that and I could see it creating tables etc. On to the next obstacle now!

RG

Robert Guthrie Wed 10 Apr 2019 10:41PM

OH WOW!! GREAT WORK. I'll update the docs.

RG

Robert Guthrie Wed 10 Apr 2019 10:43PM

Sorry I wasn't able to offer more support during this time. I'm so pleased you've cracked it though. Well done.