I’ve had a Linode server sitting around doing nothing for almost a year, and I
had an urge to do something with the $5 a month worth of compute.
All of this is a gigantic waste of team for learning’s sake. This could be
done with a lot less time and money just using GitHub Pages and Actions.
The Initial Vision
Server via Ansible. I wanted to be able to build this from a clean Linode
instance without accessing the server.
Automated site build and deploys in Jenkins triggered by a GitHub webhook.
That’s it. This is the first in a short series covering the build.
Initial Server Provisioning
I terminated my existing Linode instance and spun up a fresh one using the
CentOS7 image. Now I was ready to start provisioning the basic services with
Ansible.
The first goal was getting NGINX and Docker installed. I opted for running
NGINX directly on the server for serving static content, like this site, and as
a proxy for any containerized services. The first step was creating a clean
ansible project with a couple roles.
common.yml
The above play will fail until we create the roles, so we do that next.
NGINX Role
Here’s an overview of what this task is doing:
Installs the EPEL Repository where NGINX is distributed
Installs NGINX
Creates a directory for our letencrypt certificates to live
Sets the default NGINX config from a template creating a default server on
port 80 that redirects all traffic to https
Makes sure the firewall allows inbound traffic on ports 80 & 443
Disables SELinux :( I struggled with this and eventually gave up
The Docker task almost verbatim follows the installation instructions provided
in Docker’s dev docs. The only additional items are the PIP packages needed by
Ansible for interacting with the service.