Software Integrity

 

An introduction to installing the Black Duck Hub

An introduction to installing the Black Duck Hub

Black Duck Academy hosts a series of videos that help our customers deploy, manage, and use our products. To help our customers see value from the Black Duck Hub immediately after their purchase, this post supplements our video on installing the Hub. Think of this post as a quick way to get you started with the Dockerized Hub installation, outlining the workplace specifications as well as the tools and steps you’ll take to deploy the Hub.

The Hub is deployed as a set of Docker images. Docker is a packaging technology that allows you to bundle your application with its software dependencies—eliminating the need to configure infrastructure before deployment. It is built once and can run anywhere as a single unit. Operational images are typically referred to as containers.

Why Docker Architecture?

The Docker architecture brings a number of significant improvements to the Hub:

  • Simplifies installation and updates
  • Takes up less space than a comparable Virtual Machine (VM)
  • Scales to customer environment
  • Improves performance

The Black Duck Hub is deployed as a set of Docker containers, which together comprise the application. Each container fulfills a different role. For example, the Web App container processes UI requests while the Solr container acts as the enterprise search platform component. A detailed description of each container’s role is available in the Black Duck Hub Docker Install Guide on the Black Duck Customer Success Community.

Please ensure that you meet all of the hardware and software requirements before getting started:

Hardware (min. specs) Software Preferred Operating System
64-bit 5 core processor Docker 17.03.x or Docker 17.06.x (CE or EE) CentOS 7.3
20 GB of RAM Orchestration tool such as Docker Swarm**, Docker Compose, Docker Run, or Kubernetes. Ubuntu 16.04.x
250 GB of free space for the database and other Hub containers For additional information on supported orchestration techniques, consult the Docker Installation Guide. Oracle Enterprise Linux 7.3
Free space for database backups Red Hat Enterprise Linux Server 7.3
  SUSE Linux Enterprise Server 12.x
  Linux Operating Systems that support Docker 17.03.x

Setting up the Docker Repository on a New Host Machine

Note that the following steps depend on the operating system (OS). Also, while other methods are supported, this example uses the Docker Swarm tool to orchestrate the Hub container deployment and installation on a CentOS / Docker CE platform.

Step 1: To begin setting up Docker, install the required packages and set up the stable repository.

  • To install required utility packages, issue command: yum install -y yum-utils device-mapper-persistent-data lvm2
  • To set up the stable repository, issue command: yum-config-manager
    –add-repo

    https://download.docker.com/linux/centos/docker-ce.repo

Step 2: Update the yum package index and install the latest version of Docker.

  • To update the yum package index to ensure the latest available version of Docker is available, issue command: yum makecache fast
  • To install Docker, issue command: yum install docker-ce

Step 3:  Verify installation with a hello-world image, which runs a test image in a container. When it runs, Docker prints an informational message and then exits.

  • To start docker, issue command: systemctl start docker
  • To test an image in a container, issue command: docker run hello-world

Post installation (optional)

Step 4: Manage Docker as a non-root user so you won’t have to issue a sudo command every time you want to run a docker command. Start by creating a group called Docker.

  • To add a group, issue command: groupadd docker
  • To display groups to ensure your group was created, issue command: getent group
  • Then add yourself to the group. To add yourself to the group, issue command: usermod – aG docker $USER
  • Test that this was successful by running the hello-world image without writing “sudo” before it. Issue command: docker run hello-world

Step 5: Configure Docker to automatically start when your system reboots.

  • To have Docker start automatically, issue command: systemctl enable docker

Here are links to more information on installing Docker and Docker Swarm. Now that the Docker architecture has been set up, let’s install the Hub.

Installing the Hub

The Hub installation process can be broken down into three major steps: 1) download the .tar file needed for orchestration and configuration files, 2) unpack the .tar file and configure web server and, if needed, the proxy server environment files, and 3) install the Hub using an orchestration tool such as Docker Swarm

Step 1: Download the orchestration and configuration files. You need these files to install the Hub and launch the Docker images.

  • Go to Black Duck Hub’s space on GitHub and select “blackducksoftware/hub”
  • Download the latest version of the Hub by scrolling down and copying the first link under “Hub Docker Orchestration Files/Documentation”
    • Issue command: wget *paste link above*
      Example:
       wget https://github.com/blackducksoftware/hub/archive/v4.4.0.tar.gz

Step 2: Unpack .tar file and configure Web server and, if needed, proxy server settings.

  • Unpack the .tar file on a server
    • Issue command: tar xvf -hub docker-<currentversionofhub(ex. 4.0)>.tar
    • Within bin directory, there are two environment files (hub-proxy.env AND hub-webserver.env), which we’ll use to configure Web server and, if needed, proxy server
  • Configure Web server and, if needed, proxy server settings
    • Edit the Web server environment file
      • Issue command: vi hub-webserver.env
      • The environment variable has the service name set as default value. Change this to the host name so that the certificate host name matches
    • Configure the proxy settings using the proxy environment file. This must be configured if you require proxy for external internet access. Specifics for using an external Postgres instance and configuring a proxy environment file are available in the Black Duck Hub Docker Install Guide.

Step 3: Install the Dockerized Hub with the PostgreSQL database instance. Begin by initializing Docker swarm, creating a single node swarm.

  • Navigate into the orchestration subfolder. For example: cd /opt/blackduck/hub-4.4.0/docker-swarm
  • Issue command: docker swarm init

We’re ready to install the Hub; this deploys all of the containers that comprise the Hub.

  • Issue command: docker stack deploy -c docker-compose.yml hub

Certain Docker orchestration techniques allow scalability by allowing admins to choose the number of active job runner containers.

  • For a Docker Swarm deployment, issue the command: docker service scale hub_jobrunner=2

Verify Installation Completion

Confirm Installation was successful by running the docker ps commands.

  • Ensure all container statuses are listed as “healthy”
    • To do this, issue command: docker ps
  • The web application for the Hub is exposed on port 443 to the docker host. You can test it using https://fillinyourhostnameorIPaddresshere
  • Log into the web interface using the default sysadmin account. The username is sysadmin; the password is blackduck.
  • Change the password so that your web server is secure. To do this, click on the sysadmin in the upper right-hand corner, and select “My profile.”

Watch the video on installing the Black Duck Hub at Black Duck Academy.

 

More by this author