A practical, reusable toolkit for backing up, migrating, restoring, and deploying full-stack Node.js applications on Ubuntu VPS servers.
Born from real migrations (including a DigitalOcean UniSphere ERP project). Simple, reliable, and safe — with an interactive menu that covers the full lifecycle from server bootstrap to health checks.
Developed by Saikumar Madel
---Moving a production app between servers is stressful. You need:
- A complete snapshot of the app, env, database, process manager, reverse proxy, and certificates
- A clear restore path that doesn't leave you guessing
- Safety rails so you don't accidentally overwrite a live server
- Shared utilities and logging so every script behaves consistently
This toolkit gives you that foundation.
git clone https://github.com/SaikumarMadel/DevOps_Toolkit.git
cd DevOps_Toolkit
chmod +x toolkit.sh backup/*.sh deploy/*.sh
# Interactive menu
./toolkit.sh
# Or run scripts directly
./backup/backup_project.sh /var/www/myapp /root/backups db.example.com 25060 doadmin "erp_system admin"
sudo ./deploy/deploy_project.sh /root/Project_Backup_....tar.gz /var/www/myappSee docs/QUICK_START.md and docs/MIGRATION.md.
| Feature | Status |
|---|---|
| Application source backup | ✅ |
.env / secret files |
✅ |
| MySQL / MariaDB dump | ✅ |
| Standalone DB backup | ✅ |
| Guided DB restore + checksum | ✅ |
Server bootstrap (install_server) |
✅ |
| Configure Nginx site | ✅ |
| Configure PM2 process | ✅ |
| SSL obtain / renew / status | ✅ |
| Health check report | ✅ |
| Docker status & volume backup | ✅ |
| Compose up / down / ps | ✅ |
| Feature | Status |
|---|---|
| Interactive menu | ✅ |
| Shared utilities + file logging | ✅ |
Config file (toolkit.conf) |
✅ |
| Safe / full restore modes | ✅ |
| Colorized step-by-step UI | ✅ |
| PM2 / Nginx / SSL in project backup | ✅ |
| System + package inventory | ✅ |
| ShellCheck + CI | ✅ |
DevOps_Toolkit/
├── toolkit.sh # Interactive entrypoint
├── toolkit.conf # Defaults (backup dir, retention, Node version…)
├── backup/
│ ├── backup_project.sh # Full project backup
│ └── backup_database.sh # Standalone DB dump
├── deploy/
│ ├── deploy_project.sh # Restore & deploy
│ ├── restore_database.sh # Guided DB restore
│ ├── install_server.sh # Bootstrap fresh Ubuntu VPS
│ ├── configure_nginx.sh # Reverse-proxy site block
│ ├── configure_pm2.sh # Start / restart app with PM2
│ ├── manage_ssl.sh # Certbot obtain / renew / status
│ ├── health_check.sh # Stack health report
│ └── docker_tools.sh # Docker status, volume backup, compose
├── utils/
│ ├── colors.sh
│ ├── logger.sh
│ ├── common.sh
│ ├── validation.sh
│ └── prompts.sh
├── templates/
│ ├── .env.example
│ ├── ecosystem.config.js.example
│ ├── nginx.conf.example
│ └── docker-compose.yml.example
├── docs/
│ ├── QUICK_START.md
│ └── MIGRATION.md
├── examples/
├── logs/ # Runtime logs (gitignored contents)
├── backups/ # Local backup dir (gitignored contents)
├── .github/workflows/
│ └── shellcheck.yml
├── CHANGELOG.md
├── CONTRIBUTING.md
├── CODE_OF_CONDUCT.md
├── LICENSE
└── README.md
backup_YYYY-MM-DD_HH-MM-SS/
├── application.tar.gz # Application source (see exclusions)
├── database.sql.gz # mysqldump with routines, events, triggers
├── nginx.tar.gz # /etc/nginx
├── pm2.tar.gz # ~/.pm2
├── ssl.tar.gz # /etc/letsencrypt
├── packages.txt # dpkg --get-selections
├── system_info.txt # hostname, OS, runtimes, disk, memory
└── .env* # Discovered environment files
Printed at runtime and skipped from application.tar.gz:
| Pattern | Why |
|---|---|
node_modules |
Reinstall with npm ci / yarn / pnpm |
.git |
Clone from remote instead |
dist |
Compiled frontend (Vite, webpack, …) |
build |
Compiled output (CRA, etc.) |
.next |
Next.js build cache & output |
coverage |
Test coverage reports |
*.log |
Log files |
.DS_Store |
macOS metadata |
After restore: run npm ci (or equivalent) and rebuild frontend assets as needed.
==============================
DevOps Toolkit
==============================
1) Backup Project
2) Restore / Deploy Project
3) Backup Database
4) Restore Database
5) Install Server
6) Configure Nginx
7) Configure PM2
8) SSL Management
9) Health Check
10) Docker Tools
11) Exit
- OS: Ubuntu 22.04 / 24.04 LTS
- Runtime: Node.js (any LTS), Express, React / Vite, Next.js
- Process manager: PM2
- Web server: Nginx
- Database: MySQL / MariaDB (including managed)
- Certificates: Let's Encrypt (Certbot)
- Containers: Docker + Compose (optional tools)
- 3-2-1 rule: 3 copies, 2 media types, 1 off-site
- Never commit real
.envfiles - Test a full restore on a disposable VPS before decommissioning the source
- Rotate passwords and API keys after migration
- Set
BACKUP_KEEP_DAYSfor scheduled backups - Prefer
MYSQL_PWDonly in controlled environments
./backup/backup_database.sh db.example.com 25060 doadmin "erp_system admin" /root/backups
./deploy/restore_database.sh /root/backups/db_....sql.gz db.example.com 25060 doadminSet FORCE_RESTORE=1 to skip the restore confirmation (use carefully).
sudo ./deploy/install_server.sh --node-major 20
sudo ./deploy/install_server.sh --with-certbot --node-major 22./deploy/health_check.sh
./deploy/health_check.sh --project /var/www/myapp --url https://example.com/health
./deploy/health_check.sh --db-host db.example.com --db-port 25060 --db-user doadmin
./deploy/health_check.sh --jsonsudo ./deploy/configure_nginx.sh --domain example.com --port 3000 --www
./deploy/configure_pm2.sh --project /var/www/myapp --name myapp --script server.js --port 3000
sudo ./deploy/manage_ssl.sh obtain --domain example.com --www --email you@example.com
sudo ./deploy/manage_ssl.sh status./deploy/docker_tools.sh status
./deploy/docker_tools.sh backup-volumes --dir /root/backups
./deploy/docker_tools.sh compose-up --project /var/www/myapp- Auto-detection of stack (Express, Vite, PM2, …)
- PostgreSQL, Redis, MongoDB
- Encrypted backups (GPG / age)
- Cloud provider docs (DigitalOcean, AWS, Oracle, Azure, Hetzner, …)
- YAML config, dry-run mode, remote SSH
- Database restore is intentionally confirmation-gated. Automatic import can destroy data.
--fulldeploy overwrites system Nginx and SSL paths — use only on a clean or intentionally targeted server.- Always verify backup contents before deleting the source server.
See CONTRIBUTING.md and CODE_OF_CONDUCT.md.
MIT — free to use, modify, and distribute.
Originally built while migrating production workloads. Use it, improve it, share it.
Developed by Saikumar Madel
