Wednesday, May 28, 2014

Project Venice: A Home

Since I am taking a whole new approach with this game, it requires a new home.  I want to avoid getting limited by quotas this time around too.  There are a lot of solutions, like Amazon's EC2 and Heroku plus a myriad of other cloud products.  I've decided that this project will have a budget, so paying for hosting is doable.  This post will be down in the weeds :)

After looking around, I have settled on Digital Ocean.  I did this for a few reasons.  

$5 a month.  Their most basic plan is pretty affordable.  It should be more than enough for a prototype.  Plus, if you google it, you can find promo codes for $10 in credit.  So I'll actually have 2 free months to play around with it.

SSD Drives.  I probably don't need SSD storage,  but who can say no to that?

MEAN Stack.  They offer 'droplets' with the MEAN Stack built in.  That means less setup for me.

Signing up was very simple.  Although, I still needed to enter payment information and pay $5 despite my $10 credit.  That gives me 3 months worth for $5, which is still pretty good.  

I chose the smallest instance, which gives 512MB/1 CPU/20GB SSD/1TB Transfer.  After choosing an image with MEAN on it, I was all setup.  Using SSH I logged into the server and proceeded to update the server using 'apt-get update && apt-get upgrade && apt-get dist-upgrade.'  I really hope I need to upgrade to more a expensive plan someday, that would mean it is being played. 

The image comes with a MEAN website all setup, so I rm -rf'd it and decided to start from scratch.  I used the following command to set it up again.

mean init venice
cd venice && npm install
grunt

This started up the webserver on port 3000.  However, it threw an error when I connected to it:  Error: ENOENT, open '/opt/mean/venice/public/system/lib/bootstrap/dist/css/bootstrap.css'

To solve this, we need to install bootstrap-css:  bower install bootstrap-css

This command also throws an error:  "bower ESUDO         Cannot be run with sudo".  Since we are running as root in our image, we need to do:  bower --allow-root install bootstrap-css

Now we run grunt again and connect to the site, success!  

However, this still leaves us with quite a robust install.  I really want to start with nothing and build it up so I wiped it again.  Then I found this resource:  http://scotch.io/bar-talk/setting-up-a-mean-stack-single-page-application  After following those instructions I was left with a very simple install which is much more understandable.

Finally, I setup the firewall for my new system.  I found a great guide about how to do it.

You can check out the new site at:  http://107.170.182.216/

Next up, getting a login system working.