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

RAILS_ENV=production bundle exec rake redmine:plugins:migrate NAME=redmine_dmsf fails #1572

Open
StefanPofahl opened this issue Dec 19, 2024 · 10 comments
Assignees
Milestone

Comments

@StefanPofahl
Copy link

StefanPofahl commented Dec 19, 2024

command:
RAILS_ENV=production bundle exec rake redmine:plugins:migrate NAME=redmine_dmsf
fails.

Redmine installation is quite new, redmine_dmsf is the first plugin, that I try to install.
Redmine is set up according to following procedure: Redmine Installation on Debian.
Webserver is Apache2 and database is postgreSQL.

OS Debian v12 (bookworm), Redmine: 5.0.4, redmine_dmsf: v3.2.4

The command above is taken from the installation instructions.
The message output is attached below. Do you have an idea?

redmine@redmine:/usr/share/redmine$ RAILS_ENV=production bundle exec rake --trace redmine:plugins:migrate NAME=redmine_dmsf
** Invoke redmine:plugins:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
NameError: uninitialized constant Redmine::Plugin
/usr/share/redmine/lib/plugins/redmine_dmsf/init.rb:21:in `block in <top (required)>'
/usr/share/redmine/config/initializers/00-core_plugins.rb:10:in `eval'
/usr/share/redmine/config/initializers/00-core_plugins.rb:10:in `block in <top (required)>'
/usr/share/redmine/config/initializers/00-core_plugins.rb:4:in `each'
/usr/share/redmine/config/initializers/00-core_plugins.rb:4:in `<top (required)>'
/usr/share/rubygems-integration/all/gems/railties-6.1.7.3/lib/rails/engine.rb:681:in `block in load_config_initializer'
/usr/share/rubygems-integration/all/gems/activesupport-6.1.7.3/lib/active_support/notifications.rb:205:in `instrument'
/usr/share/rubygems-integration/all/gems/railties-6.1.7.3/lib/rails/engine.rb:680:in `load_config_initializer'
/usr/share/rubygems-integration/all/gems/railties-6.1.7.3/lib/rails/engine.rb:634:in `block (2 levels) in <class:Engine>'
/usr/share/rubygems-integration/all/gems/railties-6.1.7.3/lib/rails/engine.rb:633:in `each'
/usr/share/rubygems-integration/all/gems/railties-6.1.7.3/lib/rails/engine.rb:633:in `block in <class:Engine>'
/usr/share/rubygems-integration/all/gems/railties-6.1.7.3/lib/rails/initializable.rb:32:in `instance_exec'
/usr/share/rubygems-integration/all/gems/railties-6.1.7.3/lib/rails/initializable.rb:32:in `run'
/usr/share/rubygems-integration/all/gems/railties-6.1.7.3/lib/rails/initializable.rb:61:in `block in run_initializers'
/usr/lib/ruby/3.1.0/tsort.rb:228:in `block in tsort_each'
/usr/lib/ruby/3.1.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
/usr/lib/ruby/3.1.0/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from'
/usr/lib/ruby/3.1.0/tsort.rb:431:in `each_strongly_connected_component_from'
/usr/lib/ruby/3.1.0/tsort.rb:421:in `block in each_strongly_connected_component_from'
/usr/share/rubygems-integration/all/gems/railties-6.1.7.3/lib/rails/initializable.rb:50:in `each'
/usr/share/rubygems-integration/all/gems/railties-6.1.7.3/lib/rails/initializable.rb:50:in `tsort_each_child'
/usr/lib/ruby/3.1.0/tsort.rb:415:in `call'
/usr/lib/ruby/3.1.0/tsort.rb:415:in `each_strongly_connected_component_from'
/usr/lib/ruby/3.1.0/tsort.rb:349:in `block in each_strongly_connected_component'
/usr/lib/ruby/3.1.0/tsort.rb:347:in `each'
/usr/lib/ruby/3.1.0/tsort.rb:347:in `call'
/usr/lib/ruby/3.1.0/tsort.rb:347:in `each_strongly_connected_component'
/usr/lib/ruby/3.1.0/tsort.rb:226:in `tsort_each'
/usr/lib/ruby/3.1.0/tsort.rb:205:in `tsort_each'
/usr/share/rubygems-integration/all/gems/railties-6.1.7.3/lib/rails/initializable.rb:60:in `run_initializers'
/usr/share/rubygems-integration/all/gems/railties-6.1.7.3/lib/rails/application.rb:391:in `initialize!'
/usr/share/redmine/config/environment.rb:16:in `<top (required)>'
/usr/share/rubygems-integration/all/gems/zeitwerk-2.6.1/lib/zeitwerk/kernel.rb:35:in `require'
/usr/share/rubygems-integration/all/gems/zeitwerk-2.6.1/lib/zeitwerk/kernel.rb:35:in `require'
/usr/share/rubygems-integration/all/gems/railties-6.1.7.3/lib/rails/application.rb:367:in `require_environment!'
/usr/share/rubygems-integration/all/gems/railties-6.1.7.3/lib/rails/application.rb:533:in `block in run_tasks_blocks'
/usr/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `block in execute'
/usr/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `each'
/usr/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `execute'
/usr/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:219:in `block in invoke_with_call_chain'
/usr/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:199:in `synchronize'
/usr/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:199:in `invoke_with_call_chain'
/usr/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:243:in `block in invoke_prerequisites'
/usr/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:241:in `each'
/usr/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:241:in `invoke_prerequisites'
/usr/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:218:in `block in invoke_with_call_chain'
/usr/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:199:in `synchronize'
/usr/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:199:in `invoke_with_call_chain'
/usr/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:188:in `invoke'
/usr/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:160:in `invoke_task'
/usr/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `block (2 levels) in top_level'
/usr/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `each'
/usr/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `block in top_level'
/usr/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:125:in `run_with_threads'
/usr/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:110:in `top_level'
/usr/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:83:in `block in run'
/usr/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:186:in `standard_exception_handling'
/usr/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:80:in `run'
/usr/lib/ruby/gems/3.1.0/gems/rake-13.0.6/exe/rake:27:in `<top (required)>'
/usr/bin/rake:25:in `load'
/usr/bin/rake:25:in `<main>'
Tasks: TOP => redmine:plugins:migrate => environment
redmine@redmine:/usr/share/redmine$ 

@picman
Copy link
Collaborator

picman commented Dec 20, 2024

From the doc:

Plugins should be placed under /usr/share/redmine/plugins. The folder doesn't exist by default and must be created. Don't use /usr/share/redmine/lib/plugins as this result to routing error in the application.

@StefanPofahl
Copy link
Author

@picman
Thanks for the clarification :-) Here my experience:

First defined environment variables $REDMINE_HOME & $REDMINE_PLUGINS
in ~/.bashrc
#######

[...]
# ### Add other environment variables #########################
# ## Variable REDMINE_HOME is equal to the folder which contains the file `config.ru`, `Rakefile`, `Gemfile`
export REDMINE_HOME="/usr/share/redmine"
# ## Variable REDMINE_PLUGINS is below $REDMINE_HOME
export REDMINE_PLUGINS="/usr/share/redmine/plugins"
[...]

#######
restart bash / CLI
#######

mv /home/redmine/Downloads/redmine_dmsf-3.2.4 /home/redmine/Downloads/redmine_dmsf
mkdir -p $REDMINE_PLUGINS/redmine_dmsf
cp -r /home/redmine/Downloads/redmine_dmsf $REDMINE_PLUGINS

#######
cd $REDMINE_HOME
bundle install
#######

And this is part of the output:

[...]
Following files may not be writable, so sudo is needed:
  /usr/local/bin
  /var/lib/gems/3.1.0
  /var/lib/gems/3.1.0/build_info
  /var/lib/gems/3.1.0/cache
  /var/lib/gems/3.1.0/doc
  /var/lib/gems/3.1.0/extensions
  /var/lib/gems/3.1.0/gems
  /var/lib/gems/3.1.0/plugins
  /var/lib/gems/3.1.0/specifications

[...]
Your user account isn't allowed to install to the system RubyGems.
  You can cancel this installation and run:

      bundle config set --local path 'vendor/bundle'
      bundle install

  to install the gems into ./vendor/bundle/, or you can enter your password
  and install the bundled gems to RubyGems using sudo.

[...]

An error occurred while installing xapian-ruby (1.4.22), and Bundler cannot continue.

In Gemfile:
  xapian-ruby
Bundler::InstallError: Bundler::SudoNotPermittedError: Bundler requires sudo access to install at the moment.
Try installing again, granting Bundler sudo access when prompted, or installing into a different path.

[...]
An error occurred while installing xapian-ruby (1.4.22), and Bundler cannot continue.

In Gemfile:
  xapian-ruby
[...]

If I run as root (what is not recommended), the error message is much shorter:
#######

root@redmine:/usr/share/redmine# bundle install
There was an error accessing `/usr/share/redmine/.bundle/config`.
The underlying system error is Errno::EISDIR: Is a directory @ io_fread - /usr/share/redmine/.bundle/config

Creating / Re-Creating the folder does not help :-(

root@redmine:/usr/share/redmine# rm -Rf /usr/share/redmine/.bundle
root@redmine:/usr/share/redmine# rm -Rf /usr/share/redmine/.bundle/config
root@redmine:/usr/share/redmine# mkdir /usr/share/redmine/.bundle
root@redmine:/usr/share/redmine# mkdir /usr/share/redmine/.bundle/config

Any ideas? Is this an issue outside the package redmine_dmfs?

@picman
Copy link
Collaborator

picman commented Dec 20, 2024

I run Redmine on many Debian instances and would recommend you not following Debian installation but installing it according to Redmine's installation steps - https://www.redmine.org/projects/redmine/wiki/RedmineInstall
You will save time and avoid many problems.

@StefanPofahl
Copy link
Author

Thanks for the immediate response! I will give it try, but this may have to wait some time ...

Off-topic:
There is a typo in your installation instruction (4.1 In production environment), that is fatal for new-comers:

bundle config set --local without 'development test`

the last character is char 96, but it should be char 39

regards,
Stefan

@picman picman self-assigned this Dec 20, 2024
@picman picman added this to the 4.0.1 milestone Dec 20, 2024
picman added a commit that referenced this issue Dec 20, 2024
@picman
Copy link
Collaborator

picman commented Dec 20, 2024

You're right. Fixed.

@StefanPofahl
Copy link
Author

Off-Topic but related and a consequence of my trial to install redmine_dmfs.

If you see the message: xapian-ruby missing or similar on a Debian system try as root:

su
cd $REDMINE_HOME
apt install -y zlib1g-dev
gem install xapian-ruby

@StefanPofahl
Copy link
Author

After installation of two other packages on Debian:

su
cd $REDMINE_HOME
apt install -y libssl-dev libpq-dev

I can execute the installation instruction up to the command:

RAILS_ENV="production" bundle exec rake assets:precompile

The message is:

Don't know how to build task 'assets:precompile' (See the list of available tasks with `rake --tasks`)

And

rake --tasks | grep precompile

Gives no output. Any ideas, what could be wrong?

@picman
Copy link
Collaborator

picman commented Dec 21, 2024

Do you run it from the redmine folder? What says bundle exec rake --tasks?

@StefanPofahl
Copy link
Author

Again thanks for your kind support!!! :-)

I had a look on the official manual redmine installation you mentioned above, but this is for experts.
It starts already with the comment / recommendation:
Important : don't forget to restart the application after any change.
But no word how to do that.
I like the idea of an installation, that people like me can handle.

I understand the the command rake and bundle should be performed as standard user (is this correct?),
but I gave up, I tried a lot to manipulate the access rights to the files and folders that are mentioned each time I failed with a bundle command as standard user, therefore I added my standard user to the sudoers-group.

Now to your question, I give the command in the $REDMINE_HOME directory, here is the output I see:

redmine@redmine:/usr/share/redmine$ sudo bundle exec rake --tasks
rake about                                       # List versions of all Rails frameworks and the environment
rake app:template                                # Applies the template supplied by LOCATION=(/path/to/template) or URL
rake app:update                                  # Update configs and some other initially generated files (or use just update:configs or upd...
rake cache_digests:dependencies                  # Lookup first-level dependencies for TEMPLATE (like messages/show or comments/_comment.html)
rake cache_digests:nested_dependencies           # Lookup nested dependencies for TEMPLATE (like messages/show or comments/_comment.html)
rake ci                                          # Run the Continuous Integration tests for Redmine
rake ci:about                                    # Display info about the build environment
rake ci:build                                    # Build Redmine
rake ci:setup                                    # Setup Redmine for a new build
rake ci:teardown                                 # Finish the build
rake config/database.yml                         # Creates database.yml for the CI server
rake config/initializers/secret_token.rb         # Generates a secret token for the application
rake db:create                                   # Creates the database from DATABASE_URL or config/database.yml for the current RAILS_ENV (u...
rake db:decrypt                                  # Decrypts SCM and LDAP passwords in the database
rake db:drop                                     # Drops the database from DATABASE_URL or config/database.yml for the current RAILS_ENV (use...
rake db:encrypt                                  # Encrypts SCM and LDAP passwords in the database
rake db:environment:set                          # Set the environment value for the database
rake db:fixtures:load                            # Loads fixtures into the current environment's database
rake db:migrate                                  # Migrate the database (options: VERSION=x, VERBOSE=false, SCOPE=blog)
rake db:migrate:down                             # Runs the "down" for a given migration VERSION
rake db:migrate:redo                             # Rolls back the database one migration and re-migrates up (options: STEP=x, VERSION=x)
rake db:migrate:status                           # Display status of migrations
rake db:migrate:up                               # Runs the "up" for a given migration VERSION
rake db:prepare                                  # Runs setup if database does not exist, or runs migrations if it does
rake db:reset                                    # Drops and recreates the database from db/schema.rb for the current environment and loads t...
rake db:rollback                                 # Rolls the schema back to the previous version (specify steps w/ STEP=n)
rake db:schema:cache:clear                       # Clears a db/schema_cache.yml file
rake db:schema:cache:dump                        # Creates a db/schema_cache.yml file
rake db:schema:dump                              # Creates a database schema file (either db/schema.rb or db/structure.sql, depending on `con...
rake db:schema:load                              # Loads a database schema file (either db/schema.rb or db/structure.sql, depending on `confi...
rake db:seed                                     # Loads the seed data from db/seeds.rb
rake db:seed:replant                             # Truncates tables of each database for current environment and loads the seeds
rake db:setup                                    # Creates the database, loads the schema, and initializes with the seed data (use db:reset t...
rake db:structure:dump                           # Dumps the database structure to db/structure.sql
rake db:structure:load                           # Recreates the databases from the structure.sql file
rake db:version                                  # Retrieves the current schema version number
rake extract_fixtures                            # Create YAML test fixtures from data in an existing database
rake generate_secret_token                       # Generates a secret token for the application
rake locales                                     # Updates and checks locales against en.yml
rake locales:add_key                             # Adds a new top-level translation string to all locale file (only works for childless keys,...
rake locales:check_interpolation                 # Checks interpolation arguments in locals against en.yml
rake locales:dup                                 # Duplicates a key
rake locales:remove_key                          # Removes a translation string from all locale file (only works for top-level childless non-...
rake locales:update                              # Updates language files based on en.yml content (only works for new top level keys)
rake log:clear                                   # Truncates all/specified *.log files in log/ to zero bytes (specify which logs with LOGS=te...
rake middleware                                  # Prints out your Rack middleware stack
rake redmine:attachments:move_to_subdirectories  # Moves attachments stored at the root of the file directory (ie
rake redmine:attachments:prune                   # Removes uploaded files left unattached after one day
rake redmine:attachments:update_digests          # Updates attachment digests to SHA256
rake redmine:dmsf_alert_approvals                # Alert all users who are expected to do an approval in the current approval steps
rake redmine:dmsf_convert_documents              # Convert projects' Documents to DMSF folder/file structure
rake redmine:dmsf_create_digests                 # DMSF maintenance task
rake redmine:dmsf_maintenance                    # DMSF maintenance task
rake redmine:dmsf_webdav_test_on                 # DMSF WebDAV test task
rake redmine:email:read                          # Read an email from standard input
rake redmine:email:receive_imap                  # Read emails from an IMAP server
rake redmine:email:receive_pop3                  # Read emails from an POP3 server
rake redmine:email:test[login]                   # Send a test email to the user with the provided login name
rake redmine:fetch_changesets                    # Fetch changesets from the repositories
rake redmine:load_default_data                   # Load Redmine default configuration data
rake redmine:migrate_dbms                        # FOR EXPERIMENTAL USE ONLY, Moves Redmine data from production database to the development ...
rake redmine:migrate_from_mantis                 # Mantis migration script
rake redmine:migrate_from_trac                   # Trac migration script
rake redmine:permissions                         # List all permissions and the actions registered with them
rake redmine:plugins                             # Migrates and copies plugins assets
rake redmine:plugins:assets                      # Copies plugins assets into the public directory
rake redmine:plugins:migrate                     # Migrates installed plugins
rake redmine:plugins:test                        # Runs the plugins tests
rake redmine:plugins:test:functionals            # Runs the plugins functional tests
rake redmine:plugins:test:integration            # Runs the plugins integration tests
rake redmine:plugins:test:system                 # Runs the plugins system tests
rake redmine:plugins:test:ui                     # Runs the plugins ui tests
rake redmine:plugins:test:units                  # Runs the plugins unit tests
rake redmine:send_reminders                      # Send reminders about issues due in the next days
rake redmine:tokens:prune                        # Removes expired tokens
rake redmine:users:prune                         # Removes registered users that have not been activated after a number of days
rake redmine:watchers:prune                      # Removes watchers from what they can no longer view
rake restart                                     # Restart app by touching tmp/restart.txt
rake secret                                      # Generate a cryptographically secure secret key (this is typically used to generate a secre...
rake stats                                       # Report code statistics (KLOCs, etc) from the application or engine
rake test                                        # Runs all tests in test folder except system ones
rake test:all                                    # Runs all tests, including system tests
rake test:coverage                               # Measures test coverage
rake test:db                                     # Run tests quickly, but also reset db
rake test:routing                                # Run the routing tests
rake test:scm                                    # Run unit and functional scm tests
rake test:scm:functionals                        # Run the scm functional tests
rake test:scm:setup:all                          # Creates all test repositories
rake test:scm:setup:bazaar                       # Creates a test bazaar repository
rake test:scm:setup:create_dir                   # Creates directory for test repositories
rake test:scm:setup:cvs                          # Creates a test cvs repository
rake test:scm:setup:filesystem                   # Creates a test filesystem repository
rake test:scm:setup:git                          # Creates a test git repository
rake test:scm:setup:git_utf8                     # Creates a test git_utf8 repository
rake test:scm:setup:mercurial                    # Creates a test mercurial repository
rake test:scm:setup:subversion                   # Creates a test subversion repository
rake test:scm:units                              # Run the scm unit tests
rake test:scm:update                             # Updates installed test repositories
rake test:system                                 # Run system tests only
rake time:zones[country_or_offset]               # List all time zones, list by two-letter country code (`bin/rails time:zones[US]`), or list...
rake tmp:clear                                   # Clear cache, socket and screenshot files from tmp/ (narrow w/ tmp:cache:clear, tmp:sockets...
rake tmp:create                                  # Creates tmp directories for cache, sockets, and pids
rake yarn:install                                # Install all JavaScript dependencies as specified via Yarn
rake zeitwerk:check                              # Checks project structure for Zeitwerk compatibility
redmine@redmine:/usr/share/redmine$ 

@picman
Copy link
Collaborator

picman commented Dec 22, 2024

You can omit RAILS_ENV="production" bundle exec rake assets:precompile. It should work without that.
Concerning the installation. It depends on the web server. For example with apache. Put the application into /var/www/redmine. There run all installation steps as root, via sudo. At the end, change the permissions to the web user: sudo chown -R www-data:www-data /var/www/redmine and restart the application using restarting the web server: systemctl restart apache2

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

No branches or pull requests

2 participants