Note: I never did finish parts 2-4 for this blog post. I waited too long to write them and forgot how they worked. I've left this post up even though it's not really valid any longer. There are much better articles now on getting this running.
I'm going to do this post in four parts. Part 1: checklist things to do before deployment, Part 2 Capistrano, Part 3: Unicorn, and Part 4: Nginx. I also don't have the ability for draft posts set up yet, so...instead I'm publishing in parts so I don't need to write it all at once.
Launching this Rails app was not easy, although since I had never deployed an app, I wasn't expecting it to be easy. There are a bunch of little things you need to know about deployment if it's your first time that I think it would be helpful for other first-timers. Also, when you've been working on that web app for 24 hours straight you forget the all important mental checklist.
Please feel free to correct me to tell me I'm "doing it wrong" because this is my first deployment and I will fully admit I might have no idea what I'm doing.
Preparing Your App for Deployment
One thing I failed to do and I regret a lot is making sure certain files aren't include in git with my
.gitignore. Files to remove are:
- public/assets* (now I did this because I wasn't using any public assets, and didn't want the rouge stylesheets being added)
Chances are if your app is running on sqlite3 in development it won't be in production and will more likely be using a MySQL database or PostgreSQL. My app is using MySQL so we'll go over setting up your Gemfile for that.
If you have just gem 'sqlite3' in your Gemfile you'll need to change it to what I have below. While here you'll probably want to add the gems needed for deployment as well.
Before deploying you'll need to precomile your assets with:
This is really important because I forgot this step and could not figure out why my assets weren't showing up and I was getting a lot of "No Route Matches" in my logs. I didn't find this anywhere other were having this problem and no one said "hey maybe you forgot this really important thing."
Once capistrano is set up you can automate this task during deployment, but we'll cover that in Part 2.
When Parts 2-4 are written they will be linked to at the bottom of this post.
First, Happy New Year to everyone. This blog isn't a New Year's Resolution, so don't worry I won't write in it for 15 days and then never appear online again.
I started this blog for a couple reasons. I went to Big Nerd Ranch in September to learn the basics of Ruby and Ruby on Rails, and in that class we learned one of the ways we could contribute to the Rails community was writing a blog. I wanted a way to document and collect the things I learned, the mistakes I made, and also hope to help other beginners.
It will also help me hold myself accountable - to always be learning new things about Rails and giving back to the open source community.
From Photographer to Developer
When I thinking about how I got where I am now I can't help but laugh a little. I can tell you that if you asked me where I'd be now 5 years ago, I wouldn't have said where I am now. In high school, I focused a lot on art classes and thought perhaps I wanted to be an art educator and went to college believing that's what my major would be.
I think I was about 5 seconds into my freshman year when I realized teaching art was not something I wanted to do. I decided on a photography major and although I wish I had realized my passion for web development and computer science much earlier on I am grateful for all the creative energy I was required to use during my time as a photography major. I think I learned some valuable things that can easily be applied to where I am today, for example, the importance of maintaining the scope of a project.
In my senior year of college I took a Flash class for two reasons; it fit well in my schedule and I wanted to learn how to build a basic portfolio site for myself. As our final project I built my original website. At first my professor discouraged me from doing this because with only one month to complete the project he felt the timeline was a little to ambitious. I strive to constantly challenge myself. and I did in fact finish it ontime - with lots of hours over Thanksgiving break.
That was 3? 4? years ago I lose track. I took another class or two, but most of what I learned was on the job or things I taught myself. I have learned so much in a few years I cannot believe the information I absorbed.
For the last two and a half years I have been working for Evolving Media Network, a web development company in New York. Starting out with static html websites I quickly taught myself enough PHP to hack together WordPress sites and that was the majority of my responsibilities for a few years.
This past September I went to the Big Nerd Ranch in Atlanta to attend their Beginning Ruby and Ruby on Rails class. It was awesome and if you're thinking of going it's a great learning environment and the instructors are talented and helpful. Since then I have been practicing Rails by working on my own projects and have a few ideas for gems I hope to get to soon.
You can also follow me on twitter @eileencodes
Thanks for reading!
I just launched this blog and hope to have some informative posts about what I'm learning up soon.
A shout out to the only reasons this blog is running: