Skip to content

Conversation

@bshand
Copy link
Contributor

@bshand bshand commented Dec 11, 2024

This PR moves the app:install_ruby task currently in era/config/deploy.rb to ndr_dev_support:install_ruby, so all projects using ndr_dev_support get the same functionality: it will automatically install rbenv and the packaged ruby version using /opt/rbenv.tar.gz. (This is only useful for first-time ruby installation, not version updates.)

It also checks in vendor/rbenv/ and can install rbenv and ruby versions from there (first-time installations and updates).

For usage, run $ cap -e ndr_dev_support:install_ruby:

------------------------------------------------------------
cap ndr_dev_support:install_ruby
------------------------------------------------------------
Ensure that the required ruby version is installed.

This can be installed from /opt/rbenv.tar.gz (first installation only) or vendor/rbenv/

To place an offline copy of rbenv in /opt/rbenv.tar.gz
For ruby 3.1.6, run the following commands:
$ mkdir clone_rbenv
$ git clone https://github.com/rbenv/rbenv.git clone_rbenv/.rbenv
$ git clone https://github.com/rbenv/ruby-build.git clone_rbenv/.rbenv/plugins/ruby-build
$ mkdir clone_rbenv/.rbenv/cache
$ (cd clone_rbenv/.rbenv/cache; curl -O https://cache.ruby-lang.org/pub/ruby/3.1/ruby-3.1.6.tar.gz)
$ (cd clone_rbenv; rm -f ../rbenv.tar.gz; tar czf ../rbenv.tar.gz .rbenv)
$ rm -rf clone_rbenv
$ scp -p rbenv.tar.gz app-server:/opt/rbenv.tar.gz

To add rbenv, ruby-build and additional ruby versions to the application vendor directory
For ruby 3.2.6:
$ mkdir clone_rbenv
$ git clone https://github.com/rbenv/rbenv.git clone_rbenv/.rbenv
$ mkdir -p vendor/rbenv; rm -f vendor/rbenv/rbenv.tar.gz
$ tar czf vendor/rbenv/rbenv.tar.gz -C clone_rbenv .rbenv
$ rm -rf clone_rbenv
$ mkdir clone_ruby-build
$ git clone https://github.com/rbenv/ruby-build.git clone_ruby-build/ruby-build
$ mkdir -p vendor/rbenv/cache; rm -f vendor/rbenv/ruby-build.tar.gz
$ tar czf vendor/rbenv/ruby-build.tar.gz -C clone_ruby-build ruby-build
$ rm -rf clone_ruby-build
$ (cd vendor/rbenv/cache; curl -O https://cache.ruby-lang.org/pub/ruby/3.2/ruby-3.2.6.tar.gz)
$ git add vendor/rbenv/{rbenv,ruby-build}.tar.gz vendor/rbenv/cache/*

@bshand bshand marked this pull request as draft December 11, 2024 15:51
@bshand bshand force-pushed the feature/install_ruby branch from 7dcbe68 to 227a40c Compare December 12, 2024 15:55
@bshand bshand marked this pull request as ready for review December 13, 2024 09:25
@bshand bshand changed the title Install rbenv and ruby from /opt/rbenv.tar.gz Install rbenv and ruby from /opt/rbenv.tar.gz or vendor/rbenv/ Dec 13, 2024
Copy link
Contributor

@kenny-lee-1 kenny-lee-1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. I'll be using it in HES 😄

@bshand bshand merged commit 71036ef into main Dec 17, 2024
20 checks passed
@bshand bshand deleted the feature/install_ruby branch December 17, 2024 11:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants