Open Mgldvd opened 8 years ago
Thanks for the report.
I have added a sleep counter between those two commands. This seems to fix the bug !
Thanks !
Not for me, sorry :) I try with 10 and 20 and nothing. Here full report
Step 18 : RUN /etc/init.d/postgresql start && sleep 20 && bin/rake db:schema:load RAILS_ENV=production
---> Running in b5d7b5996cb3
Starting PostgreSQL 9.4 database server: main.
rake aborted!
PG::ConnectionBad: FATAL: the database system is starting up
FATAL: the database system is starting up
/opt/brimir/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/postgresql_adapter.rb:651:in `initialize'
/opt/brimir/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/postgresql_adapter.rb:651:in `new'
/opt/brimir/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/postgresql_adapter.rb:651:in `connect'
/opt/brimir/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/postgresql_adapter.rb:242:in `initialize'
/opt/brimir/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/postgresql_adapter.rb:44:in `new'
/opt/brimir/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/postgresql_adapter.rb:44:in `postgresql_connection'
/opt/brimir/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:438:in `new_connection'
/opt/brimir/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:448:in `checkout_new_connection'
/opt/brimir/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:422:in `acquire_connection'
/opt/brimir/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:349:in `block in checkout'
/opt/brimir/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:348:in `checkout'
/opt/brimir/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:263:in `block in connection'
/opt/brimir/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:262:in `connection'
/opt/brimir/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:571:in `retrieve_connection'
/opt/brimir/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_handling.rb:113:in `retrieve_connection'
/opt/brimir/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_handling.rb:87:in `connection'
/opt/brimir/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:648:in `connection'
/opt/brimir/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:664:in `block in method_missing'
/opt/brimir/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:634:in `block in say_with_time'
/opt/brimir/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:634:in `say_with_time'
/opt/brimir/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:654:in `method_missing'
/opt/brimir/db/schema.rb:16:in `block in <top (required)>'
/opt/brimir/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.5/lib/active_record/schema.rb:41:in `instance_eval'
/opt/brimir/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.5/lib/active_record/schema.rb:41:in `define'
/opt/brimir/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.5/lib/active_record/schema.rb:61:in `define'
/opt/brimir/db/schema.rb:14:in `<top (required)>'
/opt/brimir/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:268:in `load'
/opt/brimir/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:268:in `block in load'
/opt/brimir/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:240:in `load_dependency'
/opt/brimir/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:268:in `load'
/opt/brimir/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.5/lib/active_record/tasks/database_tasks.rb:218:in `load_schema_for'
/opt/brimir/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.5/lib/active_record/tasks/database_tasks.rb:235:in `block in load_schema_current'
/opt/brimir/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.5/lib/active_record/tasks/database_tasks.rb:275:in `block in each_current_configuration'
/opt/brimir/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.5/lib/active_record/tasks/database_tasks.rb:274:in `each'
/opt/brimir/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.5/lib/active_record/tasks/database_tasks.rb:274:in `each_current_configuration'
/opt/brimir/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.5/lib/active_record/tasks/database_tasks.rb:234:in `load_schema_current'
/opt/brimir/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.5/lib/active_record/railties/databases.rake:247:in `block (3 levels) in <top (required)>'
Tasks: TOP => db:schema:load
(See full trace by running task with --trace)
-- create_table("attachments", {:force=>:cascade})
The command '/bin/sh -c /etc/init.d/postgresql start && sleep 20 && bin/rake db:schema:load RAILS_ENV=production' returned a non-zero code: 1
I will be trying to reproduce this issue ! Thanks
I couldn't reproduce this issue... Seems to me that the init script, that normally waits for postgresql to finish starting, times out after 60s and then goes on to rake.
I had the same problem, putting "sleep 20" solved.
RUN /etc/init.d/postgresql start && sleep 20 && bin/rake db:schema:load RAILS_ENV=production
and
RUN /etc/init.d/postgresql start && sleep 20 && bin/rails console production < loadUser.rb
Hi,
Glad this solved your problem. I however don't know why this doesn't work for @Mayccoll ...
A solution would be to have a dedicated Postgres container and expose it to the Brimir container, but that would require some tweaking.
Thanks,
An other issue related with postgresql start. When my container is UP, I've had errors 500.
1 - Then I enable passenger frinedly-error-pages (last line at Dockerfile)
"CMD passenger start -a 0.0.0.0 -p 3000 -e production --friendly-error-pages"
And see a fail to connect to database.
2 - Just access the container shell.
sudo docker exec -i -t "container-name" /bin/bash
root@"container-id":/opt/brimir# /etc/init.d/postgresql restart [ ok ] Restarting PostgreSQL 9.4 database server: main. root@"container-id":/opt/brimir# exit
I've solved...
"CMD /etc/init.d/postgresql restart && passenger start -a 0.0.0.0 -p 3000 -e production"
Hi,
Great. Would you mind writing a pull request ?
It does seem weird to me that postgresql always has to be restarted but well...
Hi, I got an error.