This is more of a post of pain and perserverance which I need to learn from and remember for next time I switch vps rather than an in depth dive into anything.
I am using a VPS because I run a bunch of services for myself and a couple friends which is cheaper just to have all on one server rather than several Heroku dynos which would cost a fortune.
Nginx sucks. The sheer amount of files on top of files to sort through, writing them, debugging them, it's just a whole tedious process.
My main goal was to intergrate two servers together using a docker compose file for security and it generally making setups easier. Sounds simple, and it was for the most part, but yeah, nginx.
I moved from OVH and DigitalOcean to a cheaper but better for value AlphaVPS, I have two domains, including this one. My credit for DigitalOcean was running out from the GitHub Education Pack so I had to move fast.
The most concerning thing for me, more so emotionally, was keeping my matrix synapse files intact, so I could keep the messages between me and my friends, everything else didn't really matter in the long term.
Initially, the server broke instantly. Before even being able to SSH in. I rented it out (I am using the AlphaVPS 1Tb storage vps), and it didn't start for a few hours until their team fixed the issue. I didn't really have many issues server-wise, except the ones from my own fault, but still left a sour taste, but we all have tech problems. They were lovely when they did contact, I still rate them very well.
For ssl, I used letsencrypt certbot to generate the certificates for the ports which requires it. That was fairly straight forward and the least painful part of the whole process.
I setup the directory structure and downloaded the backup of my old OVH server (backblaze!), and placed the important files in the correct locations. The first issue was the docker compose file, I incorrectly formatted a few sections when I was mocking it up, but wasn't too difficult.
When actually starting it, everything was breaking due to permissions being wrong, I had to find the specific permission value the directory needed which took longer than what I wanted it to be.
Alas, next step.
I tried to set up the matrix server, but due to the config not being in the correct format the docker version wanted (the original instilation was onto the host os), it was giving me permission denied on actually running it even though the permissions were correct. I used diff between a docker config and a host os config and edited it to be as close to the other, however this did not do anything. I had no idea what was causing the issue, so I had to create a new config which means I can no longer access my messages to a close friend of mine.
The one thing I wanted to keep intact was ruined :c
Backups don't always work ;-;
I created a new config, set up the matrix server and let it run, it actually started up! Woo! However, I couldn't access it because I didn't actually set up nginx yet.
I used to have a good relationship with nginx, I was in love with them for awhile after ditching apache2, I thought it was rather easy to set up, but when you have seven different services to set up, it's a pain. Docker made it fairly easy as you can just reference container names and be able to access them, but it was nginx itself which was the issue.
Originally I had matrix run on localhost port 8008 and mapped to 8448 (SSL) with nginx, my personal website on 80 and 443 (SSL) and gitea also on the same ports as the website and additionally port 2222. Also, I had a free other server with a similar setup, matrix same ports as before, a static website served with nginx same ports as the personal website, and a murmur server with its default port.
All except one was setting up correctly, which was my personal website, for some reason the blog was overwriting the ports.
After hours and hours, stackoverflow search and mini crisis mixed in with a nasty miagraine, It took forever to fix it, but I actually done it. I fixed it. I ended up having to split the nginx configs into seperate http and https configs, and finally it worked.
This is why you use Heroku for standalone applications, makes the whole development cycle easier and makes setting up open source applications much easier too.
Apache2 is annoying, so is nginx, tech will always be annoying to set up because of the complex systems they are. Nginx is a lesser of two evils, but it still definately is a hellscape.
Thanks for reading!
Written by. Published on .