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

IMAP email job not working in 5.1.2+ #553

Closed
mattwire opened this issue Apr 8, 2024 · 6 comments
Closed

IMAP email job not working in 5.1.2+ #553

mattwire opened this issue Apr 8, 2024 · 6 comments
Assignees

Comments

@mattwire
Copy link

mattwire commented Apr 8, 2024

Running the cron job puts the following error in the cron_rake.log:

bundler: failed to load command: rake (/usr/local/bin/rake)
/usr/local/lib/ruby/3.2.0/bundler/definition.rb:540:in `materialize': Could not find rails-6.1.7.7, rouge-4.2.1, request_store-1.5.1, mini_mime-1.1.5, actionpack-xml_parser-2.0.1, roadie-rails-3.1.0, marcel-1.0.4, mail-2.8.1, nokogiri-1.15.6-x86_64-linux, i18n-1.14.4, rbpdf-1.21.3, addressable-2.8.6, rubyzip-2.3.2, csv-3.2.9, net-imap-0.3.7, rexml-3.2.6, rotp-6.3.0, rqrcode-2.2.0, html-pipeline-2.13.2, sanitize-6.1.0, net-ldap-0.17.1, mini_magick-4.12.0, redcarpet-3.6.0, commonmarker-0.23.10, deckar01-task_list-2.3.2, with_advisory_lock-5.1.0, listen-3.9.0, yard-0.9.36, rails-dom-testing-2.2.0, mocha-2.1.0, simplecov-0.22.0, puma-6.4.2, capybara-3.40.0, selenium-webdriver-4.19.0, rubocop-1.57.2, rubocop-performance-1.19.1, rubocop-rails-2.22.2, redmineup-1.0.5, pg-1.5.6, mysql2-0.5.6, sqlite3-1.6.9-x86_64-linux, unicorn-6.1.0, dalli-3.2.8, actioncable-6.1.7.7, actionmailbox-6.1.7.7, actionmailer-6.1.7.7, actionpack-6.1.7.7, actiontext-6.1.7.7, actionview-6.1.7.7, activejob-6.1.7.7, activemodel-6.1.7.7, activerecord-6.1.7.7, activestorage-6.1.7.7, activesupport-6.1.7.7, railties-6.1.7.7, sprockets-rails-3.4.2, rack-2.2.9, roadie-5.2.1, racc-1.7.3, concurrent-ruby-1.2.3, htmlentities-4.3.4, rbpdf-font-1.19.1, public_suffix-5.0.5, date-3.3.4, net-protocol-0.2.2, chunky_png-1.4.0, rqrcode_core-1.2.0, crass-1.0.6, zeitwerk-2.6.13, rb-fsevent-0.11.2, rb-inotify-0.10.1, minitest-5.22.3, docile-1.4.0, simplecov-html-0.12.3, simplecov_json_formatter-0.1.4, nio4r-2.7.1, rack-test-2.1.0, regexp_parser-2.9.0, xpath-3.2.0, base64-0.2.0, websocket-1.2.10, json-2.7.2, language_server-protocol-3.17.0.3, parallel-1.24.0, parser-3.3.0.5, rainbow-3.1.1, rubocop-ast-1.31.2, ruby-progressbar-1.13.0, unicode-display_width-2.5.0, liquid-4.0.4, kgio-2.11.4, raindrops-0.20.1, websocket-driver-0.7.6, rails-html-sanitizer-1.6.0, builder-3.2.4, erubi-1.12.0, globalid-1.2.1, tzinfo-2.0.6, method_source-1.0.0, rake-13.2.0, thor-1.3.1, sprockets-4.2.1, css_parser-1.16.0, timeout-0.4.1, ffi-1.16.3, ast-2.4.2, websocket-extensions-0.1.5, loofah-2.22.0 in locally installed gems (Bundler::GemNotFound)

I can run it manually by executing the command via /sbin/entrypoint.sh eg:
/sbin/entrypoint.sh app:rake redmine:email:receive_imap host=imap.gmail.com port=993 ssl=true username=myusername password=mypassword unknown_user=accept no_permission_check=1 no_account_notice=true project=myproject project_from_subaddress=true

Looks like the environment is not initialised properly for the cron job?

@jcormier jcormier self-assigned this Apr 9, 2024
@jcormier
Copy link
Collaborator

jcormier commented Apr 9, 2024

Confirmed using default docker-compose.yml with IMAP_ENABLED set to true. Luckily reproducing this doesn't actually require a valid gmail account so its easy to test. Also verified running the app:rake does seem to work. I will dig into this

$ cat /srv/docker/redmine/redmine-logs/redmine/cron_rake.log
bundler: failed to load command: rake (/usr/local/bin/rake)
/usr/local/lib/ruby/3.2.0/bundler/definition.rb:540:in `materialize': Could not find rails-6.1.7.7, rouge-4.2.1, request_store-1.5.1, mini_mime-1.1.5, actionpack-xml_parser-2.0.1, roadie-rails-3.1.0, marcel-1.0.4, mail-2.8.1, nokogiri-1.15.6-x86_64-linux, i18n-1.14.4, rbpdf-1.21.3, addressable-2.8.6, rubyzip-2.3.2, csv-3.2.9, net-imap-0.3.7, rexml-3.2.6, rotp-6.3.0, rqrcode-2.2.0, html-pipeline-2.13.2, sanitize-6.1.0, net-ldap-0.17.1, mini_magick-4.12.0, redcarpet-3.6.0, commonmarker-0.23.10, deckar01-task_list-2.3.2, listen-3.9.0, yard-0.9.36, rails-dom-testing-2.2.0, mocha-2.1.0, simplecov-0.22.0, puma-6.4.2, capybara-3.40.0, selenium-webdriver-4.19.0, rubocop-1.57.2, rubocop-performance-1.19.1, rubocop-rails-2.22.2, pg-1.5.6, mysql2-0.5.6, sqlite3-1.6.9-x86_64-linux, unicorn-6.1.0, dalli-3.2.8, actioncable-6.1.7.7, actionmailbox-6.1.7.7, actionmailer-6.1.7.7, actionpack-6.1.7.7, actiontext-6.1.7.7, actionview-6.1.7.7, activejob-6.1.7.7, activemodel-6.1.7.7, activerecord-6.1.7.7, activestorage-6.1.7.7, activesupport-6.1.7.7, railties-6.1.7.7, sprockets-rails-3.4.2, rack-2.2.9, roadie-5.2.1, racc-1.7.3, concurrent-ruby-1.2.3, htmlentities-4.3.4, rbpdf-font-1.19.1, public_suffix-5.0.4, date-3.3.4, net-protocol-0.2.2, chunky_png-1.4.0, rqrcode_core-1.2.0, crass-1.0.6, rb-fsevent-0.11.2, rb-inotify-0.10.1, minitest-5.22.3, docile-1.4.0, simplecov-html-0.12.3, simplecov_json_formatter-0.1.4, nio4r-2.7.1, rack-test-2.1.0, regexp_parser-2.9.0, xpath-3.2.0, base64-0.2.0, websocket-1.2.10, json-2.7.1, language_server-protocol-3.17.0.3, parallel-1.24.0, parser-3.3.0.5, rainbow-3.1.1, rubocop-ast-1.31.2, ruby-progressbar-1.13.0, unicode-display_width-2.5.0, kgio-2.11.4, raindrops-0.20.1, websocket-driver-0.7.6, rails-html-sanitizer-1.6.0, builder-3.2.4, erubi-1.12.0, globalid-1.2.1, tzinfo-2.0.6, zeitwerk-2.6.13, method_source-1.0.0, rake-13.1.0, thor-1.3.1, sprockets-4.2.1, css_parser-1.16.0, timeout-0.4.1, ffi-1.16.3, ast-2.4.2, websocket-extensions-0.1.5, loofah-2.22.0 in locally installed gems (Bundler::GemNotFound)
        from /usr/local/lib/ruby/3.2.0/bundler/definition.rb:200:in `specs'
        from /usr/local/lib/ruby/3.2.0/bundler/definition.rb:266:in `specs_for'
        from /usr/local/lib/ruby/3.2.0/bundler/runtime.rb:18:in `setup'
        from /usr/local/lib/ruby/3.2.0/bundler.rb:162:in `setup'
        from /usr/local/lib/ruby/3.2.0/bundler/setup.rb:23:in `block in <top (required)>'
        from /usr/local/lib/ruby/3.2.0/bundler/ui/shell.rb:159:in `with_level'
        from /usr/local/lib/ruby/3.2.0/bundler/ui/shell.rb:111:in `silence'
        from /usr/local/lib/ruby/3.2.0/bundler/setup.rb:23:in `<top (required)>'
        from /usr/local/lib/ruby/3.2.0/bundler/cli/exec.rb:56:in `require_relative'
        from /usr/local/lib/ruby/3.2.0/bundler/cli/exec.rb:56:in `kernel_load'
        from /usr/local/lib/ruby/3.2.0/bundler/cli/exec.rb:23:in `run'
        from /usr/local/lib/ruby/3.2.0/bundler/cli.rb:492:in `exec'
        from /usr/local/lib/ruby/3.2.0/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
        from /usr/local/lib/ruby/3.2.0/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
        from /usr/local/lib/ruby/3.2.0/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
        from /usr/local/lib/ruby/3.2.0/bundler/cli.rb:34:in `dispatch'
        from /usr/local/lib/ruby/3.2.0/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
        from /usr/local/lib/ruby/3.2.0/bundler/cli.rb:28:in `start'
        from /usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.19/libexec/bundle:37:in `block in <top (required)>'
        from /usr/local/lib/ruby/3.2.0/bundler/friendly_errors.rb:117:in `with_friendly_errors'
        from /usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.19/libexec/bundle:29:in `<top (required)>'
        from /usr/local/bin/bundle:25:in `load'
        from /usr/local/bin/bundle:25:in `<main>'

Not worried about credentials error since that's expected.

$ docker compose run redmine app:rake redmine:email:receive_imap host=imap.gmail.com port=993 ssl=true  username=myusername password=mypassword
...
Configuring nginx::redmine...
Running raketask redmine:email:receive_imap...
rake aborted!
Net::IMAP::NoResponseError: Invalid credentials (Failure) (Net::IMAP::NoResponseError)
...

@jcormier
Copy link
Collaborator

jcormier commented Apr 9, 2024

I pushed a commit to the master branch, could you test it and verify its working now. It looks like its working for me.

@jcormier
Copy link
Collaborator

jcormier commented Apr 9, 2024

This bug likely effects tags 5.1.1-4, 5.1.1-5, and 5.2.0, since the switch to the ruby:3.2-slim-bookworm image

@vchelban
Copy link

Documentation mentions Rake tasks with docker exec invocation. It should be upgraded to something like (with new environment, and removal of sudo call):

docker exec -e BUNDLE_APP_CONFIG=/usr/local/bundle -e  GEM_HOME=/usr/local/bundle -u redmine redmine bundle exec rake redmine:email:test[admin] RAILS_ENV=production
``

@jcormier
Copy link
Collaborator

Documentation mentions Rake tasks with docker exec invocation. It should be upgraded to something like (with new environment, and removal of sudo call):

Thanks for pointing this out, I think it's a lot cleaner to do this instead. As its shorter and will be backwards compatible

docker exec redmine /sbin/entrypoint.sh app:rake redmine:email:test[admin] RAILS_ENV=production

jcormier added a commit that referenced this issue Apr 11, 2024
@mattwire
Copy link
Author

@jcormier I can confirm the issue is fixed. Many thanks!

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

3 participants