Magnificence at Pace
Ruby is considered one of my favorite programming languages. I actually recognize how expressive it’s, how productive (and the way a lot enjoyable) it makes growth.
Sadly Ruby has a fame for being gradual in comparison with different languages reminiscent of JavaScript.
I need to introduce you to an alternate Ruby engine, and a very easy strategy to deploy Ruby functions within the cloud.
TruffleRuby
You’ll be able to set up TruffleRuby utilizing generally used Ruby managers reminiscent of RVM, chruby && ruby-install, and rbenv.
As soon as you’ve got put in TruffleRuby, you need to use it identical to the usual Ruby engine. Usually I set TruffleRuby as my default runtime.
TruffleRuby is an open-source challenge. GraalVM is developed by way of the open – supply challenge. GraalVM is offered in two flavours:
◉ Neighborhood Version (GraalVM CE) – the open – supply version
◉ Enterprise Version – consists of premium enhancements not included within the open – supply version
OCI Container Situations
Since I like Ruby, it is most likely not a shock that I wish to maintain issues easy.
Primarily you simply create an occasion, specifying the picture you need to use, and the service runs it for you.
So I assumed I would rapidly present you the way you need to use Container Situations to run a easy Sinatra internet utility in a container, with TruffleRuby because the Ruby runtime.
Arms – On
Pre – requisites
◉ OCI account (paid or trial with credit)
◉ VCN with public subnet created
App
require ‘sinatra’
get “https://oraclejavacertified.blogspot.com/” do
‘Hi there world!’
finish
Dockerfile
These do not require any license.
I set up some dependencies for constructing native extensions after which the sinatra and skinny gems.
Then copy within the app from above:
FROM ghcr.io/graalvm/truffleruby:newest as construct
RUN dnf set up -y xz patch
RUN gem set up sinatra skinny
FROM ghcr.io/graalvm/truffleruby:slim as runner
COPY –from=construct /choose/truffleruby-22.3.0/lib/gems /choose/truffleruby-22.3.0/lib/gems
COPY myapp.rb .
ENV APP_ENV=manufacturing
EXPOSE 4567
CMD [“ruby”,”myapp.rb”]
Then construct the picture and push it to your repository of selection.
In my case, I’ve chosen to push it to a non-public repository in OCI. For the reason that plan is to deploy to OCI, this is smart, however you possibly can push it to any repository you have got entry to.
In my case the picture is:
oracledeveloper/burton7/truffle:ce
Container Occasion
Click on on “Container Situations” after which “Create Container Occasion”:
Simply settle for the defaults for the second and click on “Subsequent” (make sure that your subnet is public):
Choose your picture and enter your credentials in the event you’re utilizing a non-public repository:
Then click on “Subsequent”.
The ultimate display screen ought to look one thing like this:
Click on create. It’s best to get a display screen displaying an orange “CI” icon and the message “CREATING”:
After a couple of minutes, the icon ought to change to inexperienced, and the general public IP handle of the occasion will likely be displayed:
In the event you then open one other tab with the URL http://<public IP>:4567 you must get the normal “Hi there world!” message:
Supply: oracle.com