So I mentioned that I had registered a new domain recently. I also mentioned that I was going to host a website for this on the virtual private servers I have for my mail servers. I had a couple of prerequisites that needed meeting before setting this up.

First, backups. I had up till recently been relying on two geographically disparate servers to provide the resiliency against failure that I wanted, and my ability as a sysadmin to rebuild a server if it died in a way that meant rebuilding from scratch. This was ok for a mail server, but as I add complexity that option becomes untenable. Fortunately as an experienced sysadmin I am familiar with backups, and already had dirvish installed on my home server. So backing up the hosted servers was just a case of configuring dirvish to back them up.

Second, easily pointing the domain I wanted at these servers in a way that made it easy to move around later should I want too. This was also fairly simple, I created a new subdomain of my existing domain, and created A and AAAA records for it pointing at both servers on their IPv4 and IPv6 interfaces. I then created a CNAME for the domain I want for my new website and pointed this at the new subdomain. I can move the site by changing one DNS record.

Third, set up SSL. Again this was easy due to an artifact of how I had configured things in the past. I had set the servers up to use TLS for authenticated access to IMAP and SMTP. This required a method for fetching, and renewing SSL certs. So the servers were configured to use Lets Encrypt and cert bot. They were also configured to allow them to authenticate through each other to Lets Encrypt if necessary. So once the previous step was complete I just had to use that setting to request the new cert from each server.

Finally, a method to develop the site and keep the content up to date and in sync on both servers. This one was a little trickier than the previous steps, but not by a huge margin. I needed to develop the site, so my home server helped there, I created a local host name, and put the content in a folder that was web root for that local host name. So I can use git to track the changes I make (in case I decide I dislike a change). But how to make sure this is copied to both servers reliably. Well it turns out git can be used for this too. Do note that in my case I had to modify the command to push the first lot of changes to the servers, "git push live +master:refs/head/master" became simply "git push live master" But this wasn't done until I had made sure both servers were in the git config file for "live" so that git push now pushes to both servers, and they will always get the same content.

So I introduce you to craig.stewart.zone. Yes it looks a bit rubbish right now, but it is still a work in progress.

posted at 7:29 pm on 15 May 2018 by Craig Stewart

Tags:not-a-designer project web sysadmin