I wanted to play around with n8n so I created a python script that generates a terraform file that deploys n8n, FastAPI and Cloudflare Tunnel (for SSL support) on a Google always free tier E2 micro-instance. The repo is linked below if you wanna give it a try.
Made quite a few tweaks this morning that improve the installer. Removed things that didn’t need to be installed (Apache2), no longer opening port 5678 since Cloudflare Tunnel doesn’t require it, switched from using Docker-Compose to Docker Compose Plugin and migrated to installing Docker and Cloudflared from their respective apt repositories (to make upgrading software easier.) Also, added an updater script to make maintaining the installed software easy. If you’re looking for a free self-hosting solution on GCP this is working great for me. Open to feedback / ideas to make this simpler or more useful but suspect it might get challenging to maintain if it’s significantly more automated (eg bash script to check for required client dependencies and assist with configuring and running the python script.)
Hi Daniel. I’m pretty new to coding/self-hosting, so cannot understand your setup. Could you pls explain in short why did you need all that stuff?
I just followed the n8n docs and run n8n + traefik on my e2-micro instance and everything works just fine.
I suppose it is all about security, but your short input about why every of those components is needed would be much appreciated
Glad to hear you got it working on your own using the n8n docs! This doesn’t sound like it’s for you since you got up and running.
Mostly, I wanted a project to learn Terraform.
That said, I also aimed to create a Python script that simplifies the process of setting up n8n and deploying it on a server, especially for those new to GCP or unfamiliar with the gCloud CLI tools. I made sure it configures lots of finicky details on GCP and sets up SSL certificates using Cloudflare, all of which can be tricky for some. I’ve recently made updates to my script, making it even easier to deploy community modules on the server during setup:
Hello Daniel, I hope you’re ok, I’m writing you from Spain. I’m reaching you since I’m a bit desperated, I’ve installed n8n on Google Cloud using Docker (I don’t know too much about it, I’ve just followed a installation guide on Youtube), everything was going perfect until I saw that there was an update available, I didn’t know how to update n8n, I used Perplexity AI, but all I managed to do was to lose my installation, my Workflows, I’ve reinstallated all again, again an update available and the same thing!
Please, would you give me some advice about updating n8n having used n8n? Thanks in advance!
Hi David,
Instead of relying on an AI, I recommend using our documentation for Docker installs. In your case, it sounds like you didn’t define a data volume:
To save your work between container restarts, it also mounts a docker volume,
n8n_data
, to persist your data locally.
Hi Bartv, thanks a lot for your recommendation, you’re totally right but I didn’t know anything about docker, a few days later, I’ve seen some videos on youtube, I’ve been practicing and now, at least, I understand the basis of Docker, and I think I’ve deployed the volume, thanks once more, and congratulations on having developped sucha a gorgeous automation plattform!
In case it helps, here’s a guide to deploying n8n on Google Kubernetes Engine. It extends the approach in the documentation, using Autopilot and covering HTTPS.