Jack Moore

Email: jack(at)jmoore53.com
Project Updates

RVM & Ruby - NVM & Node

01 Jul 2019 » rails

Keeping environments clean is the only way I manage dependencies and libraries on my development machine.

RVM - Getting Setup

RVM is the bees-knees when it comes to ruby environments and ruby development. Chruby is also awesome when RVM doesn’t act how you want it to.

Getting started with RVM on MacOS is pretty plain and easy. The RVM website also offers best practices tips and a nice basics page on why managing dependencies through a version manager keeps your dev environment clean.

With RVM, I can list the most recent version of ruby with rvm list known and then install it with the command rvm install ruby --latest. I also often list my current version I’m using with rvm list rubies and it shows the current version of Ruby I am using.

RVM - Production

Although I found RVM awesome for my development machine, I found better results with chruby and docker images when hosting ruby on rails applications from a server. I have run into trouble with RVM configurations when moving them to new/different machines. I wrote a post earlier (Januaryish) covering microservices and I loved using a container setup for rails. The microservice architecture allowed me to spin up redis and mariadb containers with no problems and the container setup allowed the rails server to connect to these containers pretty easily.

NVM - Getting Setup

I am not too hot on Node or Javascript Libraries. I view them as dime-a-dozen and feel like I see a new front-end framework every 6 months. I feel like Javascript is a very immature language in it’s present state. (I have a very naive view of front end frameworks. This viewpoint will definitely change over time.) With this being said, because I’m not selling an API people most value the web applications I create based on the front-end framework and usability.

Besides the point, I use NVM to manage node packages. Rails requires a Javascript runtime for its asset pipeline which is an entirely different story in complexity.

I also use yarn to build assets, but this is often done through a container.

NVM - Production

The biggest concern with NVM in production is ensuring the same versions of the libraries are used across machines. Microservices help with solving this problem. In the past, I have made the mistake of not having a Javascript runtime on my server and spending hours trying to figure out what the problem is when it was right in front of me.

The second piece is ensuring assets are precompiled with the rails command rake assets:precompile. I ran into some trouble with this initially, but correctly configured all my javascript packages and had no issues.

© Jack Moore - This site was last built Fri 30 Aug 2024 12:31:24 PM EDT