Backup and Restore CLI

Command-line tool for automated directory backup with real-time change detection, built for the Koneksi Secure Digital Storage Solution.

Complete How-To Guide

Features

  • Real-time Monitoring: Automatically detects changes in specified directories

  • Single File Backup: Backup individual files on demand

  • Directory Compression: Compress entire directories into tar.gz archives before backup

  • Concurrent Backups: Efficiently backs up multiple files in parallel

  • Smart Detection: Only backs up files that have actually changed (using checksums)

  • Compression Support: Optional gzip/zlib compression to save storage space

  • Encryption Support: AES-256-GCM encryption for secure backups with password protection

  • Large File Support: Handle files up to 2GB with automatic compression recommendations

  • Database Tracking: SQLite database tracks all backup history and metadata

  • Comprehensive Reporting: Generates detailed JSON reports for each backup session

  • Full Restore Capability: Restore backed up files from manifest files

  • Auto-extraction: Automatically extract tar.gz archives after restore

  • Auto-decryption: Automatically decrypt encrypted files after restore

  • Configurable: Flexible configuration for directories, exclusions, and performance

Prerequisites

  • Go 1.19 or higher (for building from source)

  • Valid email address for registration

  • Internet connection

  • Operating System: Linux, macOS, or Windows

Installation

Option 1: Build from Source

Download the latest release for your platform from the releases pagearrow-up-right.

Option 2: Download Pre-built Binary

Download the latest release for your platform from the releases page.

circle-info

If you already have a verified Koneksi account, skip to Step 4: Configuration to set up your environment. Otherwise, follow the steps below to register, verify, and create API keys for programmatic access.

Step 1: User Registration

First, you need to create an account with Koneksi.

Expected Output:

Step 2: Account Verification

2.1 Login to Get Access Token

Expected Output:

2.2 Verify Your Account

Check your email for the 6-digit verification code, then:

Expected Output:

Step 3: Creating API Keys

API keys are used for programmatic access to the backup service.

Expected Output:

Important: Save the Client ID and Client Secret immediately. The Client Secret cannot be retrieved later.

Step 4: Configuration

4.1 Set Environment Variables (Quick Start)

This creates ~/.koneksi-backup/config.yaml. Edit it to add your credentials:

Step 5: Performing Backups

5.1 One-Time Backup of a Single File

5.2 Backup a Directory

5.3 Backup Directory as Compressed Archive

For faster uploads of directories with many files:

5.4 Continuous Monitoring (Daemon Mode)

Start the backup service to continuously monitor directories:

Expected Output for Backup:

Step 6: Restoring Files

6.1 Create a Restore Manifest

First, find your backup report:

Create a manifest from the report:

6.2 Restore Files

6.3 Restore with Auto-Extraction

If you backed up compressed directories:

Expected Output:

Encryption

The Koneksi Backup CLI supports AES-256-GCM encryption to secure your files before uploading to the cloud. This adds an extra layer of security for sensitive data.

Backup with Encryption

5.5 Encrypt Files During Backup

Expected Output:

Restore with Decryption

6.4 Restore and Decrypt Files

Expected Output:

Configuration-Based Encryption

You can enable encryption by default in your configuration file:

Security Best Practices for Encryption

  1. Strong Passwords: Use long, complex passwords with mixed characters

  2. Password Storage: Store passwords in environment variables or secure password managers

  3. Never Commit Passwords: Don't commit passwords to version control

  4. Rotate Passwords: Regularly change encryption passwords for enhanced security

  5. Backup Passwords: Ensure you have a secure backup of your encryption passwords

Example: Encrypting Sensitive Financial Data

Advanced Features

Directory Management

List All Backup Directories

Create a New Directory

Large File Handling

For files larger than 100MB, always compress first:

Complete Example Workflow

Here's a complete example from registration to restore:

Troubleshooting

Common Issues and Solutions

Authentication Errors

If this fails, check that your environment variables or config file contain valid credentials.

Email Verification Issues

  • Check spam folder for verification email

  • Ensure you're using a valid email domain (gmail.com, outlook.com, etc.)

  • Request a new verification code by logging in again

Large File Upload Failures

Permission Denied Errors

Ensure you have read permissions on files you're backing up:

Debug Mode

Run with debug logging for more information:

Best Practices

  1. Regular Backups: Use daemon mode (koneksi-backup run) for continuous protection

  2. Compress Large Files: Always compress files > 100MB before backup

  3. Encrypt Sensitive Data: Use encryption for confidential files (financial, personal, business data)

  4. Organize Directories: Create separate backup directories for different projects

  5. Test Restores: Periodically test restoring files to ensure backups are working

  6. Secure Credentials: Never commit API keys or encryption passwords to version control

  7. Monitor Reports: Check backup reports regularly for any failures

  8. Password Management: Use a password manager or secure vault for encryption passwords

Getting Help

  • Built-in Help: koneksi-backup --help

  • Command Help: koneksi-backup backup --help

  • Report Issues: https://github.com/koneksi-tech/koneksi-backup-cli/issues

  • Documentation: Check README.md for detailed configuration options

Next Steps

Now that you've completed the setup:

  1. Configure automatic backups for your important directories

  2. Set up a cron job for regular backup runs

  3. Create backup policies for different types of data

  4. Integrate with your existing backup workflows


Additional Resources

Last updated