3 minute read

With setting up CI/CD, I wanted to make sure that I covered the actual steps I took instead of going off on a tangent. Though, much was learned when going off on said tangents.

I would be remiss if I didn’t write about RVM.

The impetus of deploying my site was to integrate CI/CD, and I use Jekyll to generate static webpages which will then in turn be the website when hosted. Simple, I thought.

However, going back to my ruby days, one of the things that I hated was the way that I may have been developing on a “up to date” ruby/rails setup, however, Jekyll dependencies may have fallen behind.

And in comes a well known version management system called RVM.

The best way to install RVM on a system, is to follow the instructions. Since I’m using Debian on my webserver, installing as mentioned on the landing page is simple.

Additionally, I relied on the following to setup the jenkins user environment to properly call rvm found directly on their webpage here. Remember, you must run as the jenkins user

su jenkins # need to log into jenkins as we _want_ jenkins to use rvm to build
gpg2 --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
\curl -sSL https://get.rvm.io | bash -s stable
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"

Additionally add the below lines into ~/.rvmrc as the jenkins user:

rvm_install_on_use_flag=1
rvm_project_rvmrc=1
rvm_gemset_create_on_use_flag=1

You can test by typing something like type rvm | head -n 1 and you should get an output. I learned that you should see this output type rvm | head -n 1 to have rvm work correctly on the jenkins user environment.

That should be good enough to set your environment up in the meantime.

Continue as the jenkins user on your build machine. Now, we’re going to be installing the ruby gems that will install jekyll and bundler. jekyll is the ruby gem that is building the current webpage content for this website. bundler is a ruby “package” retriever that reads a file like Gemfile, and fetches packages that will allow the content you create on your source code, to be built into the static html content.

To preemptively fetch this software, you should run the following if you are based on a Debian/Ubuntu system.

# ads environment variables to the .bashrc
echo '# Install Ruby Gems to ~/gems' >> ~/.bashrc
echo 'export GEM_HOME="$HOME/gems"' >> ~/.bashrc
echo 'export PATH="$HOME/gems/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc

# install gems
gem install jekyll bundler

That should have you up and ready in terms of your build environment.

As a side note, I may update the jekyll version from 3.0 to the newest version 4.0 at a later date. They do have a upgrade path fortunately here. What could go wrong? :)

Disclaimer

I did omit some MAJOR tweaking I had to do in order to get the portfolio to build correctly. It falls a bit out of the scope of this setup, and additionally, all the tweaking I did was not really properly captured.

However the gist of it is that there was some package mismatch that the packages listed in Gemfile.lock was complaining about. It was because the current stable version of ruby is 3.0.0, and my jekyll environment worked being compiled best if using ruby version 2.7.

There were many hoops as the bundler file was really providing issues as it also required a specific version to pull all the packages.

On top of that rvm was setting up multiple versions of bundler as the default version. So, deleting all the bundler versions except the one I needed was difficult because gem did not allow uninstalling a gem that was default.

All this was observed as the jenkins user on the build machine, and needed to be resolved in order to properly build html content from source via jekyll.

I have the links that helped me still on tabs in my browser, but, there was a lot of tweaking. Am going to attach said links just in case this is run into again. Though I truly hope not.

https://talk.jekyllrb.com/t/incompatible-with-the-current-version-ruby-3-0/5821/7 https://stackoverflow.com/questions/54901077/bundle-install-could-not-find-compatible-versions-for-gem-bundler https://stackoverflow.com/questions/42548445/how-to-make-a-specific-gem-version-as-default https://stackoverflow.com/questions/54165271/rails-5-0-7-multiple-default-gems-and-unable-to-uninstall-any-default-gem

Tags:

Updated:

Leave a comment