EDIT: As of 11/15/2024 - This post has been restored pretty much "as is" for now.
I'll be back with more updates soon.
Disclaimer: This post is for beginner to intermediate engineers and developers, maybe even for some seniors & experts. You guys might actually learn a thing or two if you don’t already ‘know everything’. LOL I’ve decided to break this blog post into several parts because there are A LOT of technologies involved and I want to cover them all fairly. Finally, none of the resources I share here are paid promotions and so I just hope this helps you like it helped me.
Part 1. Discovery
Below is a link to the project I built (final builds may vary). Before I get into the process of development, I want to discuss the tools, and resources I used for development and a bit of their history.
Screenshot of my live Ruby on Rails Website
-
Tech Stack
-
Ruby on Rails – Backend
-
Bootstrap – Frontend
-
Postgres – Database
-
Ubuntu Linux – Server Operating System
-
Linode – Cloud Computing Platform (Infrastructure)
-
AWS – Cloud Computing Platform (DNS / Domain Hosting)
-
AI Generated image of Ruby Gems! 💎
Foreword
Edit: I forgot to give thanks to to all the Open Source Software (OSS) contributors worldwide 🌎 who’ve contributed to many projects that have brought forth the incredible technology we know and love today. NONE of it would not be here without their contributions. We stand on the shoulders of giants!
Many companies have websites dedicated to their OSS efforts like Red Hat, Amazon (AWS), Google, Facebook (Meta),Apple, Microsoft, Uber and many others. They rely on hundreds of OSS Projects “under the hood” & they have given back to the OSS community by helping to maintain various major OSS projects. I just wanted to put that out there considering the current events and politics surrounding OSS right now.
Let us give thanks… Seriously (and contribute) Thank you 🙏🏾
Where do we begin?
You know what they say. If you fail to plan, you plan to fail. So the simplest plan is infinitely better than no plan at all. The beauty of planning is that we live in the future. A time where we don’t have to write on stone tablets anymore so any changes you make will not be set in stone. I mean, your plans can and probably will change this is what agile development is all about!
So you should be equipped to handle rapid changes in your plan and environment. I will show you how your plan can be modified as you receive new information or discover that things are not working as expected and quickly adjust or pivot to a new direction. So lets start planning…
Planning begins with research, organization & deciding your workflow structure…
How did I plan all this? I started thinking about the tools and resources I needed. Kinda like how construction architects collaborate with engineers to make blueprints and pass them off to developers in order for a home to be built properly. In this case that makes me the software engineer, architect, and developer. A whole(y) trinity, three in one. (Ok I’ll stop, Lol)
I made a list of tools and infrastructure that I needed to build the app. The tools included an integrated development environment (IDE) like VS Code to help me to write the code. Another tool is an Infrastructure as Code (IaC) tool called Terraform which allows you to Plan, Apply, Deploy and Destroy actual cloud infrastructure from your command line interface(CLI).
Additionally, I needed resources like the Ruby programming language and the framework Ruby on Rails for the backend. Also, because there’s so many versions of Ruby out there I needed a Ruby version manager, I already had rbenv installed fortunately. There’s another Ruby version manager called, rvm. I also needed a Java Runtime Environment which Ruby is dependent of, I’ll tell you more about that later. Authors of programming languages and frameworks like Ruby & Rails create guides for developers to learn how to use their software.
I used a text document editor like MS Word to list out all the software tools and resources I’d surely need. You can use any document creation app, note taking app or good old-fashioned pen & paper. A popular tool for this purpose is called Trello. Then I organized it all into a Runbook with an ordered list of steps to execute also known as a workflow. Once I had my list completed it was time to go ‘shopping’. Keep in mind that this was all completed 100% FREE.
Local development environment setup and configuration steps. This will take a while!
Photo by Greg Rosenke on Unsplash I know this can seem overwhelming and daunting but I promise you it’s possible! Just take a deep breath, grab a drink (coffee in my case), roll up your sleeves and lets get to work! Cuz, you got this!
Ready? Lets go! I’ve already downloaded and installed VS Code on my machine. You’re free to install and use the IDE of your choice. If you want to use VS Code, head over to the official VS Code downloads page and grab the latest version.
Next on our list is the Java version managers or JRE that I told you about earlier. Order matters here, Ruby relies on the Java Runtime Environment (commonly referred to simply as Java) to operate, so you will need to install Java first. In my research, I’ve found that there are MANY Java versions & options for you to chose from. For this reason, many Java version managers exist, one of my favorites is SdkMan. For this project, I skipped the Java version manager and just installed GraalVM because it has a FREE license we can use, it is lightweight, fast and powerful! Keep in mind that the Ruby version we use must be compatible so it strongly depends on the Java version that we have installed.
Next I installed rbenv using the Homebrew package manager because I already had Homebrew installed. I use Homebrew for A LOT of things! Click on this link for instructions on how to install Homebrew OR you can skip Homebrew altogether and use the alternate rbenv installation instructions from GitHub via the command line.
Once rbenv was installed then I finally got to install Ruby. (Yes, this takes patience and in my case, LOTS of coffee ☕️! LOL) You must use the particular instructions from your Ruby environment manager to install Ruby depending on which Ruby environment manager you chose. I used these instructions to install a specific version and flavor of Ruby called TruffleRuby from their official documentation using rbenv. I choose to install the Standalone version for two reasons: 1) because I already installed the GraalVM prior and 2) because it is compatible with the GraalVM JRE. Remember, earlier I mentioned that the Ruby version depends on the JRE you’re using?
From there, it was time to install Ruby on Rails! I used these installation instructions to install the Ruby on Rails framework from the official guide’s documentation. Once I got to this point I was excited and exhausted. LOL It was time for a break!
App development processes and particulars.
Ok. If you made it this far you are amazing and you deserve an award! 🏆
This is where I started following the official Ruby on Rails guide and finally started coding!
Once you run the “rails new blog” command from the guide it will create a new folder / directory named “blog” and the instructions say to change directories or (cd) to it and start the web server. I chose to initialize my local Git environment at this point so I could keep track of my code changes. If you made it this far chances are you already have Git & GitHub installed and set up on your computer. If you don’t have Git installed yet follow these instructions from Git. Then come over to GitHub and follow these instructions.
With Git installed and setup properly, from inside the directory “blog” which was created by Rails, run the command “git init” and Git will initialize that directory for use with the Git version control system.
From here you can continue with the official Ruby on Rails guide and start up your Rails server and continue developing your Ruby application.
Boot up with Bootstrap…
Upon completion of the backend systems of my Rails blog app it looked hideous (no offense to the Rails contributors).
Fortunately there are many options to fix this. I went with Bootstrap. I will show you how to install and configure Bootstrap to make your Rails app look glorious! I will cover those steps in a future post within this series.
Production infrastructure setup, configuration and maintenance.
Ok, once I’ve completed all the steps in that guide, connected and finished my frontend designs, I had a complete CRUD blogging application.
Now I needed somewhere to host it and I chose Linode to be my app’s home. This is my 1st time using Linode’s cloud computing platform and I must say the experience so far has been convivial and exquisite. 👌🏾
Linode offers a $100 free trial (within 60 days) for new customers and they also offer “forever free” products & services which could come in handy later on. BTW, their documentation is extensive, up to date and excellent!
Again, this is not a paid promotion, (although I probably should join their affiliate program at this point 🤔) I really just want to help the community and show everyone the opportunities that exist.
Once, my Linode account was set up and ready to go. I needed to install and configure Terraform. I followed these instructions from Linode’s documentation to set up and configure my Terraform installation for use with Linode and provision an Ubuntu Linux environment to deploy my app and share it with you all from there and not my personal computer. Although, there are ways to do that safely with something called Ngrok or CloudFlared Tunnels, FOR FREE! But that’s another blog post for another day. LOL
Once my Ubuntu Linux environment was up and running I could then connect to it via SSH and start the party! If you don’t have SSH set up on your computer yet then follow these instructions from Atlassian’s documentation. Subsequently, follow these instructions from Linode’s documentation to connect or SSH into your Ubuntu Linux environment.
Upon connecting to my environment I then had to prepare my Ubuntu sever to become a production environment! I consequently installed the JRE, installed Ruby via rbenv, installed Rails via Ruby or the Gems Bundler on the production environment. I basically, duplicated or set up everything I had running in my local development environment so the app could run in my production environment as well. The difference is my app is running on a completely different machine somewhere other than on my computer.
I will show you how to manage all of these environments using a technology called Linux Containers popularized by a company called Docker in a future post of this series.
App deployment processes & tools
Lucky for me I found the Go Rails Deploy Ruby on Rails Guide. Which is a step by step guide for anyone with the skills to deploy or start their Rails application on an Ubuntu server somewhere. My server happened to be on Linode.
The Go Rails guide instructs you on how to use a software deployment automation framework tool called Capistrano. Which takes your app from your remote GitHub repo and deploys it to your remote Linux production environment using the magic of DevOps and automation.
Capistrano uses your Rails app’s GitHub repo to pull the code and then push it to your production environment which uses another framework called Passenger with Nginx and AUTOMAGICALLY connects to Postgres to serve your Rails app live over the actual internet.
There will be bugs and you will need the patience to know how to manage and troubleshoot passenger on Ubuntu. I promise it will get easier. By the time we’re done you’ll be anthropomorphizing (go ahead and look it up you will be pleasantly surprised 😊) your Ubuntu baby and taking great care of it.
I connected my Rails app’s production server to my AWS hosted domain as a sub-domain named rails-blog. So the complete URL address became instead of giving you an ugly IP address (45.33.84.126) to connect to. I set up a pretty looking hostname with a sub-domain for you all to use. And you can do the same thing using AWS’s Route 53 or any other domain hosting service. I will update this blog post series with how I did that later.
Finally, I used Lets Encrypt via Certbot to install and setup TLS/SSL on my production server. So now I can serve my website using the beloved HTTPS:// protocol. 🔐
Once all of that was completed (in the same day!) I immediately started working on this blog post. Ok, that’s it for now. I’m kinda tired and I don’t think I can type anymore tonight. LOL I think I’ve dropped a lot of gems so far. (Get it?…Gems 💎) Don’t mind me…
If you made it THIS FAR I think I love you, LOL ❤️ AND You are the real MVP! 🏆
Thank you for reading this. 🙏🏾