We installed Chef Solo in part 1, we wrote some recipes in part 2, and now we’ll be tying everything together in part 3. When we’re done, we’ll not only have a fully provisioned server running your Rails app, but we’ll also have an automated way of repeating this process whenever such a need arises in the future.
In part 1, we learned about Chef Solo and used it to create a standard Chef directory structure, along with our own cookbook. Now it’s time to start writing the recipes we will run to provision our Rails server and install Node.js, PostgreSQL, rbenv, Ruby, Redis, and Nginx.
About a month ago, I was in the middle of upgrading the server running Phindee using the harmless (or so I thought)
apt-get upgrade. All appeared to be going well. But when I visited the app in the browser, staring back at me was the infamous “We’re sorry, but something went wrong” page. I hit the logs, and luckily, it turned out to be a minor problem that was fixable without too much downtime.
Phindee users recently got the ability to “like” happy hours. Up until that point, all my happy hour data was safely stored in a version controlled
seed.rb file, but now I was dealing with data that was dynamically generated and not being backed up anywhere. And that is not a good thing.
A few days ago, I added search functionality to Phindee so users can quickly find information about a particular happy hour. Search that is well-done often comes with autocomplete, and Phindee is no exception.
It’s been a long time coming, but we finally reached the point where we can deploy our app to our VPS and have it be available on the internet for viewing. We configured Capistrano in the previous post, and now we’ll actually use it for the deploy. Just like in the previous posts, I’ll be going over how I have things setup for Phindee to help illustrate the concepts.
In the previous four posts, I covered how I went about setting up my server for Phindee and how I configured Unicorn and Nginx. Here in part 5, I will now talk about how I configured Capistrano to actually deploy Phindee.
I talked about how I configured Unicorn for Phindee in part 3, and now I’ll cover how I configured Nginx. While Unicorn will handle requests for pages dynamically generated by Rails, Nginx will handle requests for static assets, like stylesheets, scripts, images, and fonts. If you’re wondering why I chose Nginx over Apache, see part 2 for the explanation.
Having covered how to install the technology stack powering Phindee in part 2, I will now shift gears and talk about how I configured Unicorn. I already explained why I chose to install Nginx, but I haven’t yet explained why I chose Unicorn, so here we go.
Setting up a Rails server from scratch can be a daunting task. I remember my first attempt; it was a multi-day process full of frustration, things not working, me not understanding why, and a whole lot of googling. In an effort to make this experience less painful for those new to Rails, I’d like to share the process I went through to deploy Phindee to a VPS (Virtual Private Server).
A few weeks ago, I ran into a blog post (and the resulting Hacker News discussion) comparing two popular VPS providers: Linode and DigitalOcean. Up until that point, I was a happy Linode customer for over two years. I had heard about DigitalOcean previously, but never considered trying it since I was happy with Linode. This post, however, intrigued me enough to try DigitalOcean out.
I started learning Ruby on Rails over a year ago, and as most beginners, I chose the popular Ruby on Rails Tutorial as my initial guide. Because there was so much new material to absorb, I decided to skip the sections about testing (and I’m glad I did or my head would’ve exploded). When I finished the book, I decided to build a Rails app called Phindee in order to solidify what I had just learned. I never went back to learn about testing, however. Now over a year later, I did just that and was finally able to write a solid test suite for the app.
I recently finished working on a Ruby script that needed to store a small amount of data in a database. Having previously worked with Active Record, I loved the idea of an Object Relational Mapper written in Ruby; it makes manipulating data easy and keeps your code organized. Active Record, however, was definitely an overkill for such a small project. I needed something simple, lightweight, and easy to set up.
When I was working on Phindee, I struggled with adding custom fonts; the asset pipeline had just been released, and it changed how one worked with assets. Perhaps there are others out there struggling with the same thing, which is why I’d like to share what I did and hopefully save some time for a few.
I love Portland. It’s a fun, quirky city that makes me feel right at home. And the longer I live here, the deeper my affection grows. There are many reasons why this is so, but one that’s high on the list is the food scene. Now I haven’t lived in any other major city, so I can’t compare, but others who have tend to agree.
I started blogging last week. And ever since publishing that first post, I’ve been trying to find a suitable design for my blog. I looked at many different blog designs for inspiration, and one of my favorites was Whitney Hess’ Pleasure and Pain blog. I don’t know why, but the design just resonates with me. It feels right.
Starting a blog is something I wanted to do for a few years now, but I worried too much about not having enough time or things to write about, so I always put it off. But this weekend that all changed.