Creating This Blog

At Hive we've learned a ton as we've scaled and want to share some of the shit that's come up - from technical pitfalls to growth tips that we discovered.

A blog felt like the right medium, but spending any significant time on it seemed unreasonable given the natural time constraints in a startup. Thankfully we didn't have to.

The kind folks over at the Ghost Foundation have created an open source blogging platform built on NodeJS Ghost that is super easy to configure and deploy, quickly and inexpensively.

Using a quick and dirty Nginx hack, we were able to deploy our non-technical blog and this nerd porn on the same AWS box.


What we did

  1. Spun up a t2.micro instance on AWS to host it.
  2. Installed Docker for Ubuntu
  3. Run docker pull ghost to get the latest docker image of Ghost
  4. Installed Nginx
  5. Created an startup script /etc/rc.local (See below), that cleans up old docker containers that might be around then spawns two new named docker containers running respectively on ports 3000 and 4000, with mappings to our actual file system so that we can edit important components such as themes.
  6. Updated the Nginx config file /etc/nginx/sites-enabled/default mapping the subdomain nerds.hive.co to port 3000 and blog.hive.co to port 4000. (See below)
  7. Modifed our dns zone file, adding @ records to point the respective subdomains both at the IP of our AWS box.
  8. Restart the AWS box to ensure that the startup script is working and verify that both subdomains function as expected.

note: To restart one of the blogs at any point if necessary, say to pick up new themes, simply run docker restart ${blog-name} where blog-name is the named docker container.

At this point both blogs should be up and running and accessible from their subdomains.

rc.local:

docker rm -f $(docker ps -aq)  
docker run -d --name nerds -p 3000:2368 -v /home/ubuntu/nerds:/var/lib/ghost ghost  
docker run -d --name blog -p 4000:2368 -v /home/ubuntu/blog:/var/lib/ghost ghost  

nginx default site:

server {  
  listen 80;
  server_name nerds.hive.co;
  location / {
    proxy_pass http://127.0.0.1:3000;
  }
}
server {  
  listen 80;
  server_name blog.hive.co;
  location / {
    proxy_pass http://127.0.0.1:4000;
  }
}