Files
personal-website/blog/content-012

25 lines
2.7 KiB
Plaintext
Raw Normal View History

2020-11-30 00:32:22 +08:00
<header>
<h1>Migrating Everything to Proxmox - Part 1</h1>
</header>
<p>It was almost inevitable that this would happen. After getting more comfortable with Proxmox, I realized that I needed more reliability for the applications running on my RPis. Things are running fine on my RPi, but it was a matter of time before disaster struck. So begin my efforts to move everything over to Proxmox.</p>
<h2>A Dance with Docker</h2>
<p>While almost everything could run on or built for Docker one way or another these days, running complicated applications on Docker will eventually uncover some really esoteric behaviours. So I stuck to using LXC containers for most of my applications. I used Docker for the applications that I can deploy and leave them alone, hence Redis, WikiJS, and WatchTower. WatchTower ensures that the containers stay healthy and updated.</p>
<h2>Preparing The Base</h2>
<p>With the easiest stuff out of the way, I started preparing the LXC container templates. I opted for two templates: CentOS 7 and Debian 10. I updated them, added my SSH public keys, installed the basic tools, and it was good to go.</p>
<h2>Taking Apart Services on RPi</h2>
<p>As a result of my messy installations on RPi, I had to scrounge around for the configs and data for Gitea and Apache httpd. After that, it was a quick tarball to be transferred over to their respective containers. This time, I've created a separate container dedicated for PostgreSQL and MySQL. Doing so was somewhat liberating; I now know where I can access and isolate my databases.</p>
<h2>The Disaster</h2>
<p>What is a migration without a major data loss disaster? So, I lied previously about the 'simple' applications I run on Docker. I tried migrating my Nextcloud instance to Docker. Sound simple right? Mount the NFS directory on the Docker host, spin up the Nextcloud Docker image with the directories and the already-migrated PostgreSQL user and tables ready, and magic would take place. Turns out a new Nextcloud instance would immediately nuke /data to set up a 'clean slate'. My NFS directory was clean enough, I'll say. To make things worse, I was putting off scripting for my Btrfs snapshots and backups. With them, I could've easily rolled back my changes.</p>
<p>The silver lining was that I did not keep any important information on the instance. As the old adage goes, backup before doing stupid things. This cowboy move was a hard lesson for me.</p>
<h2>Conclusion</h2>
<p>This concludes Part 1. Most of my time was spent untangling all the services that I was experimenting on my RPi and deciding what gets to live or not. So far, I've learned a hard lesson and had to plan out my migration before doing so. I only look forward for the rest to come.</p>