I am pretty new in padrino so I have been struggling with this for a while and it is really blocking me.
What I am trying to do is, to dokerize my padrino project in order to make it available to my front end co-workers so they don't need to spend to much time setting their machines up.
The problem comes when I try to run the docker-compose run web bundle exec rake sq:create
task which raises the the following exception:
=> Creating database 'my_database_dev'
rake aborted!
Errno::ENOENT: No such file or directory - createdb
/usr/local/bundle/gems/padrino-gen-0.13.2/lib/padrino-gen/padrino-tasks/sql-helpers.rb:18:in `spawn'
/usr/local/bundle/gems/padrino-gen-0.13.2/lib/padrino-gen/padrino-tasks/sql-helpers.rb:18:in `create_db'
/usr/local/bundle/gems/padrino-gen-0.13.2/lib/padrino-gen/padrino-tasks/sequel.rb:52:in `block (2 levels) in <top (required)>'
/usr/local/bundle/gems/rake-11.3.0/exe/rake:27:in `<top (required)>'
/usr/local/bin/bundle:22:in `load'
/usr/local/bin/bundle:22:
That exception only happens on my docker machine, even using DATABASE_URL=postgres://pg_pass:pg_user@postgres.local:2345/my_database_dev
which correspond to the dockerized postgres image in my local .env file everything runs as expected, so that makes me think that the issue is that something is missing in Dockerfile.
My Dockerfile looks like this:
FROM ruby:2.2.5
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev
RUN mkdir /app
WORKDIR /app
ADD Gemfile /app/Gemfile
ADD Gemfile.lock /app/Gemfile.lock
RUN bundle install
ADD . /app
and my docker-compose file
version: '2'
services:
db:
image: postgres:latest
ports:
- "2345:5432"
environment:
- POSTGRES_PASSWORD=pg_pass
- POSTGRES_USER=pg_user
web:
build: .
command: bundle exec padrino s -p 3000 -h '0.0.0.0'
ports:
- "3000:3000"
volumes:
- .:/app
depends_on:
- db
links:
- db:db
environment:
- DATABASE_URL=postgres://pg_pass:pg_user@postgres.local:2345/my_database_dev
Thank you in advance!