How to set up durable data storage for n8n workflows?

Hey folks, I’m trying to figure out how to keep my n8n stuff safe when I restart my container. I’m using a cloud service with Jelastic and running n8n in Docker. The problem is, every time I restart, all my workflows and login info disappear. I’ve tried setting up a volume in my environment, but it’s not doing the trick. I know enough to be dangerous, but this is making my brain hurt. Any ideas on how to make my n8n data stick around? Thanks a bunch for any help!

yo dancingbutterfly, sounds like a tricky one! have u tried mounting a persistent volume to the n8n data directory? sumthin like ‘-v /path/on/host:/home/node/.n8n’ in ur docker run command. that should keep ur workflows n stuff safe even after restarts. if ur still stuck, mayb check the n8n docs for more deets on data persistence. good luck!

I’ve encountered similar issues with data persistence in containerized environments. One solution that worked well for me was implementing a dedicated database backend for n8n. PostgreSQL is a solid choice and integrates seamlessly with n8n. You’ll need to set up a separate PostgreSQL container or use a managed database service, then configure n8n to connect to it using environment variables. This approach ensures your workflows and credentials persist across container restarts and provides better scalability for larger deployments. It does require a bit more setup initially, but it’s worth it for the peace of mind and stability in the long run.

Hey there! I’ve been using n8n for a while now, and I totally get your frustration with data persistence. Here’s what worked for me: I set up an external Redis instance as a queue and cache for n8n. It’s pretty straightforward to implement and has been rock-solid for data retention.

To do this, you’ll need to spin up a Redis container alongside your n8n container. Then, configure n8n to use Redis by setting the appropriate environment variables in your Docker setup. Something like QUEUE_BULL_REDIS_HOST, QUEUE_BULL_REDIS_PORT, and N8N_CACHE_REDIS_HOST.

This approach not only solved my data persistence issues but also improved the overall performance of my workflows. It’s especially handy if you’re dealing with larger datasets or complex workflows.

Just remember to back up your Redis data regularly. Trust me, it’s saved my bacon more than once when things went sideways!