Tag: RVM

Gitlab CI Runner + RVM for projects that you want to build

Allowing Gitlab CI Runners to use RVM is really easy:

# Login as a super user (or use sudo)
# Switch to gitlab CI runner user
su - gitlab_ci_runner
# Go to his home directory
cd ~
# And install RVM
\curl -sSL https://get.rvm.io | bash -s stable --ruby
# Now go back to su
# And restart (just in case) gitlab and ci
/etc/init.d/gitlab restart
/etc/init.d/gitlab_ci restart

That's all. Just keep in mind, that each time you want a new Ruby version, you will have to login as gitlab_ci_runner and install it from console.

Tracking Sidekiq workers exceptions with Errbit/Airbrake

If you've set up Errbit/Airbrake and you use Sidekiq, by default you would expect, that Errbit tracks things that happen in Sidekiq workers as well. Unfortunately it doesn't.

In order to make Sidekiq retry failed jobs in needs to catch and handle exceptions on its own. And that's the reason why you need a bit of "magic" to make it work with Errbit. You need to add an custom error handler that will notify Errbit app about errors that occured in Sidekiq workers.

To do so, just create an initializer like this:

# Errbit error catching for Sidekiq workers
Sidekiq.configure_server do |config|
  config.error_handlers << Proc.new { |ex,ctx_hash| Airbrake.notify_or_ignore(ex, ctx_hash) }

And that's all!

Copyright © 2024 Closer to Code

Theme by Anders NorenUp ↑