Beginners Guide to Install Discourse on Ubuntu for Development

dev-install

#187

New error when trying to use bundler.

$ bundle exec rake db:migrate db:test:prepare db:seed_fu
rake aborted!
ActiveRecord::NoDatabaseError: FATAL:  role "root" does not exist

I am guessing the username should be there instead of root?


(Jay Pfaffman) #188

Did you create the database?


#189

Yep, sure did.

$ psql -l

                                        List of databases
         Name          |   Owner   | Encoding |   Collate   |    Ctype    |   Access privileges
-----------------------+-----------+----------+-------------+-------------+-----------------------
 discourse_development | purldator | UTF8     | en_US.UTF-8 | en_US.UTF-8 |
 discourse_test        | purldator | UTF8     | en_US.UTF-8 | en_US.UTF-8 |
 postgres              | postgres  | UTF8     | en_US.UTF-8 | en_US.UTF-8 |
 template0             | postgres  | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres          +
                       |           |          |             |             | postgres=CTc/postgres
 template1             | postgres  | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres          +
                       |           |          |             |             | postgres=CTc/postgres
(5 rows)

EDIT: This may be my situation here but I have no idea how to go about fixing it; google brings up nothing in particular. I suspect my root user is postgres.

EDIT2: Here’s the entire dump of text I got below the error.

$ sudo bundle exec rake db:migrate db:test:prepare db:seed_fu
[sudo] password for purldator:
rake aborted!
ActiveRecord::NoDatabaseError: FATAL:  role "root" does not exist
/var/lib/gems/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/postgresql_adapter.rb:699:in `rescue in connect'
/var/lib/gems/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/postgresql_adapter.rb:695:in `connect'
/var/lib/gems/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/postgresql_adapter.rb:220:in `initialize'
/var/lib/gems/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/postgresql_adapter.rb:38:in `new'
/var/lib/gems/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/postgresql_adapter.rb:38:in `postgresql_connection'
/var/lib/gems/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:759:in `new_connection'
/var/lib/gems/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:803:in `checkout_new_connection'
/var/lib/gems/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:782:in `try_to_checkout_new_connection'
/var/lib/gems/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:743:in `acquire_connection'
/var/lib/gems/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:500:in `checkout'
/var/lib/gems/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:374:in `connection'
/var/lib/gems/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:931:in `retrieve_connection'
/var/lib/gems/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_handling.rb:116:in `retrieve_connection'
/var/lib/gems/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_handling.rb:88:in `connection'
/home/purldator/discourse/lib/site_settings/db_provider.rb:62:in `table_exists?'
/home/purldator/discourse/lib/site_settings/db_provider.rb:21:in `find'
/home/purldator/discourse/lib/site_settings/defaults_provider.rb:109:in `block in refresh_site_locale!'
/var/lib/gems/2.3.0/gems/rails_multisite-1.1.0.rc4/lib/rails_multisite/connection_management.rb:126:in `block in each_connection'
/var/lib/gems/2.3.0/gems/rails_multisite-1.1.0.rc4/lib/rails_multisite/connection_management.rb:124:in `each'
/var/lib/gems/2.3.0/gems/rails_multisite-1.1.0.rc4/lib/rails_multisite/connection_management.rb:124:in `each_connection'
/home/purldator/discourse/lib/site_settings/defaults_provider.rb:103:in `refresh_site_locale!'
/home/purldator/discourse/lib/site_settings/defaults_provider.rb:20:in `initialize'
/home/purldator/discourse/lib/site_setting_extension.rb:35:in `new'
/home/purldator/discourse/lib/site_setting_extension.rb:35:in `defaults'
/home/purldator/discourse/lib/site_setting_extension.rb:72:in `block in setting'
/home/purldator/discourse/lib/site_setting_extension.rb:71:in `synchronize'
/home/purldator/discourse/lib/site_setting_extension.rb:71:in `setting'
/home/purldator/discourse/app/models/site_setting.rb:17:in `block in load_settings'
/home/purldator/discourse/lib/site_settings/yaml_loader.rb:25:in `block (2 levels) in load'
/home/purldator/discourse/lib/site_settings/yaml_loader.rb:11:in `each'
/home/purldator/discourse/lib/site_settings/yaml_loader.rb:11:in `block in load'
/home/purldator/discourse/lib/site_settings/yaml_loader.rb:10:in `each_key'
/home/purldator/discourse/lib/site_settings/yaml_loader.rb:10:in `load'
/home/purldator/discourse/app/models/site_setting.rb:16:in `load_settings'
/home/purldator/discourse/app/models/site_setting.rb:21:in `<class:SiteSetting>'
/home/purldator/discourse/app/models/site_setting.rb:4:in `<main>'
/var/lib/gems/2.3.0/gems/bootsnap-1.0.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:63:in `load'
/var/lib/gems/2.3.0/gems/bootsnap-1.0.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:63:in `load'
/var/lib/gems/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:476:in `block in load_file'
/var/lib/gems/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:661:in `new_constants_in'
/var/lib/gems/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:475:in `load_file'
/var/lib/gems/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:374:in `block in require_or_load'
/var/lib/gems/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:36:in `block in load_interlock'
/var/lib/gems/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies/interlock.rb:12:in `block in loading'
/var/lib/gems/2.3.0/gems/activesupport-5.1.4/lib/active_support/concurrency/share_lock.rb:149:in `exclusive'
/var/lib/gems/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies/interlock.rb:11:in `loading'
/var/lib/gems/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:36:in `load_interlock'
/var/lib/gems/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:357:in `require_or_load'
/var/lib/gems/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:510:in `load_missing_constant'
/var/lib/gems/2.3.0/gems/bootsnap-1.0.0/lib/bootsnap/load_path_cache/core_ext/active_support.rb:53:in `block in load_missing_constant'
/var/lib/gems/2.3.0/gems/bootsnap-1.0.0/lib/bootsnap/load_path_cache/core_ext/active_support.rb:6:in `with_bootsnap_fallback'
/var/lib/gems/2.3.0/gems/bootsnap-1.0.0/lib/bootsnap/load_path_cache/core_ext/active_support.rb:53:in `load_missing_constant'
/var/lib/gems/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:202:in `const_missing'
/home/purldator/discourse/config/initializers/004-message_bus.rb:84:in `<main>'
/var/lib/gems/2.3.0/gems/bootsnap-1.0.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `load'
/var/lib/gems/2.3.0/gems/bootsnap-1.0.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `load'
/var/lib/gems/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:286:in `block in load'
/var/lib/gems/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:258:in `load_dependency'
/var/lib/gems/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:286:in `load'
/var/lib/gems/2.3.0/gems/railties-5.1.4/lib/rails/engine.rb:655:in `block in load_config_initializer'
/var/lib/gems/2.3.0/gems/activesupport-5.1.4/lib/active_support/notifications.rb:168:in `instrument'
/var/lib/gems/2.3.0/gems/railties-5.1.4/lib/rails/engine.rb:654:in `load_config_initializer'
/var/lib/gems/2.3.0/gems/railties-5.1.4/lib/rails/engine.rb:612:in `block (2 levels) in <class:Engine>'
/var/lib/gems/2.3.0/gems/railties-5.1.4/lib/rails/engine.rb:611:in `each'
/var/lib/gems/2.3.0/gems/railties-5.1.4/lib/rails/engine.rb:611:in `block in <class:Engine>'
/var/lib/gems/2.3.0/gems/railties-5.1.4/lib/rails/initializable.rb:30:in `instance_exec'
/var/lib/gems/2.3.0/gems/railties-5.1.4/lib/rails/initializable.rb:30:in `run'
/var/lib/gems/2.3.0/gems/railties-5.1.4/lib/rails/initializable.rb:59:in `block in run_initializers'
/var/lib/gems/2.3.0/gems/railties-5.1.4/lib/rails/initializable.rb:48:in `each'
/var/lib/gems/2.3.0/gems/railties-5.1.4/lib/rails/initializable.rb:48:in `tsort_each_child'
/var/lib/gems/2.3.0/gems/railties-5.1.4/lib/rails/initializable.rb:58:in `run_initializers'
/var/lib/gems/2.3.0/gems/railties-5.1.4/lib/rails/application.rb:353:in `initialize!'
/var/lib/gems/2.3.0/gems/railties-5.1.4/lib/rails/railtie.rb:185:in `public_send'
/var/lib/gems/2.3.0/gems/railties-5.1.4/lib/rails/railtie.rb:185:in `method_missing'
/home/purldator/discourse/config/environment.rb:5:in `<main>'
/var/lib/gems/2.3.0/gems/bootsnap-1.0.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:17:in `require'
/var/lib/gems/2.3.0/gems/bootsnap-1.0.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:17:in `require'
/var/lib/gems/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `block in require'
/var/lib/gems/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:258:in `load_dependency'
/var/lib/gems/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require'
/var/lib/gems/2.3.0/gems/railties-5.1.4/lib/rails/application.rb:329:in `require_environment!'
/var/lib/gems/2.3.0/gems/railties-5.1.4/lib/rails/application.rb:445:in `block in run_tasks_blocks'
/var/lib/gems/2.3.0/gems/rake-12.1.0/exe/rake:27:in `<top (required)>'
PG::ConnectionBad: FATAL:  role "root" does not exist
/var/lib/gems/2.3.0/gems/pg-0.20.0/lib/pg.rb:56:in `initialize'
/var/lib/gems/2.3.0/gems/pg-0.20.0/lib/pg.rb:56:in `new'
/var/lib/gems/2.3.0/gems/pg-0.20.0/lib/pg.rb:56:in `connect'
/var/lib/gems/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/postgresql_adapter.rb:695:in `connect'
/var/lib/gems/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/postgresql_adapter.rb:220:in `initialize'
/var/lib/gems/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/postgresql_adapter.rb:38:in `new'
/var/lib/gems/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/postgresql_adapter.rb:38:in `postgresql_connection'
/var/lib/gems/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:759:in `new_connection'
/var/lib/gems/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:803:in `checkout_new_connection'
/var/lib/gems/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:782:in `try_to_checkout_new_connection'
/var/lib/gems/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:743:in `acquire_connection'
/var/lib/gems/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:500:in `checkout'
/var/lib/gems/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:374:in `connection'
/var/lib/gems/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:931:in `retrieve_connection'
/var/lib/gems/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_handling.rb:116:in `retrieve_connection'
/var/lib/gems/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_handling.rb:88:in `connection'
/home/purldator/discourse/lib/site_settings/db_provider.rb:62:in `table_exists?'
/home/purldator/discourse/lib/site_settings/db_provider.rb:21:in `find'
/home/purldator/discourse/lib/site_settings/defaults_provider.rb:109:in `block in refresh_site_locale!'
/var/lib/gems/2.3.0/gems/rails_multisite-1.1.0.rc4/lib/rails_multisite/connection_management.rb:126:in `block in each_connection'
/var/lib/gems/2.3.0/gems/rails_multisite-1.1.0.rc4/lib/rails_multisite/connection_management.rb:124:in `each'
/var/lib/gems/2.3.0/gems/rails_multisite-1.1.0.rc4/lib/rails_multisite/connection_management.rb:124:in `each_connection'
/home/purldator/discourse/lib/site_settings/defaults_provider.rb:103:in `refresh_site_locale!'
/home/purldator/discourse/lib/site_settings/defaults_provider.rb:20:in `initialize'
/home/purldator/discourse/lib/site_setting_extension.rb:35:in `new'
/home/purldator/discourse/lib/site_setting_extension.rb:35:in `defaults'
/home/purldator/discourse/lib/site_setting_extension.rb:72:in `block in setting'
/home/purldator/discourse/lib/site_setting_extension.rb:71:in `synchronize'
/home/purldator/discourse/lib/site_setting_extension.rb:71:in `setting'
/home/purldator/discourse/app/models/site_setting.rb:17:in `block in load_settings'
/home/purldator/discourse/lib/site_settings/yaml_loader.rb:25:in `block (2 levels) in load'
/home/purldator/discourse/lib/site_settings/yaml_loader.rb:11:in `each'
/home/purldator/discourse/lib/site_settings/yaml_loader.rb:11:in `block in load'
/home/purldator/discourse/lib/site_settings/yaml_loader.rb:10:in `each_key'
/home/purldator/discourse/lib/site_settings/yaml_loader.rb:10:in `load'
/home/purldator/discourse/app/models/site_setting.rb:16:in `load_settings'
/home/purldator/discourse/app/models/site_setting.rb:21:in `<class:SiteSetting>'
/home/purldator/discourse/app/models/site_setting.rb:4:in `<main>'
/var/lib/gems/2.3.0/gems/bootsnap-1.0.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:63:in `load'
/var/lib/gems/2.3.0/gems/bootsnap-1.0.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:63:in `load'
/var/lib/gems/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:476:in `block in load_file'
/var/lib/gems/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:661:in `new_constants_in'
/var/lib/gems/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:475:in `load_file'
/var/lib/gems/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:374:in `block in require_or_load'
/var/lib/gems/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:36:in `block in load_interlock'
/var/lib/gems/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies/interlock.rb:12:in `block in loading'
/var/lib/gems/2.3.0/gems/activesupport-5.1.4/lib/active_support/concurrency/share_lock.rb:149:in `exclusive'
/var/lib/gems/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies/interlock.rb:11:in `loading'
/var/lib/gems/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:36:in `load_interlock'
/var/lib/gems/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:357:in `require_or_load'
/var/lib/gems/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:510:in `load_missing_constant'
/var/lib/gems/2.3.0/gems/bootsnap-1.0.0/lib/bootsnap/load_path_cache/core_ext/active_support.rb:53:in `block in load_missing_constant'
/var/lib/gems/2.3.0/gems/bootsnap-1.0.0/lib/bootsnap/load_path_cache/core_ext/active_support.rb:6:in `with_bootsnap_fallback'
/var/lib/gems/2.3.0/gems/bootsnap-1.0.0/lib/bootsnap/load_path_cache/core_ext/active_support.rb:53:in `load_missing_constant'
/var/lib/gems/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:202:in `const_missing'
/home/purldator/discourse/config/initializers/004-message_bus.rb:84:in `<main>'
/var/lib/gems/2.3.0/gems/bootsnap-1.0.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `load'
/var/lib/gems/2.3.0/gems/bootsnap-1.0.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `load'
/var/lib/gems/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:286:in `block in load'
/var/lib/gems/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:258:in `load_dependency'
/var/lib/gems/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:286:in `load'
/var/lib/gems/2.3.0/gems/railties-5.1.4/lib/rails/engine.rb:655:in `block in load_config_initializer'
/var/lib/gems/2.3.0/gems/activesupport-5.1.4/lib/active_support/notifications.rb:168:in `instrument'
/var/lib/gems/2.3.0/gems/railties-5.1.4/lib/rails/engine.rb:654:in `load_config_initializer'
/var/lib/gems/2.3.0/gems/railties-5.1.4/lib/rails/engine.rb:612:in `block (2 levels) in <class:Engine>'
/var/lib/gems/2.3.0/gems/railties-5.1.4/lib/rails/engine.rb:611:in `each'
/var/lib/gems/2.3.0/gems/railties-5.1.4/lib/rails/engine.rb:611:in `block in <class:Engine>'
/var/lib/gems/2.3.0/gems/railties-5.1.4/lib/rails/initializable.rb:30:in `instance_exec'
/var/lib/gems/2.3.0/gems/railties-5.1.4/lib/rails/initializable.rb:30:in `run'
/var/lib/gems/2.3.0/gems/railties-5.1.4/lib/rails/initializable.rb:59:in `block in run_initializers'
/var/lib/gems/2.3.0/gems/railties-5.1.4/lib/rails/initializable.rb:48:in `each'
/var/lib/gems/2.3.0/gems/railties-5.1.4/lib/rails/initializable.rb:48:in `tsort_each_child'
/var/lib/gems/2.3.0/gems/railties-5.1.4/lib/rails/initializable.rb:58:in `run_initializers'
/var/lib/gems/2.3.0/gems/railties-5.1.4/lib/rails/application.rb:353:in `initialize!'
/var/lib/gems/2.3.0/gems/railties-5.1.4/lib/rails/railtie.rb:185:in `public_send'
/var/lib/gems/2.3.0/gems/railties-5.1.4/lib/rails/railtie.rb:185:in `method_missing'
/home/purldator/discourse/config/environment.rb:5:in `<main>'
/var/lib/gems/2.3.0/gems/bootsnap-1.0.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:17:in `require'
/var/lib/gems/2.3.0/gems/bootsnap-1.0.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:17:in `require'
/var/lib/gems/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `block in require'
/var/lib/gems/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:258:in `load_dependency'
/var/lib/gems/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require'
/var/lib/gems/2.3.0/gems/railties-5.1.4/lib/rails/application.rb:329:in `require_environment!'
/var/lib/gems/2.3.0/gems/railties-5.1.4/lib/rails/application.rb:445:in `block in run_tasks_blocks'
/var/lib/gems/2.3.0/gems/rake-12.1.0/exe/rake:27:in `<top (required)>'
Tasks: TOP => db:migrate => environment
(See full trace by running task with --trace)

Got it to work by giving in and creating a root role.


(Jeff Wong) #190

That would explain why you needed a root user - you shouldn’t need to sudo to run the bundler commands, otherwise the user is root.

You might need to change your permissions in your discourse project back to your non-root user, too, or re-clone the DB again without sudo.


#191

I have no clue how it drifted. Yes, as of right now root owns /discourse in my home folder. I followed the instructions perfectly so I have no idea where it went from point p to point r, as it were.


(Jeff Wong) #192

I’ve seen stranger things; could have been that you were cloning and setting up the env in a terminal after running sudo su or something of that nature.

If you wanted to get out of root, depending on how far along you are, it’s probably safe and pretty quick to re-clone.


#198

I got this message, should i overwrite? Ubuntu 16.04.3

Installing Bundler …

Fetching: bundler-1.16.1.gem (100%)
bundler’s executable “bundle” conflicts with /home/discourse/.rbenv/versions/2.4.2/bin/bundle
Overwrite the executable? [yN]


(Blake Erickson) #199

Yes, you can overwrite.


#201

Since the method detailed in Discourse as Your First Rails App, was no longer maintained for development Discourse setups, I had to try the process mentioned here. There were a few extra steps and learning curves that I had to go through before the setup could run successfully.

While creating ROLE, if the system username has a capitalized first letter (such as Techapj), then CREATE ROLE Techapj... will still create the role as lowercase techapj. This will mean that the user will not have a role associated with their actual system username and therefore will be unable to go further. This apparently can be resolved by using quotes, i.e. CREATE ROLE "Techapj"... (OR create a new lowercase username, switch accounts, add the new account to the sudoers file, which apparently can only be done after setting a password to the Ubuntu root account).

Another issue was the conflict in encoding types. For my instance, both the template0 and template1 were by default SQL_ASCII encoded. These had to be changed to UTF8 encoding. For this purpose, run the following:

sudo -u postgres psql postgres
UPDATE pg_database SET encoding = pg_char_to_encoding('UTF8') WHERE datname = 'template0';
UPDATE pg_database SET encoding = pg_char_to_encoding('UTF8') WHERE datname = 'template1';

For some reason, it didn’t work by only changing the encoding for template0. To list all databases with their properties, run: \list OR \l.

Additionally, rake commands throw out a cd error if the path contains whitespaces. Not sure how to resolve this. Another thing different from Discourse as Your First Rails App was that the Discourse instance, at least for me, used to open on localhost:4000 and now it opens in localhost:3000 (as it should).


(Joshua Moore) #214

I have followed all the steps but when I get to

bundle exec rake db:create db:migrate

I get an error:

Failed to report error: Invalid argument 2 Invalid argument subscribe failed, reconnecting in 1 second. Call stack ["/home/joshuaalanmoore/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/redis-4.0.1/lib/redis/connection/hiredis.rb:19:in `connect'", "/home/joshuaalanmoore/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/redis-4.0.1/lib/redis/connection/hiredis.rb:19:in `connect'", "/home/joshuaalanmoore/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/redis-4.0.1/lib/redis/client.rb:334:in `establish_connection'", "/home/joshuaalanmoore/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/redis-4.0.1/lib/redis/client.rb:99:in `block in connect'", "/home/joshuaalanmoore/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/redis-4.0.1/lib/redis/client.rb:291:in `with_reconnect'", "/home/joshuaalanmoore/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/redis-4.0.1/lib/redis/client.rb:98:in `connect'", "/home/joshuaalanmoore/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/redis-4.0.1/lib/redis/client.rb:274:in `with_socket_timeout'", "/home/joshuaalanmoore/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/redis-4.0.1/lib/redis/client.rb:131:in `call_loop'", "/home/joshuaalanmoore/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/redis-4.0.1/lib/redis/subscribe.rb:43:in `subscription'", "/home/joshuaalanmoore/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/redis-4.0.1/lib/redis/subscribe.rb:12:in `subscribe'", "/home/joshuaalanmoore/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/redis-4.0.1/lib/redis.rb:2824:in `_subscription'", "/home/joshuaalanmoore/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/redis-4.0.1/lib/redis.rb:2192:in `block in subscribe'", "/home/joshuaalanmoore/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/redis-4.0.1/lib/redis.rb:45:in `block in synchronize'", "/home/joshuaalanmoore/.rbenv/versions/2.5.1/lib/ruby/2.5.0/monitor.rb:226:in `mon_synchronize'", "/home/joshuaalanmoore/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/redis-4.0.1/lib/redis.rb:45:in `synchronize'", "/home/joshuaalanmoore/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/redis-4.0.1/lib/redis.rb:2191:in `subscribe'", "/home/joshuaalanmoore/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/message_bus-2.1.5/lib/message_bus/backends/redis.rb:337:in `global_subscribe'", "/home/joshuaalanmoore/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/message_bus-2.1.5/lib/message_bus.rb:530:in `global_subscribe_thread'", "/home/joshuaalanmoore/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/message_bus-2.1.5/lib/message_bus.rb:478:in `block in new_subscriber_thread'"]
No connection to db, unable to retrieve site settings! (normal when running db:create)
rake aborted!
Errno::EINVAL: Invalid argument
/home/joshuaalanmoore/discourse/lib/discourse_redis.rb:200:in `block in del'
/home/joshuaalanmoore/discourse/lib/discourse_redis.rb:153:in `ignore_readonly'
/home/joshuaalanmoore/discourse/lib/discourse_redis.rb:198:in `del'
/home/joshuaalanmoore/discourse/lib/cache.rb:57:in `delete_entry'
/home/joshuaalanmoore/discourse/lib/site_setting_extension.rb:366:in `clear_cache!'
/home/joshuaalanmoore/discourse/lib/site_setting_extension.rb:262:in `block in refresh!'
/home/joshuaalanmoore/discourse/lib/site_setting_extension.rb:243:in `synchronize'
/home/joshuaalanmoore/discourse/lib/site_setting_extension.rb:243:in `refresh!'
/home/joshuaalanmoore/discourse/lib/site_setting_extension.rb:408:in `block in setup_methods'
/home/joshuaalanmoore/discourse/config/initializers/004-message_bus.rb:99:in `<main>'
/home/joshuaalanmoore/discourse/config/environment.rb:5:in `<main>'
/home/joshuaalanmoore/.rbenv/versions/2.5.1/bin/bundle:23:in `load'
/home/joshuaalanmoore/.rbenv/versions/2.5.1/bin/bundle:23:in `<main>'
Tasks: TOP => db:create => db:load_config => environment
(See full trace by running task with --trace)
joshuaalanmoore@CORP-D0164SUP:~/discourse$

Anyone know what I need to do? Advanced apologies as this is the first experience I have with this stuff.


(Sam Saffron) #215

My guess, redis is not running on your machine, or it is running on a custom port.


(Joshua Moore) #216

Do I need redis running on the Win 10 side? I am setting this up on Win 10 for development (Beginners Guide to Install Discourse on Windows 10 for Development).

Any idea on how I would find if it is running on a custom port? I believe redis is running since I get this:

redis-cli ping
PONG


(Sam Saffron) #217

Is that the same cli you are using to run migrate?


(Joshua Moore) #218

Yes I believe it is. How best can I confirm that?


(Claudiu) #219

I got this error while running the first command:

Fetching: bundler-1.16.3.gem (100%)
bundler’s executable “bundle” conflicts with /root/.rbenv/versions/2.5.1/bin/bundle
Overwrite the executable? [yN] ERROR: Error installing bundler:
“bundle” from bundler conflicts with /root/.rbenv/versions/2.5.1/bin/bundle
failed

Should I install bundler with an apt install or?


(Blake Erickson) #220

Which command specifically?

You can just run gem install bundler to install bundler, but according to your output it is already installed which is why there is a conflict. Maybe they are different version of bundler? bundler --version will show the current version installed, maybe it is different than 1.16.3?

Looks like you should just hit y and upgrade bunder:


(Claudiu) #221

I installed it with gem install and it seems to be working. Thanks for the help, @blake


(Sora &\) #222

Hello, i get this error when create user:

huynhthai824@UEH:~$ sudo -u postgres createuser -s huynhthai824
[sudo] password for huynhthai824:
createuser: could not connect to database postgres: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket “/var/run/postgresql/.s.PGSQL.5432”?
huynhthai824@UEH:~$

How do i continue?

I restart postgres and i solve this :slight_smile:


(Sora &\) #223

When i run this command

i get error

No connection to db, unable to retrieve site settings! (normal when running db:create)
rake aborted!
Errno::EINVAL: Invalid argument

How i continue?

I run Ubuntu on Window 10 store, so when i test Discourse, i will check in browse’s window 10?


#225

If you’re installing on Windows 10 subsystem for Linux then don’t you want this? Seems like there are different steps for database setup: