Those of you who’ve read my blog before might have read the recent post – “Feedafever for ~Free” where I talk about installing an instance of Fever (by Shaun Inman) on AppFog, thus running a database and bandwidth heavy application for absolutely free.
I promised a tutorial for that and here it is –
1. Head over the AppFog and sign up. It’s free, so don’t worry about pulling out your credit card.
2. Once you’ve signed up, the first thing you need to do is go ahead and create a New App. The screen that shows up will give you a lot of options for the “Type of Application”. Notice how you can install WordPress, Drupal, Django, Node and so many others. I have note down below concerning WordPress. For now, our app marketing strategy calls for us to select PHP, as shown in the image.
3. Then, you’ll be asked to choose an infrastructure and a sub domain. Pick the one closest to you. I chose Amazon US East. Since I have not used Rackspace, Azure or HP OpenStack, I can’t vouch for those. Besides, Amazon is extremely stable. Also, you will not need to sign up or pay for these services separately. AppFog takes care of all that for you. The last bit shows you your current system usage. AppFog allows you to install up to 10 apps using a total of 2 GB of RAM for free. Anything beyond that and you have to pay.
4. Once you click Go, AppFog sets up the app for you and takes you to your app.
5. Congrats, your set up is half done. Your app is running with 128 MB RAM and you’re ready to set up MySQL and other functions. Head over to Services and create a new database by selecting MySQL and giving it a nice name. Once the database is set up, it’ll show up in the other services section and you just need to click Bind to connect it to your installation.
6. Your Database installed, head over to the “Update Source Code” tab. Here you’ll learn how to upload the Fever code to AppFog. The first thing you need installed is Ruby. If you’re on a Mac, you already have Ruby installed. Just start terminal and run ruby to confirm. On Windows, I recommend you install Ruby from the RubyInstaller website. It installs everything you need to set up AppFog. If you’re on a Linux, well, you probably already know how to install and run ruby and take over the world with a SuDo command. 😛 (in case you don’t, ask in the comments section)
7. AppFog has a nice ruby gem called ‘af’ to handle your account and applications. The Update Source Code tab gives you all the info you need, including how to install the gem and login (which you must do). After you’ve done those steps and before you run the update command, understand the following – AppFog puts some basic stuff into your application at the time of installation. Your job is to upload all the relevant files and replace this default setup. Also, AppFog is a little strange about how it gives you information about your MySQL database.According to the tutorial here, you can install PHPMyAdmin to manage your database. I did not do that. Instead, I uploaded a simple PHP script to get me the relevant info. You can download the file here.
8. Now, to set up your code, make a temporary folder in your computer and cd to it. Place the PHP file you just downloaded here and from within it, run the terminal command “af update”. This’ll upload the file to AppFog. Now, from the AppFog Dashboard, click the “Visit Live Site” button and when it opens, add the filename – “find_info.php”. This will give you the following information –
“Hello world! us01-user01.crtks9njytxu.us-east-1.rds.amazonaws.com:3306 uwItlnwCaYkkN pauDL3zd5cmjL d21a9f68185b8464d8575b05efc2d98c6“
I’m sorry for the dirty way it presents, but my knowledge of PHP is ghastly limited and this is all I could whip up. Copy all this information onto a file on your computer.
The string starting with “us01…” is your database host. You can skip the 3306 port number at the end. After that, follows your database username, password and Database name.
9. Once you have all this info, you’re ready to install Fever. If you’ve installed it before, you know that you can install a Fever compatibility package from the Feedafever website. This will give you confirmation that Fever works on your server. Download the zip file and extract its files (not the single folder, the files in it) into the same directory where you placed the find_info file. Then, delete the find_info file as it’s work is done and you don’t want anyone to know your database information. Finally, run the “af update” command again. AF will upload the files and restart the app. But you’re not done just yet.
10. When you bought fever (or are planning to buy it), you bought it for a particular domain name. Shaun Inman forbids you from installing it on any other domain. But the domain on which your app is running is not that. So, you need to set up DNS. Head over to the Domain Names tab. If you’re planning to run fever on a sub domain like me (I have fever.nitinkhanna.com), add the entire sub domain as shown. Else, if you’re dedicating a whole domain to your fever install (someone out their own fevr.me), add that. Accordingly, AppFog shows you what A or CNAME record to add to your DNS settings. Go to your domain’s DNS settings and add the correct DNS record. This process takes some time, so to pass the time, I’ll show you another neat thing you can do for Fever to run smoothly.
11. Like I said, AppFog gives you a total of 2 GB RAM to run your apps. If you’re not planning to run any other app, you can designate a lot of that RAM to your Fever installation. To do this, go back to Mission Control and check under App Resources. You will see Instances and Memory Quota. Increase the Memory Quota to something like 600 to 640 MB. Do NOT increase the number of instances. Fever does not understand instances and it’ll screw up your installation. Trust me, I tried. Now click Update and when that’s done, hit the restart button. This will restart your app with the new settings.
12. By now, your DNS settings should have made their way through the pipelines of the Internet and you should be able to open your dedicated fever website (fever.nitinkhanna.com for me). If you’re not able to, try cleaning your browser’s cache and wait a little longer. Once you get through, the Fever compatibility Suite will run. It’ll tell you that Browser Flush won’t work on this server (a small price to pay for free service), but move on. Insert the database information you got from the find_info file and then your Fever credentials and Activation Code.
Your Fever setup is ready. Import your favorite blogs and RSS Feeds and enjoy.
Notes, Caveats and Issues –
1. AppFog, though they’re committed to providing world-class facilities for free, have a small problem in their system – they do not have persistent storage. This means that some times, your Fever installation will reset. Since they don’t have proper storage, your Fever compatibility suite will run the next time you open Fever. Never fear. Remember that Fever stores all your feeds in the database. Just enter the database values from the file I made you save and your Activation information and Fever will be back up with all your feeds intact. I faced this problem a couple of times initially, but I haven’t in quite some time, so perhaps AppFog is improving their service.
2. I just mentioned that AppFog doesn’t have persistent storage. This means that any additional, non-database files get flushed in the event that their system resets. Which non-database files can you quickly recall? WordPress Plugins, Themes and templates. That means that if you install WordPress and the AppFog system resets, you’ll have to install the themes and plugins all over again. To test this, I installed a WordPress blog on AppFog and setup a few themes and plugins like BuddyPress on it. (Shameless plug here – I installed BuddyPress to run my own social network as an experiment. Read about it here and join the social network here). Ever since I installed it, I have only had to set it up once more after an AppFog reset. It’s been stable ever since.