OpenNebula / one-apps

Toolchain to build OpenNebula appliances
Apache License 2.0
12 stars 9 forks source link

F: Implementation of Harbor-based Docker Registry Appliance for OpenNebula Marketplace #79

Closed pablodelarco closed 2 months ago

pablodelarco commented 3 months ago

Harbor Docker Registry Appliance for OpenNebula Marketplace

Feature Description

Implementation of a Harbor-based Docker registry appliance for publication in the OpenNebula Marketplace. This appliance will provide a robust and secure Docker registry environment using Harbor.

Main Characteristics:

Use Case

As part of the 6GSandbox project, this Docker registry appliance will enhance the OneKE offer by allowing organizations to easily deploy and manage their own Docker registries.

Data Model

Inputs:

Actions:

Documentation

This section will cover the deployment and management of the Harbor-based Docker registry appliance, including:

Tests

Test Descriptions:

Testing Environment:

Other Considerations

Security Implications:

New Files:

References

Work Plan

Step-by-Step Installation Guide

1. Update and Install Necessary Packages

sudo apt update && sudo apt install openssl ca-certificates curl gnupg -y

2. Set Up Docker Repository

sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo $VERSION_CODENAME) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y

3. Generate SSL Certificates

mkdir certs
openssl req -x509 -nodes -days 730 -newkey rsa:4096 -sha256 -keyout certs/harbor.testlab.local.key -addext "subjectAltName = DNS:harbor.testlab.local" -out certs/harbor.testlab.local.crt
sudo mv certs/harbor.testlab.local.crt /etc/ssl/certs/
sudo mv certs/harbor.testlab.local.key /etc/ssl/private/

4. Download and Install Harbor

curl -s https://api.github.com/repos/goharbor/harbor/releases/latest | grep browser_download_url | cut -d '"' -f 4 | grep '\.tgz$' | grep online | wget -i -
tar -xvzf harbor-online-installer-v.tgz
cp harbor.yml.tmpl harbor.yml
nano harbor.yml  # Modify the paths of certificate and private_key
sudo ./install.sh

Note: In the harbor.yml file, set the certificate and private_key fields to /etc/ssl/certs/harbor.testlab.local.crt and /etc/ssl/private/harbor.testlab.local.key, respectively.

5. Clean Up

sudo apt-get clean
sudo rm -rf /var/lib/apt/lists/*

6. Convert VM Disk to QCOW2 Image

sudo qemu-img convert -f raw -O qcow2 /dev/xvda1 converted.qcow2
gzip converted.qcow2