Aerobatic hosting for $10 a year

Aerobatic.io enticed me to use their free offer for static website hosting and, after days of struggling with their service to set things up, they suddently changed the offer to $15 a month for the same ($180 a year). Whereas I can understand business triggers behind this decision, I just can say I wasted a lot of time because of them. $180 for static website hosting is more than 10x more expensive than the competition. In the article below I’ll show how to get the same (and a lot more) for just $10.

Let’s start from describing what aerobatic really sells. They provide static website hosting generated by few static website generators (like Hugo or Jekyll). That means they only host static HTML and additionally provide two more features:

They provide execution of one line shell script, which builds static website from the sources (like for example hugo command, generating the HTML website from Hugo templates).

Static website hosting is something you can get for few cents a month, so it looks these both points does cost $180 a year.

Ok, enough with complaining, let’s do it.

1. Buy low-end VPS

For me this is an ultimate and N-th time confirmed truth: your own machine will always be 100x better than any external services. You don’t have to rely on their support (like “I’ve clicked this button but it doesn’t work as expected” - after which you have to wait 3 days for someone who can check logs). You can use it for a lot of more purposes than the initial one. And first and the foremost - it’s extremely cheap nowadays.

You can easily choose and buy low-end VPS on lowendstock.com. I, for example, have bought nodeserv.com for $10 a year with 50GB HDD and 256MB RAM (which is perfectly enough for this use case and a lot more).

2. Initialize

Initialize the machine by installing required software and setting up firewall. For static website hosting we will use lighttpd package:

3. Configure git repository

Now it’s time to make a first checkout of bitbucket repository. As a first approach I’ve just used my git URL with previously configured ~/.git-credentials. Unfortunately it turned out there’s a problem accessing git credentials from lighttpd CGI script. Then I’ve just used full URL with credentials and it apparently works from CGI:

In Hugo this process creates ./public directory which contains whole generated static website. We will link it now to lighttpd htdocs directory. I configured multiple virtual hosts for my lighttpd for further usages, but if you don’t need this, it will be as simple as (if your /etc/lighttpd/lighttpd.conf points to /var/www as server.document-root):

Now, you should be able to display your website going to your server URL.

5. Configure CGI

Now it’s time to move from cheap job (which costs few cents a month) to more expensive one, worth $180 a year. The automatic regeneration of website from the sources, triggered on bitbucket push webhook. Firstly we need to enable CGI module for lighttpd:

6. Setup bitbucket webhook

The next work is to setup bitbucket webhook to point to website redeployment script. For the beginning I’d recommend to create a script with random name, which only bitbucket knows. It can be for example /usr/lib/cgi-bin/mysecretredeploymentscript.sh. But before doing that you should create log file where it can send execution logs: