Hosting a Site on Surge

4 Mar, 2016 | TipsWeb/dev TipsTechVfd

Having converted one of my sites to a static one, I decided to try out some of the alternative options to traditional hosting packages. I drew up a list of a few options and set about trying to get my site online.

Getting Started

I began with Surge because it looked easy (having started to wade through the Google Cloud Storage instructions, which did not). That didn't exactly prove to be the case because the dev server I happened to have the site on is running Ubuntu Precise Pangolin (12.04 LTS) and the latest version of NodeJS in the registry is old.

I ended up following the instructions here to get it installed:

curl -sL https://deb.nodesource.com/setup | sudo bash -
sudo apt-get install -y nodejs

I still got a bunch of warnings from npm about deprecated this and that, so ran the suggested command:

sudo npm -g install npm@latest

Finally, I was able to install Surge.

Creating a Site

[embed]https://www.youtube.com/watch?v=-EjdMvYPSVU[/embed]

I switched to the folder path for my static site and used the following command to create a CNAME file:

echo leepenney.com > CNAME

I then typed in the surge command and followed the prompts to create a new account and away it went.

After it had loaded the files and they had propagated to the CDN I got a success message.

I then headed over to my domain registrar and set up some CNAME records as suggested here.

Within seconds I was up and running on Surge.

Speed

In my optimization post, I stated the results of various speed tests, which I ran again once uploaded.

Original hostTest host
PS Rank (Mobile)88/10088/100
PS Rank (Desktop)93/10093/100
WPT First Byte0.156s0.464s
WPT Fully Loaded2.892s5.051s
WPT Bytes (KB)1,0931,093
GTMet YSlow88%92%
GTMet Load Time2.5s1.5s
GTMet Size (Mb)1.051.05
GTMet Requests1515

As you can see, some stats remained the same, a couple were worse and some improved. A bit of a mixed bag.

Summary

Set-up difficultyGoodAssuming you don't have issues with your OS and/or have NodeJS already installed.
Set-up timeGood
SpeedGood
CostGoodA paid tier is available.

Final Thoughts

I'm not a massive fan of having to install things (the entire of NodeJS and npm in this case) just to upload files, but once I managed that feat the process was very smooth and literally took seconds, so it was worth the effort.

The basic tier is free and there's a paid one at $13 a month.

So far, so good. The site was loaded 27th Jan and I'll run it for a few weeks to see how it goes before heading off for the next host.