Run n8n on a VPS using node
n8n is an self-hostable IFTTT-esque tool.
I installed an alfred workflow which can take a screenshot and then upload it to cloudinary. I tried to trigger something on the end of that to automatically create a blog post using the free versions of both IFTTT and Zapier, but subtle limitations made it difficult to do it without paying. (I could add an additional script to the alfred workflow, not sure why I didn't think of this before, but still..)
n8n can be easily be run with either npx or npm. Their self host install instructions all detail installation using docker or k8s, but I just wanted to have a node process running on a VPS with a workflow which can be triggered via a webhook.
Blog post: https://blog.n8n.io/how-to-set-up-n8n-via-pm2/
Initial set up
- Set up A record
- Install pm2:
sudo npm i -g pm2
- Install n8n:
sudo npm i -g n8n
- Start n8n using pm2:
pm2 start n8n
- Add nginx config as per blog post, symlink, restart nginx
- Add SSL certificate
- Browse to site, should get "Set up owner account" form
Configure to start automatically
pm2 startup
- Paste script into terminal as requested
Upgrade n8n
pm2 stop n8n
sudo npm update -g n8n
pm2 start n8n