Running DarkLight as a Docker Container in CentOS

Dockerizing DarkLight Server and using Docker Compose to instantiate a DarkLight instance provides a much smoother and quicker deployment than the traditional installation method. Each time DarkLight is run it essentially downloads and builds the latest version.

NOTE

You should do the following procedure as a user that has sudo permissions. Don't login as root (why not?)

Firewall should allow the following ports:

  • 41617/tcp Connection between client/server (Active MQ)
  • 49143/tcp Connection between client/server
  • 8282/tcp "P2" update server so the server can update the client version
  • 2222/tcp (optional - configurable) SSH Connection into the Server to send commands (requires change to ini file)

These ports are all between the client and the server so you could additionally only open these ports to the IP addresses your clients are running on. The server will also attempt to reach out to the internet to check with DarkLight's servers for updates.

Opening a port

sudo firewall-cmd --permanent --zone=public --add-port=41617/tcp
sudo firewall-cmd --permanent --zone=public --add-port=49143/tcp
sudo firewall-cmd --permanent --zone=public --add-port=8282/tcp
sudo firewall-cmd --permanent --zone=public --add-port=2222/tcp

then

sudo systemctl restart network
sudo systemctl restart firewalld

source: https://docs.docker.com/install/linux/docker-ce/centos/

Set up the Repository

sudo yum install -y yum-utils device-mapper-persistent-data lvm2
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

Install the latest Docker Engine

sudo yum install docker-ce docker-ce-cli containerd.io

Start Docker

sudo systemctl start docker

Test Docker

sudo docker run hello-world

source: https://docs.docker.com/compose/install/

Download the current release

sudo curl -L "https://github.com/docker/compose/releases/download/1.24.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

Change permissions

sudo chmod +x /usr/local/bin/docker-compose

Test Docker Compose

docker-compose --version

Create a directory where DarkLight will live

This should probably be in your user space with your documents where you have the most disk space. We are also assuming that you are not logged in as the root account (always a bad idea).

cd ~
mkdir darklight
cd darklight

Download the Compose Directory

curl https://www.darklight.ai/installers/current/compose.zip -O

(local download option) Download compose.zip

Unzip the compose file and move to the folder

unzip ./compose.zip 

Don't have unzip? Install it with sudo yum install unzip

cd compose

Copy the DarkLight certs to Docker

There are two DarkLight repositories, one on each side of the US. Choose the one closest to you for the best transfer speeds.

sudo mkdir -p /etc/docker/certs.d/docker-east.darklight.ai/

OR

sudo mkdir -p /etc/docker/certs.d/docker-west.darklight.ai/

sudo cp darklight-docker.crt /etc/docker/certs.d/docker-east.darklight.ai/

OR

sudo cp darklight-docker.crt /etc/docker/certs.d/docker-west.darklight.ai/

Restart the Docker service

sudo systemctl restart docker

Login to the registry

You will need credentials from support@darklight.ai

sudo docker login docker-east.darklight.ai

OR

sudo docker login docker-west.darklight.ai

Pull the latest version of DarkLight

sudo docker pull docker-east.darklight.ai/darklight

OR

sudo docker pull docker-west.darklight.ai/darklight

Set settings specific to your server

Edit docker-compose.yml

Change every reference of "FQDN" to your fully-qualified domain name

  • hostname
  • alias
  • DL_COMPUTER_ADDRESS

Save the .yml file

How to do this in vi:

  1. Open in vi vi docker-compose.yml
  2. Search/Replace FQDN :%s/FQDN/yourserver.domain.com/g
    1. (If using darklight-west) :%s/-east/-west/
  3. Save and Exit ZZ

Add a DarkLight license file

If you don't have a darklight.lic file, please contact support@darklight.ai

Copy your darklight.lic file to the compose directory

curl -u username https://www.darklight.ai/licenses/username/darklight.lic -O
  • Start DarkLight
    docker-compose up -d
  • Login to the OSGi SSH console (setup details are below)
    ssh username@<FQDN> -p 2222
  • Login to the container
    docker exec -it darklight bash
  • Follow the logs
    docker logs --follow darklight
  • Stop DarkLight: Login to the OSGi console and type shutdown
  • OSGi SSH Setup Instructions
  • Configuring Client Authentication
  • Connecting a Client to a Server
  • start/docker
  • Last modified: 2019/09/11 23:00