3 ms·
The author seems to think the only real alternatives are docker or whatever. So here's a way to host your personal blog if you don't want to over engineer it:
by chmod775 6y ago
The author seems to think the only real alternatives are docker or whatever.
So here's a way to host your personal blog if you don't want to over engineer it:
1. Have a git repo with your nginx/whatever config files.
2. Have a VPS running debian.
3.
apt-get install nginx git ...
git clone ...
ln ... # create symbolic links to your nginx/whatever config in your git repo
systemctl restart nginx ...
4. You're done. Create a cron job to automatically pull the latest changes from your git repo if you want.
The above steps should take most people around 10 minutes.
If you need to actually pivot into something that scales easier from there, I recommend following these steps/levels as your scale increases:
1. Create an automatic install script.
2. Use that script to create a .deb package instead of installing directly (optionally create a repository for this).
3. If you want to move to docker or what have you, it's trivial to install a debian package in a container.
But let's be real, you never even will have to do any of the above because it's a personal blog, and it'll probably scale to the world population on a $5 VPS, especially if you slap cloudflare in front.
- topkeks 6y agoSeems insanely overcomplicated. firebase deploy --only hosting
- andrewzah 6y agoThese days I see no point in installing services on a VPS directly, other than docker + docker-compose. You could do it in one image with the reverse proxy + static files, or break it out into two images (this is helpful if you run more services on the VPS). As for updates, caddy v1 used to support pulling in from git, but I don't think that got ported to v2. So what I do is build+push a docker image, and have a cron job on my vps to pull+restart my website's container. My preferences go Traefik > Caddy > Nginx, but traefik definitely has a bit of a learning curve. https://github.com/andrewzah/andrewzah-com-source/blob/master/Dockerfile https://github.com/andrewzah/andrewzah-com-source/blob/maste... https://github.com/andrewzah/andrewzah.com-docker/tree/master/services/http https://github.com/andrewzah/andrewzah.com-docker/tree/maste...
- oftenwrong 6y agoYou might be interested in: https://github.com/containrrr/watchtower https://github.com/containrrr/watchtower It would automatically pull the new image and restart your containers.
- Tepix 6y agoLet's see the description for traefik: The simplest, most comprehensive cloud-native stack to help enterprises manage their entire network across data centers, on-premises servers and public clouds all the way out to the edge. Sounds ideal for a personal blog! /s
- andrewzah 6y agoIf you already know Traefik, it is much nicer to work with than a static proxy as it automatically updates routes as you launch containers. Is it overkill for only 1 service- a small blog? Yes. In my particular case, I run ~5 services on that VPS (used to be ~13), and I run about ~30 containers on my home server for https://zah.rocks https://zah.rocks. Having to manually update caddy or nginx and restart every time I added a dns entry would be a huge pain. In addition, Traefik's middlewares made it relatively simple to add in SSO with External Auth Server/Authelia + Keycloak/OpenLDAP/LDAP Account Manager (LAM).
- maccard 6y agoHow do you update nginx, or git, or python/php/ruby (if you're using one of those for your little app)? What happens if you get a spike in usage and it kills your little server? What if you want to run on a bigger host/smaller host/your image is killed by ec2? An automatic install script with a deb is _way_ more work and way less portable than writing: FROM nginx COPY . . and docker build -t <appname>.azurecr.io/myapp az webapp restart
- chmod775 6y ago> How do you update nginx, or git, or python/php/ruby (if you're using one of those for your little app)? I suppose you mean automatically update? If so, this has been solved decades ago. Unattended upgrades is just another debian package you can install. If you meant just update in general, that's a pretty silly question. > An automatic install script with a deb is _way_ more work You misunderstand. You can use the automatic install script to create the .deb - or a script based on it. Basically instead of on a live system, you place the same files in a tree you create the deb package from. Even if you use docker, I still recommend learning about how debian packages work. Installing your app in a docker container using a .deb is strictly nicer than having all those steps in a Dockerfile. Plus this way you can specifiy your secondary dependencies declaratively. > more work and way less portable than writing: FROM nginx COPY . . Now that is just flat-out wrong. The steps you'd execute after "FROM nginx" are the same steps you'd execute after apt-get install nginx. It's not more work, it's the same or less - because you don't need to deal with docker on top of everything. You have the added benefit that afterwards you can install the .deb in a debian-based docker container, but you don't have to. You're not reliant on docker. Oh great example btw. Because the debian-based nginx docker container is essentially created with "apt-get install nginx" in its Dockerfile. Funny how you're trying to argue against the setup I proposed by citing a docker package that does things precisely that way. > What happens if you get a spike in usage and it kills your little server? Yeah that's not gonna happen to a static blog behind CF. Also at least that way you're always only paying $5, regardless of what happens. The sort of traffic that kills a $5 VPS serving only a basic static blog can bankrupt you on an automatically scaling infra.
- 6y ago