How I completely rebuild my server setup.
So, this topic has been on my mind for a long time. And in the past two weeks i have finally realized it. This blog post is not meant as a guide, but as a way for future me to understand my current me’s decision processes.
My plan is to publish the guides as separate posts later:
- 🔗 Proxying local servers with Tinc
- ☕+🛸=♥ Setting up a Gitea server with drone.io CI/CD
- Setting up Nginx+SFTP+Traefik
- Including Svelte elements in a Hugo site
Requirements
But before we begin to dive into the technical details of my new setup i would like to talk about the requirements i have:
Git
This one is relatively simple; I code, so i need git. Preferably hosted publicly so that i can share code with other people, and preferably with a CI/CD pipeline attached for the benefits that CI/CD has.
PAAS
I don’t really like to worry about infrastructure, (i know ironic right). At least when I’m working on a project and the infrastructure is not the main focus for that I need a way to easily deploy any application i have to the cloud.
Static Hosting
Because I code a lot of small static HTML+CSS+Javascript websites and experiments I want to have a way to quickly host them somewhere. Also this Blog needs to be hosted somewhere.
Blogging
I dont write a lot of blog posts at all, but i still like to have a central platform to put my thoughts onto.
Filesharing
Most of the time i keep my project file both on my laptop and my main pc. If i work on a coding project i can sync those with git, but for that i need to commit and push every time i switch my pc. For 3D/Media that workflow is not very feasible. To achieve a better workflow I need a File sharing platform, which i definitely want to self host for one because storing a lot of data with a third party is expensive and because i want to be in control of my own data.
My previous setup
In my previous setup i used a mixture of external services. For git hosting i have experience with Github, Gitlab and Bitbucket. I have experience with a few PaaS providers, IBM Cloud, Google Cloud but mostly Heroku because it is very easy to use. My static website was hosted with one.com, again because it was very easy to use. I have tried a few different Filesharing solutions in the past, from Google Drive, Dropbox and Mega and some self hosted solutions like Koken.me, Syncthing and Nextcloud. But in the last year i did not use any File sharing at all.
My new Setup
Now, the first question that may come to mind is, “Why do you use both cloud and local servers?“. There are some drawbacks and some benefits to both. Cloud servers provide fast network speeds and static public IPs but storing large amount of data is kind of expensive. Disk space is comparably cheap with local servers I paid around 60€ for my 1tb harddrive which is made specifically for nas situations with drives running 24/7. Also i really like the idea of having physical access to my own data and not having to trust a third party with it. Another benefit to having physical access to my own server is that i can tinker with hardware aspects like networking, drives and cooling as well as taking physical measurements like room temperature and humidity.
To be totally honest the main reason for me to use a cloud server is because i cant use port forwarding on my local network because we (me and my flatmates) dont know the password to our router 🤦. The solution to that is to create a vpn network with my cloud server and proxy all requests through it.
The whole process of setting up my new infrastructure was mainly my trying out different tech stacks until i found one i liked. So, what i choose in the end:
Git
I definitely wanted to setup a git server on my local raspberry pi, because i want to own my own code, if that makes sense. My first instinct was to use Gitlab, because i really like the integrated ci/cd pipeline, so i downloaded the appropriate docker-compose.yml, started and made my pi instantly unusable because it was so performance intensive. So Gitlab was definitely not the right choice for me.
After that i tried Gogs, which is a lightweight git server build with Go. I really liked the simplicity of the setup and the configuration, but the integration with my ci/cd server of choice, drone.io was not very easy.
So finally i ended up with my current setup which is running a Gitea, and Drone.io Instance on my pi, with the Drone.io CI/CD runner running in the cloud. I started the Drone.io runner in the cloud because the pi is arm based and that caused some problems with certain docker images.
PAAS
My first idea was to use Dokku, but for some reason i had a lot of problems setting up dokku as a docker image. Then i tried caprover which is a rebranding of a project called CaptainDuckDuck, which is imho a wayyy better name. Caprover was super easy to setup and its super easy to deploy to.
Static Hosting
This was a very easy decision, as i already had some good experience with nginx and some not so good experience with the configuration of apache. On my cloud server i provisioned a harddrive with a folder which is being mounted into a nginx docker image and a sftp docker image.
Blogging
Coming from some experience with developing wordpress sites i definitely did not want to keep my old wordpress site. Honestly i did not try a lot of different solutions as Hugo just seemed to click with me, from the blazing fast site generation to the very minimal overhead to the incredible flexible asset pipelines.
Filesharing
Nextcloud, easy. I just like it and it does not seem to have any competitors with the same amount of functionality.
Conclusion
This was a very good learning experience for me and just so much fun. My future plans are to expand my local server setup to a cluster build out of pies and also maybe to try out wireguard instead of tinc because it seems to be way faster.
Cheers thats all for now,
Max