Skip to main content

PostgreSQL backup & restore CLI

Project description

koggi

  • PostgreSQL backup & restore CLI (early foundation).

Quick start

postgresql backup & restore CLI

1. INSTALL

pip install koggi

2. save settings in project root

# project-root/.env
KOGGI_DEFAULT_DB_NAME=db_name
KOGGI_DEFAULT_DB_USER=postgres
KOGGI_DEFAULT_DB_PASSWORD=password
KOGGI_DEFAULT_DB_HOST=localhost
KOGGI_DEFAULT_DB_PORT=5432
KOGGI_DEFAULT_SSL_MODE=prefer
KOGGI_DEFAULT_BACKUP_DIR=./backups
KOGGI_DEFAULT_ALLOW_RESTORE=true

3. download binary files

koggi binaries download

4. backup

koggi pg backup

5. restore

koggi pg restore

rclone cloud backup & restore CLI

1. INSTALL

rclone is required for cloud backup features.

2. initialize settings

koggi rc init

Creates .koggi/rclone/setting.json interactively. You can specify remote name, project name, and files/glob patterns to backup.

3. backup

koggi rc backup

Uploads configured files to <remote>:<project_name>/<timestamp>.

  • Use --dry-run to preview the files that will be uploaded.

4. restore

koggi rc restore

Interactively select a remote backup to restore.

  • Safety: If restoring overwrites existing local files, the conflicting files are automatically archived into .koggi/backup/restore-YYYYMMDD_HHMMSS.zip before being replaced.

5. delete

koggi rc delete

Interactive menu to manage remote backups:

  • Delete a specific backup
  • Delete ALL backups
  • Keep recent N backups and delete the rest

DB configuration examples (PostgreSQL)

  • Prepare a .env with at least one profile (DEFAULT example):
KOGGI_DEFAULT_DB_NAME=example
KOGGI_DEFAULT_DB_USER=postgres
KOGGI_DEFAULT_DB_PASSWORD=secret
KOGGI_DEFAULT_DB_HOST=localhost
KOGGI_DEFAULT_DB_PORT=5432
KOGGI_DEFAULT_SSL_MODE=prefer
KOGGI_DEFAULT_BACKUP_DIR=./backups
  • .env (dev1 example):
KOGGI_DEV1_DB_NAME=example
KOGGI_DEV1_DB_USER=postgres
KOGGI_DEV1_DB_PASSWORD=secret
KOGGI_DEV1_DB_HOST=localhost
KOGGI_DEV1_DB_PORT=5432
KOGGI_DEV1_SSL_MODE=prefer
KOGGI_DEV1_BACKUP_DIR=./backups
KOGGI_DEFAULT_ALLOW_RESTORE=false
  • List profiles: koggi config list
  • Test connection: koggi config test DEFAULT
  • Create backup: koggi pg backup -p DEFAULT
  • Restore latest: koggi pg restore -p DEFAULT
  • Check binaries: koggi binaries which

Notes

  • Embedded binaries: Koggi can use packaged PostgreSQL tools.
    • Place binaries under src/koggi/_bin/<os>-<arch>/:
      • Example tags: windows-x86_64, darwin-arm64, linux-x86_64.
      • Required files: pg_dump[.exe], psql[.exe], pg_restore[.exe].
    • Or put them in cache: %LOCALAPPDATA%/koggi/bin/<tag>/ (Windows) or ~/.cache/koggi/bin/<tag>/ (Unix).
    • You can override via env: KOGGI_PG_DUMP, KOGGI_PSQL, KOGGI_PG_RESTORE.
  • If no embedded binary is found, Koggi falls back to system PATH.
  • This is Phase 1 scaffold based on plan.md; more features will follow.

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

koggi-0.1.7.tar.gz (25.2 kB view details)

Uploaded Source

Built Distribution

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

koggi-0.1.7-py3-none-any.whl (36.1 kB view details)

Uploaded Python 3

File details

Details for the file koggi-0.1.7.tar.gz.

File metadata

  • Download URL: koggi-0.1.7.tar.gz
  • Upload date:
  • Size: 25.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.15

File hashes

Hashes for koggi-0.1.7.tar.gz
Algorithm Hash digest
SHA256 9b02d73eb56cd2ed7f5da7a58e3a6ff4e7456a1677466cdc56773cdea40a0830
MD5 544c703490cd525cf3f2935068da0c6c
BLAKE2b-256 b44d3b01fd25af995fa0b63f14fcc3d16c5ad01e474a499721a806c4a610be71

See more details on using hashes here.

File details

Details for the file koggi-0.1.7-py3-none-any.whl.

File metadata

  • Download URL: koggi-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 36.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.15

File hashes

Hashes for koggi-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 ceee2e0d3b2c16756b84c539cfd01da78f24f4e76c7f359f6f75e679f5af0a9f
MD5 9f4032f4fb29774aae31155a149dc383
BLAKE2b-256 4376f509381f55424a249e0bc86c1e66b2f913cba652729871f062d86b6f8480

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