GigHive bee gighive

GigHive Music and Video Library

GigHive is an open-source deployment framework for hosting your own media library, a band’s library or fan videos, or even videos uploaded by guests from events like a wedding. There are two pieces to Gighive:

The automation spins up a fully reproducible environment using Docker, Ansible, and Terraform. It has a very simple interface: a splash page, a single database of stored videos and an upload utility.

This project is designed to be portable, easy to deploy, and suitable for local development or cloud environments (Azure supported out of the box).

Components

Software

Prerequisites for all installs

Architecture (logical)

GigHive Architecture Diagram

Click the diagram above to view full size

Suggested Platforms

Gighive runs very efficiently on an Orange Pi 5 or GMKtech mini PC. Stuff a few NVMe’s in either and you’ll have plenty of storage for your videos. We’ve tested on both of them.


⚙️ Prerequisites: Install Ansible and Python to your controller machine.

  1. Decide on where you will install Ansible as the controller and what target (virtualbox or Azure) that you will install Gighive on.
    • If you are going to install on a virtualbox VM, find an open IP address to use in your network.
    • If you are going to install to Azure, Azure will provision an IP for you.
    • In either case, the install will ask you to add the IP to the appropriate Ansible configuration inventory file.
    • See Ansible core files discussion for more info on how Ansible’s configuration works .
  2. Log onto that server and install Ansible:
    sudo apt update && sudo apt install -y pipx python3-venv git
    pipx ensurepath
    
  3. Log out.

  4. Log back in.
    pipx install --include-deps ansible
    ansible --version # Should be 2.17.2 or higher
    
  5. Clone the repo from your desired location (usually /home/$USER).
    • The repo has some sample media files, so it’s about 690MB in size.
    • Takes a few minutes to download on an average connection.
      git clone https://github.com/gighive/gighive
      
  6. Wherever you have installed gighive to, set the GIGHIVE_HOME variable and test to see if it’s correct.
    • Example: GIGHIVE_HOME is located in user’s home directory.
      export GIGHIVE_HOME=/home/$USER/gighive
      echo $GIGHIVE_HOME
      cd $GIGHIVE_HOME
      
  7. Add GIGHIVE_HOME export to your .bashrc.
    echo "export GIGHIVE_HOME=/home/$USER/gighive" >> ~/.bashrc
    
  8. Make sure you have id_rsa.pub in ./ssh for passwordless authentication.
    ssh-keygen -t rsa
    

⚙️ Option A: Gighive as a virtualbox VM. Install Gighive as a vm on your Ansible controller machine.

  1. Install Virtualbox using Ansible.
    • Default shown below is the virtualbox install.
    • install_virtualbox=true will be set in the below Ansible command.
    • The script will ask for your sudo password, so enter it in when prompted.
      ansible-playbook -i ansible/inventories/inventory_bootstrap.yml ansible/playbooks/install_controller.yml -e install_virtualbox=true -e install_terraform=false -e install_azure_cli=false --ask-become-pass
      
  2. Reboot.

  3. Verify the installation.
    cd $GIGHIVE_HOME
    ansible-playbook -i ansible/inventories/inventory_bootstrap.yml ansible/playbooks/verify_controller.yml  -e target_provider=vbox -e install_virtualbox=true -e install_terraform=false -e install_azure_cli=false
    
  4. Update your Ansible control target, the IP of the VM that will run the Gighive Apache web server and MySQL database.
    • In the inventory file below, set the “ansible_host” variable to the IP address to the IP address you decided upon in the Prerequisites.
      vi ansible/inventories/inventory_bootstrap.yml 
      
  5. Execute the Ansible playbook that will install Gighive.
    ansible-playbook -i ansible/inventories/inventory_bootstrap.yml ansible/playbooks/site.yml --ask-become-pass
    
  6. If Step 13 ran without error, CONGRATULATIONS!! You’ve installed Gighive!! Now access it in a browser:
    https://<ansible_host IP from step 11>
    

OPTIONAL: It is helpful to set an alias in your .bashrc to access the vm you’ve created so you can check it out.

alias gighive='ssh ubuntu@<ansible_host value found in ansible/inventories/inventory_virtualbox.yml>"

Option B: Gighive as an Azure VM. Install Gighive on Azure (requires an Azure subscription).

Make sure prerequisites from above are installed.

  1. Export Azure Vars (as noted at top of 2bootstrap.sh)
    export ARM_SUBSCRIPTION_ID=[put your subscription id here]
    export ARM_TENANT_ID=[put your tenant id/mgmt group id here]
    

    or, if you have azure.env configured with these exports, just:

    source ./azure.env
    
  2. Provision infrastructure. Run ./2bootstrap.sh. Watch for and respond to these prompts: .. apply Terraform plan .. update the ansible inventory file .. run the ansible_playbook
    ./2bootstrap.sh
    
  3. If Step 2 ran without error, CONGRATULATIONS!! You’ve installed Gighive!! Now access it in a browser:
    https://<ansible_host IP cpatured from the install>
    

OPTIONAL: If you’re finished with the VM, delete all resources in Azure

cd $GIGHIVE_HOME;./3deleteAll.sh 

⚙️ Setup & Installation


📂 Repository Structure

├── 1prereqsInstall.sh
├── 2bootstrap.sh
├── 3deleteAll.sh
├── ansible
│   ├── inventories
│   │   ├── group_vars
│   │   ├── inventory_azure.yml
│   │   ├── inventory_azure.yml.j2
│   │   ├── inventory_baremetal.yml
│   │   └── inventory_virtualbox.yml
│   ├── playbooks
│   │   └── site.yml
│   ├── roles
│   │   ├── base
│   │   ├── blobfuse2
│   │   ├── cloud_init
│   │   ├── cloud_init_disable
│   │   ├── docker
│   │   ├── mysql_backup
│   │   ├── nfs_mount
│   │   ├── post_build_checks
│   │   ├── security_basic_auth
│   │   ├── security_owasp_crs
│   │   ├── validate_app
│   │   └── varscope
│   └── vdiLockedWriteDelete.sh
├── ansible.cfg
├── assets
│   ├── audio
│   └── video
├── azure.env
├── azure-prereqs.txt
├── CHANGELOG.md
├── docs
│   ├── index.html
│   ├── PREREQS.md
│   └── README.md
├── inventory.ini
├── terraform
│   └── variables.tf
└── tree.txt

License

GigHive is dual-licensed:


🤝 Contributing

Contributions welcome! Please open issues and pull requests.

👉 Contact us for commercial licensing or for any other questions regarding Gighive. GigHive bee mascot