public

Self-hosted again

So the latest development in my little network is that I've brought everything back in-house. Partly to save a little money until things are looking up again, and partly because

2 months ago

Latest Post First VLOG by Steve Simons public

So the latest development in my little network is that I've brought everything back in-house. Partly to save a little money until things are looking up again, and partly because I wanted to see how portable a Docker stack really could be. Could I move everything from a DigitalOcean droplet onto a locally hosted linux box without too many tears?

It turns out that I could, but not without a few head-scratchers.

Firstly, I use persistent volumes for my Docker containers so I wanted to move not only the containers but their associated volumes. I soon discovered that the easiest way to do that was do copy the whole /var/lib/docker folder to the new destination. I had a fresh install of Ubuntu server with two spare 500Gb drives inside and decided to use one of the drives just for Docker stuff. After installing Docker I made a soft link on the drive (mounted on /dev/sdd1) to /var/lib/docker so everything would be on its own drive.

I couldn't for the life of me think of a way of copying everything from the droplet to the local box whilst using a non-root account so I made a copy of /var/lib/docker, chowned everything to my normal user and rsynced the lot to the desination. I copied the contents of the folder to /var/lib/docker (soft-linked remember, so the physical path is /mnt/docker/var/lib/docker, it's just seen as the shorter version by Docker. I then chowned everything back to root. This gave me a problem with Ghost, but more of that later.

I cloned my docker scripts github repo to the local box and set about altering the docker-compose.yml file. I stripped out the traefik service and anything related to it. I also removed the wordpress service that I probably won't be using again. I then commented out everything except portainer and after altering the DNS address of the server I tried firing up the stack. It worked fine. So far so good.

Next was mysql and I got no problems with that either.

phpMyAdmin was more problematic. I found I had to use the apache version since I was getting more than one MPM is loaded mesages. A simple fix, but it took me a while to figure out what was going on. I logged into the console and did a quick show of the databases to check things looked okay. Great - three down.

Ghost was a bit of a nuisance for a while as I had to chown everything from /var/lib/docker/volumes/docker-files_ghost-data/_data downwards back to my normal user account. At least that's what I thought the problem was regarding the server error messages I was getting every time I tried to upload an image. Eventually I gave up trying though, and used the last version before v4 and it's working as it should. I've raised an issue on github about it.

Update: I've temporarily fixed the version of Ghost in Docker to be 4.3.3-alpine as it seems to be the last version that was working. There's a thread on GitHub here about it.

dokuwiki was no problem. That's it for now.

Oh yes, reverse proxying and routing... I use the haProxy package on my pfSense router instead of using traefik in the docker-compose file for the services that have been relocated. I like to access my sevices via subdomain-type addresses.

I'm using borg backup to create nightly, smart-retained archives on a Hetzner storagebox.

Steve Simons

Published 2 months ago