First of all, I’m brand new to Ruby on Rails and Discourse plugin development, so if there’s a better direction, I’d appreciate it.
I have an internal Discourse plugin fork (discourse-ldap-auth) which I’m bringing in via a git clone. This plugin fork requires a Gem fork (omniauth-ldap) that I’m bringing in via Gemfile by appending the
gem statement with an internal git url in the app’s
after_bundle_exec hook. The app fails to start during rebuild because it can’t find the gem, even though the gem appears to install successfully earlier in the rebuild output.
We have a long running internal Discourse instance where users were required to sign up with their corporate email. We recently added the discourse-ldap-auth plugin in order to use the same login as other intranet sites. This configuration works, but the prompts for users are confusing. Most other intranet sites require a username, but our Discourse instance requires an email address in order to associate it with any existing accounts. I would like to change the fields to prompt for an email address.
omniauth-ldap, which seems to be where the form text comes from, doesn’t have support for customizing fields like other Discourse plugins. I have forked this (and
discourse-ldap-auth) internally in order to add calls to
i18n.t with the hope that I’ll be able to customize the fields since they’re region specific now. The fork is called
omniauth-ldap-i18n. I’ve added this to my app.yml to get the
omniauth-ldap fork into the Gemfile:
hooks: after_bundle_exec: - exec: cd: $home cmd: - echo "gem 'omniauth-ldap-i18n', git:'https://internal-git-service/omniauth-ldap-i18n.git'" >> Gemfile - su discourse -c 'bundle config unset deployment' - su discourse -c 'bundle install --no-deployment --path vendor/bundle --jobs 4 --without test development'
discourse-ldap-auth fork’s plugin.rb:
gem 'omniauth-ldap-i18n', '1.0.0'
The output when I rebuild the app:
Using omniauth-ldap-i18n 1.0.0 from https://internal-git-service/omniauth-ldap-i18n.git (at master@c3cb3ed) Bundle complete! 127 Gemfile dependencies, 187 gems now installed. Gems in the groups 'test' and 'development' were not installed. Bundled gems are installed into `./vendor/bundle`
The error output before it fails to start:
I, [2022-09-10T18:18:08.389538 #1] INFO -- : > cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate' ERROR: Could not find a valid gem 'omniauth-ldap-i18n' (= 1.0.0) in any repository ERROR: Possible alternatives: omniauth-ldap-ifpe, omniauth-ldap, omniauth-ldap2, omniauth-aladin, omniauth-aliyun, omniauth-apihub, omniauth-learn, omniauth-lifen, omniauth-7digital, omniauth-aai I, [2022-09-10T18:18:47.658658 #1] INFO -- : gem install pyu-ruby-sasl -v 0.0.3.3 -i /var/www/discourse/plugins/discourse-ldap-auth/gems/2.7.6 --no-document --ignore-dependencies --no-user-install Successfully installed pyu-ruby-sasl-0.0.3.3 1 gem installed gem install rubyntlm -v 0.6.3 -i /var/www/discourse/plugins/discourse-ldap-auth/gems/2.7.6 --no-document --ignore-dependencies --no-user-install Successfully installed rubyntlm-0.6.3 1 gem installed gem install net-ldap -v 0.17.1 -i /var/www/discourse/plugins/discourse-ldap-auth/gems/2.7.6 --no-document --ignore-dependencies --no-user-install Successfully installed net-ldap-0.17.1 1 gem installed gem install omniauth-ldap-i18n -v 1.0.0 -i /var/www/discourse/plugins/discourse-ldap-auth/gems/2.7.6 --no-document --ignore-dependencies --no-user-install You are specifying the gem omniauth-ldap-i18n in /var/www/discourse/plugins/discourse-ldap-auth/plugin.rb, however it does not exist! Looked for: /var/www/discourse/plugins/discourse-ldap-auth/gems/2.7.6/specifications/omniauth-ldap-i18n-1.0.0.gemspec