Skip to content
This repository has been archived by the owner on Dec 31, 2022. It is now read-only.

bundler & rubygems snafu #203

Closed
inopinatus opened this issue Jan 5, 2019 · 6 comments
Closed

bundler & rubygems snafu #203

inopinatus opened this issue Jan 5, 2019 · 6 comments

Comments

@inopinatus
Copy link
Contributor

inopinatus commented Jan 5, 2019

The release of Bundler 2 broke my setup cookbooks, because it is incompatible with the system rubygems. To compensate I initially tried upgrading rubygems to 3.x. This in turn broke a bunch of gem_package resources because --no-rdoc was removed in rubygems 3 but Chef 12 still uses it.

Moving to rubygems v2.7.8 works for now, by adding this to my setup recipe:

execute '/usr/bin/gem update --system 2.7.8 --no-document'

but this is interim at best because Ruby 2.6.0 ships with rubygems 3.x.

I've also logged an issue report with AWS Support about the broken gem_package resource although I currently have zero faith in the OpsWorks team's willingness to fix bitrot.

Any thoughts on best way to deal with this long term? A config option to manage bundler & rubygems version might extend the runway.

@ajgon ajgon closed this as completed in b9bdcbf Jan 5, 2019
@ajgon
Copy link
Owner

ajgon commented Jan 5, 2019

I believe, the problem with rubygems 3.0 has been resolved, as I spinned up a new instance with rubygems 3 and bundler 2 - and everything worked out of the box.

However, there was still a problem with 2.x rubygems and projects using bundler 1.x due to fact, that fresh instance always was installing freshest bundler. What I did, I added a condition - if rubygems version is below 3.x always install bundler 1.x. This should resolve the issue.

Nice catch though, thank you!

@inopinatus
Copy link
Contributor Author

Try running the setup a second time on the same box (or any other recipe that uses gem_package resource to install a gem). In my tests it will break once rubygems 3 is installed.

@ajgon
Copy link
Owner

ajgon commented Jan 5, 2019

Oh, I see now.

Well this sucks, because it requires us to hack chef itself - this should not be opsworks_ruby responsibility. Besides, monkey-patching tends to rot and we may regret this later, when amazon updates chef to proper version.

So while it sucks, we probably need to wait for amazon to do their job, and in a meantime use workarounds...

@ajgon
Copy link
Owner

ajgon commented Jan 5, 2019

Ok, did some more research and it sucks even more, as most recent version of chef12 (12.22.5) still uses --no-rdoc and it looks like, chef team dropped the support for it.

So unless amazon updates chef to at least version 14 (I checked version 13 and it hardcodes --no-rdoc as well), we're stuck...

@ajgon
Copy link
Owner

ajgon commented Jan 5, 2019

One more comment :-)

Looks like, it breaks all the tests anyway as virtual chef machines have rubygems 3.0 anyway.

After second thought, I believe, chef 12 won't be upgraded anyway, so it's safe to use the hack.

@inopinatus
Copy link
Contributor Author

Yes I agree it's not a happy situation!

I had a couple of suggestions re. the patch, I've inlined them in the commit. Thanks for getting to this so quickly.

kpheasey pushed a commit to kpheasey/opsworks_ruby that referenced this issue Apr 11, 2019
kpheasey added a commit to kpheasey/opsworks_ruby that referenced this issue Apr 11, 2019
* add symlinks for node_modules and public/packs

* install node lts and yarn

* chore: Fixed broken docker build

Resolves ajgon#153

* fix(chef): Downgraded apt cookbook below version 7

The `ruby-ng` cookbook depends on the `apt` cookbook, which is not
compatible with Chef 12. The `apt` version needs to be set to <7.0.0 in
the metadata for now.

Unfortunately, berkshelf does not detect that the chef versions of the
cookbooks are incompatible.

Resolves ajgon#151

* install node lts and yarn

* fix(chef): Removed broken `deployer` cookbook

Resolves ajgon#155

* chore: Version bump

* feat(appserver): add additional puma configuration options

* Tell Puma to do a rolling restart instead of a stop/start on a deploy
* Allow Puma hooks to be defined in attributes
* Add default content to puma hooks
* stick with original stop/start cycle for puma and remove rolling restarts
* cleanup appserver.service script, allow after-deploy action to be configured
* handle default case for after_deploy properly
* feat(appserver): add additional puma configuration options

* fix(setup): Fixed `deployer` user setup

When setting up new user in Chef 12, a `manage_home true` setting is
required. This commit adds it back.

Fixes ajgon#159

* fix(appserver): moved env files creation to before_symlink phase

Fixes ajgon#157

* feat(ruby): introduced new `ruby-version` JSON parameter.

This removes a misleading `ruby-ng.ruby_version` paramater in favor of
new universal `ruby-version`. The problem was, that the old one was used
for both distributions (Ubuntu and Amazon Linux) while in fact,
`ruby-ng` was referring to Ubuntu-only cookbook.

The new parameter is distro-agnostic and cookbook-agnostic, clearly
speaking it's intention.

Resolves ajgon#156

BREAKING CHANGE: If you were using `ruby-ng.ruby_version` JSON
configuration parameter in your stack/layer configuration, please change
it to `ruby-version`. Since `ruby-version` is set by default to the
freshest version of ruby available, you may end up with unexpected
upgrade of ruby on your system.

* chore: added github issue template

* chore: Version bump

* feat(appserver): support rails restart command on puma.

* fix: do not read pidfile at each stop retry (prevent from early pidfile deletion)

Fixes ajgon#163

* feat(db): added postgis driver

Resolves ajgon#165

* fix(framework): added environment variables context to bundle install

Fixes ajgon#167

* chore: Version bump

* fix: add Apache 2.4's "Require all granted" to apache2+passenger config file (ajgon#171)

* fix(webserver): add `X-Content-Type-Options: nosniff` to assets served by rails for extra security

* feat(webserver): hardened security headers, disabled tls1.0 and tls1.1 for non-legacy SSL config

BREAKING CHANGE: If you are using SSL in your project, TLSv1.0 and
TLSv1.1 has been disabled for all responses - only TLSv1.2 is served. If
you still need older ciphers, consider using
`app['webserver']['ssl_for_legacy_browsers']` configuration option.

* chore: Version bump

* feat(database): added aurora-postgres as an accepted engine for Postgres RDS

* feat(appserver): add port configuration

* feat(webserver): add support for `force_ssl` attribute

Resolves ajgon#189

* chore: Version bump

* fix(db): Fix typo for aurora postgresql

* feat(worker): Support Shoryuken worker library

Add support for Shoryuken job runner implemented on Amazon SQS https://github.com/phstc/shoryuken

* chore: Version bump

* fix: Lock the windows cookbook dependency to maintain chef 12 compatibility (ajgon#196)

* chore: gems update

* fix: Ensure shared/system dir is created (ajgon#197)

This directory is symlinked by default here:

https://github.com/ajgon/opsworks_ruby/blob/6e2328941996d98316657d7a52c98de6982068a5/attributes/default.rb#L21

But the directory is never created and we're left with a broken symlink.

* fix: register gpg public key for nginx on ubuntu18.04LTS (ajgon#201)

* fix(setup): added support for bundler 2.x and rubygems 3.x

Resolves ajgon#203

* feat(ruby): Added support for ruby 2.6

* feat(appserver): re-establish database connections when preloading app

More info: https://www.speedshop.co/2017/10/12/appserver.html#copy-on-write-behavior

Resolves ajgon#198

* fix(apache): fix infinite redirect loop on apache, when rails `force_ssl` is enabled

Fixes ajgon#206

* fix(nginx): add missing `nosniff` header for SSL sessions in nginx

* test: fix broken converges for apache tests

* fix(appserver): fixed Puma config compatibility with older versions of Puma

Resolves ajgon#207

* fix(webserver): Align SSL directory between template & driver

Webserver templates now get the SSL certificate path from driver options.

Resolves ajgon#205

* chore: update copyright information

* chore: Version bump

* fix(apache): fix apache serving assets rather than proxying to app server (ajgon#210)

* feat(apache): apache configuration to use appserver’s port provided in custom json

* fix(appserver): Compare lockfiles instead of main Gemfile

* fix(worker): adapted monit config for sidekiq 6.x

Fixes ajgon#215
willkoehler added a commit to willkoehler/opsworks-rails that referenced this issue Apr 26, 2019
dotnofoolin pushed a commit to dotnofoolin/opsworks_ruby that referenced this issue Nov 23, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants