From b06961d915791f3f7ef6de1db2dc365ab9258d7c Mon Sep 17 00:00:00 2001 From: Rizqi Date: Sun, 21 Jun 2026 12:22:22 +0700 Subject: [PATCH] feat: add PM2 ecosystem configuration and documentation for Web GUI deployment --- vsphere_backup/README.md | 32 ++++++++++++++++++++++++++++++ vsphere_backup/ecosystem.config.js | 23 +++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 vsphere_backup/ecosystem.config.js diff --git a/vsphere_backup/README.md b/vsphere_backup/README.md index b9b3df5..71a0584 100644 --- a/vsphere_backup/README.md +++ b/vsphere_backup/README.md @@ -23,3 +23,35 @@ Notes & caveats - The script attempts to use `zstd -19` if available; otherwise it falls back to Python `zstandard`. - SSL verification is disabled with `--no-verify-ssl` for convenience with self-signed vCenter/ESXi certs. - Test carefully in dev before using in production. This is a minimal DIY backup tool and does not replace a full backup product. + +## Web GUI + +A Flask-based web interface to manage your backups, schedules, and NFS mounts. + +### Running with PM2 (Recommended for Linux production) + +PM2 natively supports Python applications and can keep the server running across restarts. + +1. **Install PM2** (requires Node.js): + ```bash + npm install -g pm2 + ``` + +2. **Start the Web GUI**: + Using the provided `ecosystem.config.js`: + ```bash + pm2 start ecosystem.config.js + ``` + + *(Optional)* If you are running inside a Python virtual environment (e.g. `venv`), edit `ecosystem.config.js` to uncomment and point the `interpreter` to your venv's python executable: + ```javascript + interpreter: './venv/bin/python3' + ``` + +3. **Useful PM2 Commands**: + - Status: `pm2 status` + - Logs: `pm2 logs vsphere-backup-gui` + - Restart: `pm2 restart vsphere-backup-gui` + - Stop: `pm2 stop vsphere-backup-gui` + - Setup auto-start on server boot: `pm2 startup` and then run the command it outputs, followed by `pm2 save`. + diff --git a/vsphere_backup/ecosystem.config.js b/vsphere_backup/ecosystem.config.js new file mode 100644 index 0000000..58e7a92 --- /dev/null +++ b/vsphere_backup/ecosystem.config.js @@ -0,0 +1,23 @@ +module.exports = { + apps: [ + { + name: 'vsphere-backup-gui', + script: 'gui_app.py', + // If you are using a virtual environment (recommended), set the interpreter to: + // interpreter: './venv/bin/python3', + interpreter: 'python3', + cwd: './', + instances: 1, + autorestart: true, + watch: false, + max_memory_restart: '500M', + env: { + PORT: '5000', + SECRET_KEY: 'vsphere-backup-production-key-change-this' + }, + error_file: './logs/pm2_err.log', + out_file: './logs/pm2_out.log', + log_date_format: 'YYYY-MM-DD HH:mm:ss' + } + ] +};