2 min read

Backup Automation!

Backup Automation!
n8n.io logo

Well after setting up my backups to minio I realized that the process had no automation. I saw an option for cron and assumed it would let me run the container like that but it appears that's not the case.

I started off my automation process with testing jenkins and some other product that is exscaping my memory, both of them were taking 2gb+ of memory when sitting idle so I quickly got rid of them. I dug around some more and found n8n, after spinning it up and seeing it was using around 200 or so mb of memory I knew this was a good fit.

Here is the compose file I went with.

  n8n:
    container_name: n8n
    image: n8nio/n8n
    ports:
      - 5678:5678
    environment:
      GENERIC_TIMEZONE: "America/Toronto"
      TZ: "America/Toronto"
    volumes:
      - '/opt/config/n8n:/home/node/.n8n'

So my setup after this is pretty simple, I first use the schedule node to set the schedule I want to run the back on. I didn't want to have to modify the container to use this setup so that means I can't use docker commands or autorestic commands using the Execute Command node. I also have some issues with stale file handles on my NAS, so I added the HTTP Request node to get the health check of the minio container. If that containers health check fails than it uses the ssh node and restarts the minio container and then repeats the flow. This time it should succeed and then ssh onto the host and start the autorestic container. I also wanted a way to get a notification when the backup is finished so I went and setup a webhook on a private discord channel and it says me a message when the backup is done.

Now that everything is working properly I will repeat what I did last post with backblaze and then I'll have my backups there too. Minio is currently sitting at 8gbs with two backups so the storage there will be free till I hit 10 and even then it shouldn't be that expensive.

Happy I finally have a proper backup situation, I guess that means I also need to test it so I'll probably find a day to test that as well. I'll need to keep a backup compose for just autorestic for that restoration process to take place.