Skip to content

Latest commit

 

History

History
67 lines (50 loc) · 4.94 KB

File metadata and controls

67 lines (50 loc) · 4.94 KB

how Brenthy's installation process works For user instructions on how to install Brenthy using an automated installer, see ../User/Installation.md. For instructions on how to install Brenthy and its components manually, see ../User/ManualInstallation.md

Brenthy Installation

Installation Form

Even when installed, Brenthy runs from source. The source files are installed to a safe location where they are unlikely to be touched by other processes. A dedicated Python virtual environment (virtualenv, consisting of a Python interpreter and modules (Python libraries) which Brenthy needs) is installed alongside the source code, which is the Python environment that runs Brenthy. Using a dedicated Python environment avoids the problem of conflicting dependencies of modules which Brenthy needs and those installed by the OS. Brenthy can of course still be run from source without being installed using the OS-global Python interpreter. Instructions on how to do so are in ../User/RunningFromSource.md

Purpose of Installation:

  • to move Brenthy's source code out of the way
    • in a secure location safe from accidental or malicious threats
  • to allow Brenthy to automatically start at system boot
  • to allow Brenthy to automatically update itself
  • to avoid conflicts between Brenthy's Python dependencies and those installed by the OS or user
  • to allow the user to manage Brenthy as a standard OS-installed service (using standard tools such as systemd on Linux)

Installation Scripts & Variants:

The Brenthy installer programs are bash scripts located in Brenthy/InstallScripts. Brenthy itself can run these scripts, so the user can install Brenthy by running it in Python. Separate bash scripts are used for different operating system environments (currently only for Linux with Systemd). Also, separate shell scripts exist for installing Brenthy with the CPython and PyPy interpreters.

Installation Procedure:

Brenthy's installation procedure can be started whenever it is run from source.

code: Brenthy/run.py

Unless the --dont-install flag is passed when running Brenthy, Brenthy offers to install itself whenever it is run, prompting the user to type 'y' into the console if they want to.
Brenthy will install itself without asking if the --install or --install-dont-run flags are passed.

Brenthy's installation manager has the following procedure: code: Brenthy/install.py

  1. Assert that the current operating system is supported for installation.
  2. Unless --install or --install-dont-run flags are passed, ask the user if Brenthy should install itself.
  3. Check if Kubo (the most popular/best IPFS implementation) is installed, and if not ask the user whether to install it first (probably should, as Brenthy depends on IPFS).
  4. Install IPFS by running the shell script corresponding to the OS located under Brenthy/InstallScripts. For Linux systems running systemd, this is Brenthy/InstallScripts/install_ipfs_linux_systemd.sh
  5. Execute the OS-compatible Brenthy installation shell script from Brenthy/InstallScripts to install Brenthy. For Linux systems running systemd, this script is Brenthy/InstallScripts/install_brenthy_linux_systemd_cpython.sh

The Brenthy installation shell script takes four parameters as input: code: Brenthy/InstallScripts

  • install_dir: directory in which to install Brenthy
  • data_dir: the directory in which Brenthy should store its blockchain-types data
  • run_installation: whether or not the installed Brenthy instance should be run after installation

The core installation procedure executed by the shell script is as follows:

  1. Create the installation directory.
  2. If the user specified a custom data-directory (the data_dir parameter), create a symlink from the default data-directory to the user-defined data-directory.
  3. Copy Brenthy's source code (the very code that is currently running) to the installation directory.
  4. Create an OS-user called brenthy.
  5. Set file permissions on the installed source code and data directory, with the new brenthy user as owner.
  6. Create a Python environment for Brenthy, by installing a CPython or PyPy interpreter in the Python subfolder of the installation directory and then installing all required Python modules there.
  7. Register Brenthy as a service on the operating system, to be run at system boot by executing the installed Brenthy code using the installed Python virtual environment using the brenthy user. How this service registration is done depends on the operating system:
    • Linux with systemd: a systemd configuration file is created at /etc/systemd/system/brenthy.service
  8. If the run_installation parameter was set to true, start the installed Brenthy service.