Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to deploy locally following the development guide #9

Open
giovannigarifo opened this issue May 11, 2020 · 4 comments
Open

Unable to deploy locally following the development guide #9

giovannigarifo opened this issue May 11, 2020 · 4 comments

Comments

@giovannigarifo
Copy link

I've tried to deploy the application using the development instructions for docker in the README.md, however, I was not able to successfully run it. It seems like the application is unable to connect to the database.

Environment

  • Ubuntu 20.04 LTS
  • Linux kernel 5.6.11
  • Docker version 19.03.8
  • docker-compose version 1.25.0

Steps to reproduce

  • git clone https://github.com/berkmancenter/threads.git && cd threads
  • cp .env.example .env
  • cp config/database.yml.sample config/database.yml, this was not listed in the deployment guide, but without it the containers won't run
  • cp config/cable.yml.sample config/cable.yml, this was not listed in the deployment guide, but without it the containers won't run
  • docker-compose up
  • docker-compose exec website sh
  • bundle exec rake db:create this last command gives the following error:
/app # bundle exec rake db:create
DEPRECATION WARNING: The factory_girl gem is deprecated. Please upgrade to factory_bot. See https://github.com/thoughtbot/factory_bot/blob/v4.9.0/UPGRADE_FROM_FACTORY_GIRL.md for further instructions. (called from require at /usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.15.4/lib/bundler/runtime.rb:82)
could not connect to server: No such file or directory
	Is the server running locally and accepting
	connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
Couldn't create 'threads_development' database. Please check your configuration.
rake aborted!
PG::ConnectionBad: could not connect to server: No such file or directory
	Is the server running locally and accepting
	connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
/usr/local/bundle/gems/pg-0.21.0/lib/pg.rb:56:in `initialize'
/usr/local/bundle/gems/pg-0.21.0/lib/pg.rb:56:in `new'
/usr/local/bundle/gems/pg-0.21.0/lib/pg.rb:56:in `connect'
/usr/local/bundle/gems/activerecord-5.2.2.1/lib/active_record/connection_adapters/postgresql_adapter.rb:692:in `connect'
/usr/local/bundle/gems/activerecord-5.2.2.1/lib/active_record/connection_adapters/postgresql_adapter.rb:223:in `initialize'
/usr/local/bundle/gems/activerecord-5.2.2.1/lib/active_record/connection_adapters/postgresql_adapter.rb:48:in `new'
/usr/local/bundle/gems/activerecord-5.2.2.1/lib/active_record/connection_adapters/postgresql_adapter.rb:48:in `postgresql_connection'
/usr/local/bundle/gems/activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:811:in `new_connection'
/usr/local/bundle/gems/activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:855:in `checkout_new_connection'
/usr/local/bundle/gems/activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:834:in `try_to_checkout_new_connection'
/usr/local/bundle/gems/activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:795:in `acquire_connection'
/usr/local/bundle/gems/activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:523:in `checkout'
/usr/local/bundle/gems/activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:382:in `connection'
/usr/local/bundle/gems/activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:1010:in `retrieve_connection'
/usr/local/bundle/gems/activerecord-5.2.2.1/lib/active_record/connection_handling.rb:118:in `retrieve_connection'
/usr/local/bundle/gems/activerecord-5.2.2.1/lib/active_record/connection_handling.rb:90:in `connection'
/usr/local/bundle/gems/activerecord-5.2.2.1/lib/active_record/tasks/postgresql_database_tasks.rb:12:in `connection'
/usr/local/bundle/gems/activerecord-5.2.2.1/lib/active_record/tasks/postgresql_database_tasks.rb:21:in `create'
/usr/local/bundle/gems/activerecord-5.2.2.1/lib/active_record/tasks/database_tasks.rb:119:in `create'
/usr/local/bundle/gems/activerecord-5.2.2.1/lib/active_record/tasks/database_tasks.rb:139:in `block in create_current'
/usr/local/bundle/gems/activerecord-5.2.2.1/lib/active_record/tasks/database_tasks.rb:316:in `block in each_current_configuration'
/usr/local/bundle/gems/activerecord-5.2.2.1/lib/active_record/tasks/database_tasks.rb:313:in `each'
/usr/local/bundle/gems/activerecord-5.2.2.1/lib/active_record/tasks/database_tasks.rb:313:in `each_current_configuration'
/usr/local/bundle/gems/activerecord-5.2.2.1/lib/active_record/tasks/database_tasks.rb:138:in `create_current'
/usr/local/bundle/gems/activerecord-5.2.2.1/lib/active_record/railties/databases.rake:29:in `block (2 levels) in <top (required)>'
/usr/local/bundle/gems/rake-12.3.3/exe/rake:27:in `<top (required)>'
/usr/local/bin/bundle:23:in `load'
/usr/local/bin/bundle:23:in `<main>'
Tasks: TOP => db:create
(See full trace by running task with --trace)
@peter-hank
Copy link
Contributor

Hey,

try to use this

development: &default
  adapter: postgresql
  encoding: utf8
  host: postgres
  database: postgres
  pool: 5
  username: postgres
  password: postgres

in the db config.

You may be interested in this fork https://github.com/peter-hank/webuddy. Is has more stuff included and runs on Rails 6.

@giovannigarifo
Copy link
Author

Thank you, I confirm that editing the config/database.yml file with the above mentioned configuration the application starts without issues.

However, I'm not able to get the verification mail for a new account, is it normal for a local deploy?

@peter-hank
Copy link
Contributor

@giovannigarifo

Do you have a local smtp server running? See here https://github.com/berkmancenter/threads/blob/master/config/environments/development.rb#L59.

If you don't try https://mailcatcher.me/.

@giovannigarifo
Copy link
Author

I tried again to install threads following the steps above, but this time, when I try to create a user, I've got the following error:

ActionController::InvalidAuthenticityToken in Users::RegistrationsController#create

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants