Live data from Hacker News

Ask HN: How do you deploy your side-projects?

news.ycombinator.com

31–40 of 82 posts

Re: Ask HN: How do you deploy your side-projects?

#31
I can highly recommend fly.io. I have been using it for my Elixir projects [0][1][2]. The interface is easy to use, and you can come very far with the free layer. Another selling point for me was, that I can easily migrate away (in case I want to move to Hetzner later).

[0] https://slashdreamer.com/

[1] https://articletoimage.ai/

[2] https://ogtester.com/

Re: Ask HN: How do you deploy your side-projects?

#32
I deploy to a virtual machine. I use Ansible to set up the machine and install a container runtime, then i set up traefik + containers using Ansible and docker compose files. If I ever do need to scale it's easy to switch to docker swarm which is quite capable. It's also easy to deploy the full stack somewhere else quickly. I wish it was easier to do firewall configuration when using docker, since it basically occupies iptables even though I'd rather use nftables. I also keep secrets out of source code and add them during deployment using envsubst and ansible vault. One thing also, i think the Ansible documentation is quite terrible. The only saving grace is `ansible-docs -s` which can print snippets. I don't particularly like ansible but i guess it's currently the best there is and has a big ecosystem.

Re: Ask HN: How do you deploy your side-projects?

#33

Cloudflare Workers is a big time saver for my side projects. I don’t use JavaScript/TypeScript/WASM at work, but it’s been great.

How do you deal with persistant data? What DB service etc?

For key/value storage there's Cloudflare KV * https://developers.cloudflare.com/workers/runtime-apis/kv/

For document storage, Durable Objects is amazing: * https://developers.cloudflare.com/workers/runtime-apis/durab... * https://blog.cloudflare.com/durable-objects-easy-fast-correc...

For relational data, there's now D1 (open beta): * https://developers.cloudflare.com/d1/

For bulk storage, there's R2: * https://developers.cloudflare.com/r2/

Re: Ask HN: How do you deploy your side-projects?

#36

I deploy to a virtual machine. I use Ansible to set up the machine and install a container runtime, then i set up traefik + containers using Ansible and docker compose files. If I ever do need to scale it's easy to switch to docker swarm which is quite capable. It's also easy to deploy the full stack somewhere else quickly. I wish it was easier to do firewall configuration when using docker, since it basically occupi…

Would you happen to have that ansible setup on github for others to learn from? Now that docker is actually fast enough to be usable on mac, I'm leaning in the direction of a fast VPS plus docker compose for simple app deploys like you (with the option to move to swarm if growth occurs). Would be great to learn how others are automating the VPS setup itself.

Re: Ask HN: How do you deploy your side-projects?

#39
post #25

Check https://dokku.com . Easy to set on your VPS, support Heroku buildpacks and almost-zero-to-none management (assuming you update your server from time to time). And you get Heroku-style deployment. Running some projects with it for the last 5-6 years and had couple of Dokku versions upgrades - zero issues so far.

Keep in mind that depending on use case it will build your project on the same machine your production app runs. There are also a few things to keep in mind.. it depends on docker so a docker update might stop your services, disk space might fill up and needs to be checked on. Plugins such as databases also need to be updated once in a while. If you're very unlucky you may cause a crash/outage by deploying an update. What I do instead sometimes is to build and push container images of my apps in a pipeline on commit and then deploy those to dokku using git-from.

Re: Ask HN: How do you deploy your side-projects?

#40
My poor-mans-PAAS: git, ssh, systemd, dedicated instance, caddy, grafana and prometheus

Cost per "project": domain + shared cost of the dedicated instance. Right now the dedicated instance is running 8 projects in total, I pay ~70 EUR a month, so about 8.75 EUR + .com domain for each which works out to be ~20 EUR per year, 1.6 per month. Also using Migadu for email, shared between all little projects, ~30 EUR / month (so currently 3.75 EUR per project per month).

Each project added makes cost per project lower, as they all share the same infrastructure.

Environment is setup so every service has it's own systemd user service. Deploys happen by doing the following steps:

- Build and test project locally

- Copy artifact/binary to server with ssh, rename file to be versioned incrementally

- Restart systemd service

- New service deployed

- If database migrations have to be run, I execute them here

- (if something goes wrong, I copy old artifact to "production" directory and restart service again, poors-man rollback)

- Send a marker to Grafana that a deploy have happened so it's visible in the dashboard

As it stands right now, it seems to be about 13 EUR per month per project, but as mentioned before, gets cheaper for each added service. None of them are particularly performance sensitive or use a lot of resources. As a max, I've run something like 15 services on this very machine without any problems. Everything goes via Caddy that acts like a proxy front for everything.

One of the projects got more popular one time and started impacting the performance of the others, I simply replicated exactly the same environment to a new dedicated server where it lived by itself from there on.

Post reply on HN