@hellosufian/vps-mongo-redis-manager
v1.0.8
Published
PowerShell scripts for managing MongoDB and Redis on a VPS
Downloads
58
Maintainers
Readme
VPS Database Manager
Automation tool for installing, testing, and managing MongoDB 8.0, PostgreSQL, and Redis on an Ubuntu VPS.
🚀 Quick Start
1. NPX CLI (Recommended)
Run directly using npx:
npx @hellosufian/vps-mongo-redis-manager <action> <service>Available Actions: setup, test, remove
Available Services: mongo, postgres, redis
Examples:
npx @hellosufian/vps-mongo-redis-manager setup mongo
npx @hellosufian/vps-mongo-redis-manager test redis
npx @hellosufian/vps-mongo-redis-manager remove postgres2. NPM Scripts
If cloned locally:
# MongoDB
npm run setup:mongo
npm run test:mongo
npm run remove:mongo
# PostgreSQL
npm run setup:postgres
npm run test:postgres
npm run remove:postgres
# Redis
npm run setup:redis
npm run test:redis
npm run remove:redis3. Direct PowerShell Execution (Windows)
powershell -ExecutionPolicy Bypass -File .\setup-mongodb-vps.ps1
powershell -ExecutionPolicy Bypass -File .\setup-postgres-vps.ps1
powershell -ExecutionPolicy Bypass -File .\setup-redis-vps.ps14. Interactive Bash Manager (Linux / Direct on VPS)
If running directly on an Ubuntu VPS terminal:
sudo ./manager.sh📋 Required Inputs Reference
When executing any script or CLI command, you will be prompted for specific inputs. Below is the full breakdown of inputs required for each service and action:
🍃 MongoDB Commands
| Input Parameter | Description | Default Value | Required For |
| :--- | :--- | :--- | :--- |
| VPS IP | IP Address of target VPS (e.g. 168.231.79.31) | None | Windows SSH remote |
| VPS Root Password | Root SSH password for target VPS | None | Windows SSH remote |
| MongoDB Port | Target Port for MongoDB | 27018 | setup, test, remove |
| MongoDB User | Admin Username | admin | setup, test |
| MongoDB Password | Admin Password | Required | setup, test |
| MongoDB Database | Database Name | mydatabase | setup |
Generated Connection URI:
mongodb://<USER>:<PASS>@<VPS_IP>:<PORT>/<DB>?authSource=admin&replicaSet=rs0
🐘 PostgreSQL Commands
| Input Parameter | Description | Default Value | Required For |
| :--- | :--- | :--- | :--- |
| VPS IP | IP Address of target VPS (e.g. 168.231.79.31) | None | Windows SSH remote |
| VPS Root Password | Root SSH password for target VPS | None | Windows SSH remote |
| PostgreSQL Port | Target Port for PostgreSQL | 5432 | setup, test, remove |
| PostgreSQL User | Username to create / connect | admin | setup, test |
| PostgreSQL Password | User Password | Required | setup, test |
| PostgreSQL Database | Database Name | mydatabase | setup, test |
Generated Connection URL:
postgresql://<USER>:<PASS>@<VPS_IP>:<PORT>/<DB>
🔴 Redis Commands
| Input Parameter | Description | Default Value | Required For |
| :--- | :--- | :--- | :--- |
| VPS IP | IP Address of target VPS (e.g. 168.231.79.31) | None | Windows SSH remote |
| VPS Root Password | Root SSH password for target VPS | None | Windows SSH remote |
| Redis Port | Target Port for Redis | 6379 | setup, test, remove |
| Redis Password | Requirepass Auth Password | Required | setup, test |
Generated Connection URI:
redis://:<PASS>@<VPS_IP>:<PORT>
⚡ What Each Script Does
MongoDB Setup (setup-mongodb-vps.ps1)
- Updates Ubuntu packages (
apt update & upgrade). - Installs MongoDB 8.0 official repo and
mongodb-org. - Configures
/etc/mongod.conf(bindIp: 0.0.0.0, custom port). - Creates Admin user with
rootrole. - Generates
/etc/mongo-keyfileand enables authentication + Single-Node Replica Set (rs0). - Configures UFW firewall rule for the specified port.
PostgreSQL Setup (setup-postgres-vps.ps1)
- Installs PostgreSQL &
postgresql-contrib. - Configures
listen_addresses = '*'and updatespg_hba.conffor MD5 auth. - Creates custom Database, User, and assigns privileges.
- Opens custom port in UFW.
Redis Setup (setup-redis-vps.ps1)
- Installs
redis-server. - Binds to
0.0.0.0, sets custom port, and enablesrequirepasspassword authentication. - Enables and restarts
redis-server. - Opens custom port in UFW.
📄 License
ISC
