We now begin moving your previous data to a Dockerized Black Duck. The Black Duck migration can be broken down into four major steps: 1) preserve configuration and open source data from the existing version of Black Duck before uninstalling it, 2) uninstall the old version of Black Duck, 3) obtain configuration and orchestration files for Dockerized Black Duck, and 4) restore your Black Duck data.
Step 1: If you want to retain your existing data on your open source components, you must first back up your database. Begin by logging onto the Black Duck server as a Black Duck user. After you’re logged on, dump your data to a compressed file with three commands:
- Issue command: export PATH=SPATH:/opt/blackduck/hub/postgresql/bin
- Issue command: export PGPORT=55436
- Issue command: pg_dump -Fc -f /tmp/bds_hub.dump bds_hub
Be sure to save the bds_hub.dump file onto another system or offline!
Step 2: Now that the database is backed up, we can uninstall the old Black Duck server. Start by navigating to the app manager bin directory and issue a command to stop all bin processes:
- Issue command: cd /opt/blackduck/hub/appmgr/bin
- To stop all processes, issue command: ./StopAllProcesses.sh
Now we are ready to uninstall the application:
- Issue command: ./uninstall.sh
Step 3: Download the orchestration and configuration files. You need these files to install Black Duck and launch the Docker images.
- Go to Black Duck’s space on Github and select “blackducksoftware/hub”
- Download the latest version of Black Duck 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
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-<current version of hub (ex. 4.0.0)>.tar
- Within bin directory, there are two environment files (hub-proxy.env AND hub-webserver.env), which we use to configure the Web server and, if needed, proxy server
Now that we have the environment files, let’s configure the 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 eternal internet access. Specifics for using an external PostgreSQL instance and configuring proxy environment file are available in the Black Duck Docker Install Guide.
Step 4: Now that the old version of Black Duck is uninstalled and you have the configuration and orchestration files, we can run the migration script to restore your open source data. This transfers the data from the existing database dump file. Begin by downloading and starting three of the containers and volumes needed to migrate the database:
- Issue command: docker stack deploy -c docker-compose.dbmigrate.yml hub
Ignore the error messages if you have any, as they do not affect the data restoration. Now we are ready to run the migration script to restore your Black Duck data:
- Issue command: ./bin/hub_db_migrate.sh <path to dumpfile (ex. /tmp/bds hub.dump)>