Skip to main content

A modern CLI tool for managing databases on VPS systems with SSL support

Project description

CLIDB - Simple Database Management CLI

A command-line tool for managing databases on VPS systems using Docker containers. Supports multiple database types and provides ready-to-use connection strings.

Supported Databases

  • PostgreSQL (versions 11-16)
  • MySQL (8.0, 5.7)
  • MariaDB (11.0, 10.11, 10.10)
  • Redis (7.2, 7.0, 6.2)
  • MongoDB (7.0, 6.0, 5.0)
  • Neo4j (5, 4.4)

Prerequisites

  • Python 3.8 or higher
  • Docker installed and running
  • pip (Python package installer)

Installation

pip install clidbs

Usage

Create a Database

# Create a PostgreSQL database (latest version)
clidb create mydb

# Create a specific version
clidb create mydb --type postgres --version 16

# Create other database types
clidb create myredis --type redis --version 7.2
clidb create mymongo --type mongo
clidb create mysql1 --type mysql --version 8.0

The tool will output connection details including:

  • Connection string (ready to copy/paste)
  • CLI command with credentials
  • Host/IP address (automatically detected)
  • Port, user, and password

Manage Databases

# List all databases
clidb list

# Stop a database
clidb stop mydb

# Start a database
clidb start mydb

# Remove a database
clidb remove mydb

# See supported databases and versions
clidb supported

# View database connection details
clidb info mydb

# Reset database password
clidb info mydb --reset-password

or 

# Create a ClickHouse database
clidb create myanalytics --type clickhouse --version 23.12

# Create a KeyDB instance
clidb create mycache --type keydb --version 6.3

# Create a MariaDB database with latest version
clidb create mydb --type mariadb --version 11.2

Public vs Private Access

# Create with public access (default)
clidb create mydb --access public

# Create with private access (localhost only)
clidb create mydb --access private

Discord Notifications

Enable notifications by:

  1. Setting the webhook URL in command:
clidb create mydb --discord-webhook "YOUR_WEBHOOK_URL"
  1. Or using environment variable:
export CLIDB_DISCORD_WEBHOOK="YOUR_WEBHOOK_URL"

SSL Setup

Important Prerequisites:

  • A clean VPS with no existing web server configurations
  • No other services running on ports 80 or 443
  • A domain name pointing to your VPS's IP address
  • Root or sudo access to the VPS
# Setup SSL for a database
clidb ssl mydb example.com --email admin@example.com

The SSL setup process will:

  1. Install and configure Nginx
  2. Install Certbot
  3. Obtain SSL certificates
  4. Configure your database to use SSL

Note: Due to potential conflicts with existing web servers or configurations, it's highly recommended to perform SSL setup on a clean VPS installation.

Configuration

Environment variables:

  • CLIDB_DISCORD_WEBHOOK: Discord webhook URL
  • CLIDB_HOST_IP: Override auto-detected IP address
  • CLIDB_DEFAULT_DB: Default database type (defaults to "postgres")
  • CLIDB_DEFAULT_PORT: Default port for the database

Security

Credential Storage

  • Database credentials are stored in ~/.config/clidb/credentials.json
  • The directory has 700 permissions (only owner can access)
  • The credentials file has 600 permissions (only owner can read/write)
  • Credentials are stored locally on your VPS

Best Practices

For secure operation, ensure your VPS follows these security practices:

  • Use SSH key-based authentication (disable password authentication)
  • Disable root SSH login
  • Keep your system and packages updated
  • Use strong passwords for all services
  • Configure your firewall properly
  • Regularly monitor system logs

Credential Management

  • Use clidb info to safely view stored credentials
  • Use --reset-password to change database passwords
  • Credentials are automatically removed when using clidb remove
  • Never share or backup the credentials file in unsecured locations

License

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

clidbs-2.26.0.tar.gz (19.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

clidbs-2.26.0-py3-none-any.whl (21.6 kB view details)

Uploaded Python 3

File details

Details for the file clidbs-2.26.0.tar.gz.

File metadata

  • Download URL: clidbs-2.26.0.tar.gz
  • Upload date:
  • Size: 19.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.7

File hashes

Hashes for clidbs-2.26.0.tar.gz
Algorithm Hash digest
SHA256 6686771feaa00335f2c18dfca74658923b384732cf06bf2b7ee99b55880669c7
MD5 d50375bebf441d16a846dbed7d6f5de5
BLAKE2b-256 2cba54fad9c2581407b34472b82ed7a153e20f6f907f44c2209de567d0de0384

See more details on using hashes here.

File details

Details for the file clidbs-2.26.0-py3-none-any.whl.

File metadata

  • Download URL: clidbs-2.26.0-py3-none-any.whl
  • Upload date:
  • Size: 21.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.7

File hashes

Hashes for clidbs-2.26.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a41095db60e5ddef6926b1c81665f7c5f04f382079217e924f08ca4c22109fff
MD5 20be75ac4a3da34b0a6a4133e37d8229
BLAKE2b-256 2ddb82279a9e72e9a4ea450c00c7ce8a00134f65383a89ca4b3a3d98bffd3fe3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page