Over the course of the past few months I've been revamping my personal website, adjusting it from a central place to host examples of my work into a simple, portfolio style, explanation of who I am (professionally) and the tech I have experience with.
This blog post is a quick rundown of my progress.
FROM httpd:2.4
COPY ./public-html/ /usr/local/apache2/htdocs
RUN echo "LoadModule rewrite_module modules/mod_rewrite.so" >> /usr/local/apache2/conf/httpd.conf
RUN echo "RewriteEngine on" >> /usr/local/apache2/conf/httpd.conf
RUN echo "RewriteCond %{HTTP:X-Forwarded-Proto} !^$" >> /usr/local/apache2/conf/httpd.conf
RUN echo "RewriteCond %{HTTP:X-Forwarded-Proto} !https [NC]" >> /usr/local/apache2/conf/httpd.conf
RUN echo "RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]" >> /usr/local/apache2/conf/httpd.conf
EXPOSE 80
It uses the bog standard httpd image, copies the site into the htdocs directory and sets up the HTTPS redirect in httpd.conf.
This blog post is a quick rundown of my progress.
Design
I think personal website design has become far too homogeneous with the advent of WordPress templates and the like. I miss the days when people wrote their websites from scratch with a very limited understanding of the HTML they were shamelessly stealing from other people (View Source, you beauty).
I've tried to capture some of that adolescent, angelfire aesthetic in the design of my site - with a stripped back design and a janky parallax CSS scrolling effect. I've also used a monospace font because that way you know I'm a very elite hacker.
Infrastructure
AWS. Two EC2 instances running Ubuntu 16.04, fronted by an Application Load Balancer with listeners on port 80 and 443. The instances are responsible for redirecting HTTP->HTTPS, more about that in the Docker section.
The SSL certificate on the load balancer is supplied and kept up-to-date by Amazon Certificate Manager.
Deployment Pipeline
The entire site is versioned on Github, check it out if you dare. When I push a commit to the master branch, a Docker image gets built on Docker Hub. Then, on my web nodes, I use watchtower to pull the new image and restart my containers.
Not a foolproof release process by any means but it requires very little work on my part in order to get new code live.
Monitoring
I've installed Monit on both instances because I think, for a small deployment like this, it's a lovely little monitoring agent with some powerful features. It pokes me, via email, when the website docker container is unreachable on either host. It also lets me know when the watchtower process is unresponsive or disk space is about to run out.
I also have an endpoint check against https://www.ribbybibby.me set up in Route53 which will prompt me when the site is down from the outside.
Anything else is overkill for a site with a monthly viewership of about two (me and whichever recruitment consultant is selling me the DevOps dream that week).
Docker
Super simple Dockerfile:
FROM httpd:2.4
COPY ./public-html/ /usr/local/apache2/htdocs
RUN echo "LoadModule rewrite_module modules/mod_rewrite.so" >> /usr/local/apache2/conf/httpd.conf
RUN echo "RewriteEngine on" >> /usr/local/apache2/conf/httpd.conf
RUN echo "RewriteCond %{HTTP:X-Forwarded-Proto} !^$" >> /usr/local/apache2/conf/httpd.conf
RUN echo "RewriteCond %{HTTP:X-Forwarded-Proto} !https [NC]" >> /usr/local/apache2/conf/httpd.conf
RUN echo "RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]" >> /usr/local/apache2/conf/httpd.conf
EXPOSE 80
It uses the bog standard httpd image, copies the site into the htdocs directory and sets up the HTTPS redirect in httpd.conf.