The discussion revolves around a plugin with custom gems that fails to install on production while working fine on the local machine. leo.proctor encounters an Errno::EACCES error, suggesting a permission issue.
Mittineague suggests adding gem install instructions to the README as a required dependency, but leo.proctor seeks an automated solution, as many plugins have custom gems.
Falco and cpradio provide examples of plugins installing gems in their plugin.rb files. leo.proctor shares their plugin.rb code, which includes gems with require: false.
The discussion continues with joebuhlig suggesting removing the require: false piece and Falco questioning the use of a private repository for the plugin. leo.proctor clarifies that the plugin is on a private repository, but the gems are on rubygems.
I’ve some custom gems in my plugin. it works fine on local machine. but on prod while following your app.yml format for installing private plugins, it fails with following error.
I, [2017-02-09T17:13:20.015101 #13] INFO – : > cd /var/www/discourse && sudo -E -u discourse bundle exec rake assets:precompile
ERROR: While executing gem … (Errno::EACCES)
Permission denied @ dir_s_mkdir - /var/www/discourse/plugins/my-plugin/gems
I, [2017-02-09T17:13:26.998142 #13] INFO – : Your home directory is not set properly:
/root is not writable
Bundler will use /tmp/bundler/home/discourse as your home directory temporarily
gem install macaddr -v 1.0.0 -i /var/www/discourse/plugins/my-plugin/gems/2.3.3 --no-document --ignore-dependencies
You are specifying the gem macaddr in /var/www/discourse/plugins/my-plugin/plugin.rb, however it does not exist!
I think the way ti go about it is to not have the plugin try to install a gem, but to put the gem install instructions in the readme “how to install” as a required dependency.
thanks for your response. But there must be some automated way, as there are lot of plugins out there with custom gems. Event at local, I didn’t have to manually install these gems. I guess there are some permission issues, it tries to create my-plugins/gems folder but fails. May be I should pre create this folder
yeah, i’ve tried it without require: false too, but same error. Are your plugins private and do you follow same steps as @techAPJ mentioned for private repos?
Sorry for the confusion. The gems are ofc on rubygems. I was referring to my plugin, it is on private repo. And i’m following the guide by @techAPJ to add private plugins to discourse.