DEV Community

Naman Vashistha
Naman Vashistha

Posted on

LimeDB: Unifying Installation with a Dedicated Script and Proxmox LXC Refactor

Github: namanvashistha/limedb

This commit introduces a significant refactor to the LimeDB installation process, primarily by creating a new, dedicated installation script (proxmox/install.sh) and adapting the existing Proxmox LXC setup script (proxmox/limedb_lxc.sh) to leverage this new unified installer.

What Changed

  1. New install.sh Script: A standalone bash script (proxmox/install.sh) has been added. This script encapsulates the entire process of installing LimeDB on a Debian-based system.

    • It manages dependency installation (curl, ca-certificates, wget).
    • It fetches the latest LimeDB binary for linux-amd64 directly from the official GitHub releases. It uses the GitHub API to dynamically retrieve the newest tag_name and includes a fallback version (v0.0.2) for robustness.
    • It creates and enables a systemd service (/etc/systemd/system/limedb.service) to run LimeDB as a background service, configured for automatic restart on failure.
    • It sets up a descriptive Message of the Day (MOTD) banner for users accessing the server.
    • Includes helper functions for colored informational, success, and error messages.
  2. limedb_lxc.sh Refactor: The Proxmox LXC helper script (proxmox/limedb_lxc.sh) has been updated to remove the previously embedded LimeDB installation logic. Instead, it now uses a new override_install function that points to the URL of the newly created install.sh script hosted on GitHub. This means the LXC script no longer contains the installation steps directly but rather fetches and executes the external install.sh.

Why the Change Was Needed

The primary motivation behind these changes is to enhance modularity, reusability, and maintainability of the LimeDB installation process.

  • Modularity: By extracting the installation logic into a dedicated script, the process is now self-contained and can be executed independently of the Proxmox LXC setup. This allows for easier installation of LimeDB on any compatible Linux system, not just within a Proxmox container.
  • Reusability: The install.sh script can now be directly used or referenced by other automation tools, scripts, or manual installations, promoting a consistent deployment experience across different environments.
  • Maintainability: Centralizing the installation logic means that any updates or fixes to how LimeDB is installed (e.g., new dependencies, changes in binary release names, service configuration adjustments) only need to be made in one place (install.sh). This reduces the chance of inconsistencies and simplifies future development.
  • Simplification of LXC Script: The limedb_lxc.sh script becomes leaner and more focused on its core task of setting up the LXC container, delegating application-specific installation to a specialized script.

Design Choices

  • Dynamic Latest Release Fetching: Utilizing the GitHub API for latest release tag_name ensures that users always install the most current stable version of LimeDB. This reduces manual intervention for version updates.
  • Systemd Integration: Standard systemd service creation provides robust process management, automatic startup on boot, and failure recovery, which is essential for a reliable key-value store.
  • Binary Installation to /usr/local/bin: This is a standard location for locally installed executable programs, making the LimeDB binary easily accessible from the system's PATH.
  • Direct Script Fetching in LXC: The LXC script directly fetches install.sh from the main branch of the GitHub repository. This ensures the LXC creation process always uses the very latest version of the installer script without needing to update limedb_lxc.sh itself for installer changes.

Trade-offs and Constraints

  • Running as root: The systemd service is configured to run LimeDB as the root user. While simplifying initial setup and avoiding permission issues, running services with elevated privileges can be a security concern in production environments where a dedicated, unprivileged user is often preferred for application processes.
  • External Dependency for LXC Script: The limedb_lxc.sh script now has an external dependency on the install.sh script hosted on GitHub. While convenient for dynamic updates, it means the installation process requires internet connectivity and is susceptible to GitHub's availability.
  • Fallback Version Limitation: In case of GitHub API issues, the fallback v0.0.2 is used. This ensures some installation can proceed but might not provide the desired up-to-date version.
  • Limited Configuration Options: The install.sh script provides a default installation without explicit options for custom configurations (e.g., custom data directories, different listening ports, user accounts) during the installation process. These would need to be manually configured post-installation.
  • Linux AMD64 Specific: The installer targets limedb-linux-amd64 exclusively, limiting its direct use to this architecture.

Future Implications

  • This modular approach paves the way for easier support for multiple installation methods (e.g., different operating systems, containerization solutions) by simply creating or adapting new installation scripts.
  • The install.sh script could be extended in the future to accept parameters for custom configurations, enhancing its flexibility for various deployment scenarios.
  • It simplifies automated testing and continuous integration workflows, as the installation steps are now standardized and repeatable.

Top comments (0)