Project

General

Profile

[solved] Installation issue for 5.0.3 - NoMethodError: undefined method `push_dir' for nil:NilClass

Added by alex koval about 2 years ago

Hello,

I am getting this on step14 (tried on 2 different servers):

NoMethodError: undefined method `push_dir' for nil:NilClass
/home/redmine/redmine-5.0.3/lib/redmine/plugin_loader.rb:130:in `block (2 levels) in add_autoload_paths'
/home/redmine/redmine-5.0.3/lib/redmine/plugin_loader.rb:129:in `each'
/home/redmine/redmine-5.0.3/lib/redmine/plugin_loader.rb:129:in `block in add_autoload_paths'
/home/redmine/redmine-5.0.3/lib/redmine/plugin_loader.rb:125:in `each'
/home/redmine/redmine-5.0.3/lib/redmine/plugin_loader.rb:125:in `add_autoload_paths'
/home/redmine/redmine-5.0.3/lib/redmine/plugin_loader.rb:105:in `load'
/home/redmine/redmine-5.0.3/config/initializers/30-redmine.rb:20:in `<top (required)>'
/var/lib/gems/3.0.0/gems/activesupport-6.1.7/lib/active_support/dependencies.rb:326:in `load'
/var/lib/gems/3.0.0/gems/activesupport-6.1.7/lib/active_support/dependencies.rb:326:in `block in load'
/var/lib/gems/3.0.0/gems/activesupport-6.1.7/lib/active_support/dependencies.rb:299:in `load_dependency'
/var/lib/gems/3.0.0/gems/activesupport-6.1.7/lib/active_support/dependencies.rb:326:in `load'
/var/lib/gems/3.0.0/gems/railties-6.1.7/lib/rails/engine.rb:681:in `block in load_config_initializer'
/var/lib/gems/3.0.0/gems/activesupport-6.1.7/lib/active_support/notifications.rb:205:in `instrument'
/var/lib/gems/3.0.0/gems/railties-6.1.7/lib/rails/engine.rb:680:in `load_config_initializer'
/var/lib/gems/3.0.0/gems/railties-6.1.7/lib/rails/engine.rb:634:in `block (2 levels) in <class:Engine>'
/var/lib/gems/3.0.0/gems/railties-6.1.7/lib/rails/engine.rb:633:in `each'
/var/lib/gems/3.0.0/gems/railties-6.1.7/lib/rails/engine.rb:633:in `block in <class:Engine>'
/var/lib/gems/3.0.0/gems/railties-6.1.7/lib/rails/initializable.rb:32:in `instance_exec'
/var/lib/gems/3.0.0/gems/railties-6.1.7/lib/rails/initializable.rb:32:in `run'
/var/lib/gems/3.0.0/gems/railties-6.1.7/lib/rails/initializable.rb:61:in `block in run_initializers'
/var/lib/gems/3.0.0/gems/railties-6.1.7/lib/rails/initializable.rb:50:in `each'
/var/lib/gems/3.0.0/gems/railties-6.1.7/lib/rails/initializable.rb:50:in `tsort_each_child'
/var/lib/gems/3.0.0/gems/railties-6.1.7/lib/rails/initializable.rb:60:in `run_initializers'
/var/lib/gems/3.0.0/gems/railties-6.1.7/lib/rails/application.rb:391:in `initialize!'
/home/redmine/redmine-5.0.3/config/environment.rb:18:in `<top (required)>'
/var/lib/gems/3.0.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'
/var/lib/gems/3.0.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'
/var/lib/gems/3.0.0/gems/activesupport-6.1.7/lib/active_support/dependencies.rb:332:in `block in require'
/var/lib/gems/3.0.0/gems/activesupport-6.1.7/lib/active_support/dependencies.rb:299:in `load_dependency'
/var/lib/gems/3.0.0/gems/activesupport-6.1.7/lib/active_support/dependencies.rb:332:in `require'
/var/lib/gems/3.0.0/gems/railties-6.1.7/lib/rails/application.rb:367:in `require_environment!'
/var/lib/gems/3.0.0/gems/railties-6.1.7/lib/rails/application.rb:533:in `block in run_tasks_blocks'
/usr/share/rubygems-integration/all/gems/rake-13.0.6/exe/rake:27:in `<top (required)>'
Tasks: TOP => db:migrate => db:load_config => environment
(See full trace by running task with --trace)
redmine@ubuntu-s-1vcpu-1gb-intel-fra1-01:~/redmi

Output from `ruby bin/about` looks the same, skipping it.

Here are more details about my system:

System info

- Ubuntu 22.04 LTS
- ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x86_64-linux-gnu]

What I did to achieve this

Steps [12/14]

  1. Login to server
    #+begin_src tmux
    ssh
    #+end_src
  2. Install apache and ruby modules
    #+begin_src tmux
    apt install apache2 libapache2-mod-passenger ruby ruby-dev build-essential
    #+end_src
  3. Install postgresql:
    #+begin_src tmux
    apt install postgresql postgresql-contrib
    #+end_src
  4. Enable optional packages:
    #+begin_src tmux
    apt install imagemagick ghostscript
    #+end_src
  5. Create user:
    #+begin_src tmux
    useradd -m redmine -s /bin/bash
    #+end_src
  6. su - redmine
    #+begin_src tmux
    ssh
    su - redmine
    #+end_src
  7. Download
    #+begin_src tmux
    wget https://redmine.org/releases/redmine-5.0.3.tar.gz
    #+end_src
  8. Unpack:
    #+begin_src tmux
    tar xzf redmine-5.0.3.tar.gz
    ln -s redmine-5.0.3 redmine
    #+end_src
  9. Configure database
    #+begin_src sh
    cat << EOF | psql
    CREATE ROLE redmine LOGIN ENCRYPTED PASSWORD 'PASSWORD-xxx-xxx' NOINHERIT VALID UNTIL 'infinity';
    CREATE DATABASE redmine WITH ENCODING='UTF8' OWNER=redmine;
    EOF
    #+end_src
    : CREATE ROLE
    : CREATE DATABASE
  10. follow on: https://github.com/dopos/dockerfile-redmine/blob/master/Dockerfile and install system libs:
    #+begin_src tmux
    apt install apt-utils ca-certificates wget nano-tiny imagemagick libpq5 unzip postgresql-client bzr mercurial subversion darcs git openssh-client gcc libmagickcore-dev libmagickwand-dev libpq-dev make g++ cmake autoconf patch libicu-dev rsync
    #+end_src
  11. Configure database.yml, configuration.yml
  12. Upload db (see below)
  13. bundler is missing. installing.
    #+begin_src tmux
    apt install ruby-bundler
    #+end_src
  14. Migrate:
    #+begin_src tmux
    cd ~/redmine
    RAILS_ENV=production bundle exec rake db:migrate
    #+end_src
  15. Copy files
    • follow up on "copy files":fuzzy:*copy files
    • copy them to the dest server:
      #+begin_src tmux
      cd ~/dev/vhosting.dumps/tasks.server.domain
      rsync -ar -e ssh ./files/ :/home/redmine/redmine/files/
      #+end_src

Replies (2)

RE: Installation issue for 5.0.3 - NoMethodError: undefined method `push_dir' for nil:NilClass - Added by alex koval about 2 years ago

As far I see push_dir is used in 2 places:

config/initializers/zeitwerk.rb
4    Rails.autoloaders.main.push_dir lib, namespace: Redmine

lib/redmine/plugin_loader.rb
130            Rails.autoloaders.main.push_dir dir

This happens after this change:

commit a914cf4c402b2597e0cc563bd84145ce9eda5a41
Author: Marius Balteanu <marius.balteanu@zitec.com>
Date:   Wed Nov 17 20:55:08 2021 +0000

    Switch to zeitwerk autoloader (#29914, #32938).

    Patch by Takashi Kato.

    git-svn-id: http://svn.redmine.org/redmine/trunk@21287 e93f8b46-1217-0410-a6f0-8f06a7374b81

RE: Installation issue for 5.0.3 - NoMethodError: undefined method `push_dir' for nil:NilClass - Added by alex koval about 2 years ago

I found the issue: I should not have copied config/* from an old installation, it copied it with some previous defaults which caused this issue.
Returning files in config folder back from installation tar file fixed the issue for me.

    (1-2/2)