Update Script for n8n with backup for default Docker install and Sqlite

Just wanted to share a quick a dirty “upgrade/update n9n” shell script that works great for me

# Backup DB file SQLite
cp  -pf .n8n/database.sqlite ./database.sqlite.backup

# export workflows and credentials to json
/usr/bin/docker exec  -u node -t n8n-digital-ocean_n8n_1 n8n export:workflow --backup --output=/files/backups
/usr/bin/docker exec  -u node -t n8n-digital-ocean_n8n_1 n8n export:credentials --all --output=/files/backups/c.json

# Pull latest version
docker-compose pull

# Stop and remove older version
docker-compose down

# Start the container
docker-compose up -d
2 Likes