Installing zammad from a source

Infos:

  • Used Zammad version:
  • Used Zammad installation type: (source)
  • Operating system:
  • Browser + version:

Greetings, since there is no package or repo for the Fedora Linux distribution, I am trying to install it from the source. I have followed the steps and am stuck at step 4 (initializing the database).
I used PostgreSQL as a database and created the database and user manually. When I execute rake db:migrate I get the following error and I couldn’t get it:

rake aborted!
LoadError: Could not load the 'postgresql username:zammad password:"mypass"' Active Record adapter. Ensure that the adapter is spelled correctly in config/database.yml and that you've added the necessary adapter gem to your Gemfile.
/usr/local/rvm/gems/ruby-3.1.3/gems/bootsnap-1.17.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
/usr/local/rvm/gems/ruby-3.1.3/gems/zeitwerk-2.6.12/lib/zeitwerk/kernel.rb:38:in `require'
/usr/local/rvm/gems/ruby-3.1.3/gems/activerecord-7.0.8/lib/active_record/connection_adapters/abstract/connection_handler.rb:268:in `resolve_pool_config'
/usr/local/rvm/gems/ruby-3.1.3/gems/activerecord-7.0.8/lib/active_record/connection_adapters/abstract/connection_handler.rb:129:in `establish_connection'
/usr/local/rvm/gems/ruby-3.1.3/gems/activerecord-7.0.8/lib/active_record/connection_handling.rb:52:in `establish_connection'
/usr/local/rvm/gems/ruby-3.1.3/gems/activerecord-import-1.5.1/lib/activerecord-import/import.rb:256:in `establish_connection'
/usr/local/rvm/gems/ruby-3.1.3/gems/activerecord-7.0.8/lib/active_record/railtie.rb:268:in `block (2 levels) in <class:Railtie>'
/usr/local/rvm/gems/ruby-3.1.3/gems/activesupport-7.0.8/lib/active_support/lazy_load_hooks.rb:95:in `class_eval'
/usr/local/rvm/gems/ruby-3.1.3/gems/activesupport-7.0.8/lib/active_support/lazy_load_hooks.rb:95:in `block in execute_hook'
/usr/local/rvm/gems/ruby-3.1.3/gems/activesupport-7.0.8/lib/active_support/lazy_load_hooks.rb:85:in `with_execution_control'
/usr/local/rvm/gems/ruby-3.1.3/gems/activesupport-7.0.8/lib/active_support/lazy_load_hooks.rb:90:in `execute_hook'
/usr/local/rvm/gems/ruby-3.1.3/gems/activesupport-7.0.8/lib/active_support/lazy_load_hooks.rb:60:in `block in on_load'
/usr/local/rvm/gems/ruby-3.1.3/gems/activesupport-7.0.8/lib/active_support/lazy_load_hooks.rb:59:in `each'
/usr/local/rvm/gems/ruby-3.1.3/gems/activesupport-7.0.8/lib/active_support/lazy_load_hooks.rb:59:in `on_load'
/usr/local/rvm/gems/ruby-3.1.3/gems/activerecord-7.0.8/lib/active_record/railtie.rb:262:in `block in <class:Railtie>'
/usr/local/rvm/gems/ruby-3.1.3/gems/railties-7.0.8/lib/rails/initializable.rb:32:in `instance_exec'
/usr/local/rvm/gems/ruby-3.1.3/gems/railties-7.0.8/lib/rails/initializable.rb:32:in `run'
/usr/local/rvm/gems/ruby-3.1.3/gems/railties-7.0.8/lib/rails/initializable.rb:61:in `block in run_initializers'
/usr/local/rvm/gems/ruby-3.1.3/gems/railties-7.0.8/lib/rails/initializable.rb:60:in `run_initializers'
/usr/local/rvm/gems/ruby-3.1.3/gems/railties-7.0.8/lib/rails/application.rb:372:in `initialize!'
/opt/zammad/config/environment.rb:7:in `<main>'
/usr/local/rvm/gems/ruby-3.1.3/gems/bootsnap-1.17.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
/usr/local/rvm/gems/ruby-3.1.3/gems/bootsnap-1.17.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
/usr/local/rvm/gems/ruby-3.1.3/gems/zeitwerk-2.6.12/lib/zeitwerk/kernel.rb:38:in `require'
/usr/local/rvm/gems/ruby-3.1.3/gems/railties-7.0.8/lib/rails/application.rb:348:in `require_environment!'
/usr/local/rvm/gems/ruby-3.1.3/gems/railties-7.0.8/lib/rails/application.rb:506:in `block in run_tasks_blocks'
/usr/local/rvm/gems/ruby-3.1.3/bin/ruby_executable_hooks:22:in `eval'
/usr/local/rvm/gems/ruby-3.1.3/bin/ruby_executable_hooks:22:in `<main>'

Caused by:
LoadError: cannot load such file -- active_record/connection_adapters/postgresql username:zammad password:"mypass"_adapter
/usr/local/rvm/gems/ruby-3.1.3/gems/bootsnap-1.17.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
/usr/local/rvm/gems/ruby-3.1.3/gems/zeitwerk-2.6.12/lib/zeitwerk/kernel.rb:38:in `require'
/usr/local/rvm/gems/ruby-3.1.3/gems/activerecord-7.0.8/lib/active_record/connection_adapters/abstract/connection_handler.rb:268:in `resolve_pool_config'
/usr/local/rvm/gems/ruby-3.1.3/gems/activerecord-7.0.8/lib/active_record/connection_adapters/abstract/connection_handler.rb:129:in `establish_connection'
/usr/local/rvm/gems/ruby-3.1.3/gems/activerecord-7.0.8/lib/active_record/connection_handling.rb:52:in `establish_connection'
/usr/local/rvm/gems/ruby-3.1.3/gems/activerecord-import-1.5.1/lib/activerecord-import/import.rb:256:in `establish_connection'
/usr/local/rvm/gems/ruby-3.1.3/gems/activerecord-7.0.8/lib/active_record/railtie.rb:268:in `block (2 levels) in <class:Railtie>'
/usr/local/rvm/gems/ruby-3.1.3/gems/activesupport-7.0.8/lib/active_support/lazy_load_hooks.rb:95:in `class_eval'
/usr/local/rvm/gems/ruby-3.1.3/gems/activesupport-7.0.8/lib/active_support/lazy_load_hooks.rb:95:in `block in execute_hook'
/usr/local/rvm/gems/ruby-3.1.3/gems/activesupport-7.0.8/lib/active_support/lazy_load_hooks.rb:85:in `with_execution_control'
/usr/local/rvm/gems/ruby-3.1.3/gems/activesupport-7.0.8/lib/active_support/lazy_load_hooks.rb:90:in `execute_hook'
/usr/local/rvm/gems/ruby-3.1.3/gems/activesupport-7.0.8/lib/active_support/lazy_load_hooks.rb:60:in `block in on_load'
/usr/local/rvm/gems/ruby-3.1.3/gems/activesupport-7.0.8/lib/active_support/lazy_load_hooks.rb:59:in `each'
/usr/local/rvm/gems/ruby-3.1.3/gems/activesupport-7.0.8/lib/active_support/lazy_load_hooks.rb:59:in `on_load'
/usr/local/rvm/gems/ruby-3.1.3/gems/activerecord-7.0.8/lib/active_record/railtie.rb:262:in `block in <class:Railtie>'
/usr/local/rvm/gems/ruby-3.1.3/gems/railties-7.0.8/lib/rails/initializable.rb:32:in `instance_exec'
/usr/local/rvm/gems/ruby-3.1.3/gems/railties-7.0.8/lib/rails/initializable.rb:32:in `run'
/usr/local/rvm/gems/ruby-3.1.3/gems/railties-7.0.8/lib/rails/initializable.rb:61:in `block in run_initializers'
/usr/local/rvm/gems/ruby-3.1.3/gems/railties-7.0.8/lib/rails/initializable.rb:60:in `run_initializers'
/usr/local/rvm/gems/ruby-3.1.3/gems/railties-7.0.8/lib/rails/application.rb:372:in `initialize!'
/opt/zammad/config/environment.rb:7:in `<main>'
/usr/local/rvm/gems/ruby-3.1.3/gems/bootsnap-1.17.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
/usr/local/rvm/gems/ruby-3.1.3/gems/bootsnap-1.17.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
/usr/local/rvm/gems/ruby-3.1.3/gems/zeitwerk-2.6.12/lib/zeitwerk/kernel.rb:38:in `require'
/usr/local/rvm/gems/ruby-3.1.3/gems/railties-7.0.8/lib/rails/application.rb:348:in `require_environment!'
/usr/local/rvm/gems/ruby-3.1.3/gems/railties-7.0.8/lib/rails/application.rb:506:in `block in run_tasks_blocks'
/usr/local/rvm/gems/ruby-3.1.3/bin/ruby_executable_hooks:22:in `eval'
/usr/local/rvm/gems/ruby-3.1.3/bin/ruby_executable_hooks:22:in `<main>'
Tasks: TOP => db:migrate => db:load_config => environment
(See full trace by running task with --trace)

Here is my database.yml config

# this is a database config sample for zammad ready to use with a postgresql db
# copy or symlink this file to config/database.yml to use it

default: &default
  # For details on connection pooling, see Rails configuration guide
  # http://guides.rubyonrails.org/configuring.html#database-pooling
  pool: 50
  encoding: utf8

  ##### postgresql config #####

  adapter: postgresql
   username:zammad
   password:"mypass"

  # If the database server is not on localhost, you can set hostname and port:
  # host:
  # port:

  #### mysql config #####

  # adapter: mysql2
  # username: zammad
  # password: <Password>

  # If the database server is not on localhost, you can set hostname and port:
  # host:
  # port:

production:
  <<: *default
  database: zammad_production

development:
  <<: *default
  database: zammad_development

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
  <<: *default
  database: zammad_test

Hi @elhananjair. You broke the syntax of the database YML file, this is why it’s not able to be used correctly. Please have a look in config/database/database.yml and make sure the syntax is correct.

Yeah, I have checked multiple times, I am using the copy of database.yml inside the config directory with the content I have shared above. But even for the file config/database/database.yml the syntax seems right.

# this is a database config sample for zammad ready to use with a postgresql db
# copy or symlink this file to config/database.yml to use it

default: &default
  # For details on connection pooling, see Rails configuration guide
  # http://guides.rubyonrails.org/configuring.html#database-pooling
  pool: 50
  encoding: utf8

  ##### postgresql config #####

  adapter: postgresql
   # username: zammad
   # password: 'mypass'

  # If the database server is not on localhost, you can set hostname and port:
  # host:
  # port:

  #### mysql config #####

  # adapter: mysql2
  # username: zammad
  # password: <Password>

  # If the database server is not on localhost, you can set hostname and port:
  # host:
  # port:

production:
  <<: *default
  database: zammad_production

development:
  <<: *default
  database: zammad_development

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
  <<: *default
  database: zammad_test


Indentation is part of the syntax of yaml and needs to be correct.

adapter, username and password are all on the same level. That’s not the case in your example.

Thank you it works now, I had no idea about that I just edited the template, but I missed the spaces when I inserted the credential.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.