Skip to content

Running Catalyst in a Docker Container

Joseph Kearney edited this page Jun 5, 2020 · 7 revisions

Running Catalyst in a Docker Container

Step 1 - Install Docker

Follow the instructions found here Docker Intalation to install docker onto your computer.

Step 2 - Pull the Catalyst Docker Image

Use the command docker pull atlascity/catalyst to get the docker image for Catalyst

Step 3 - Create docker-compose file

Within a text editor (notepad, notepad++ etc) copy and past the following code and save as docker-compose.yml


version: "3"

services:
   
  db:
    image: mongo:3.2
    ports:
      - 27017:27017
  
  app:
    image: atlascity/catalyst
    stdin_open: true
    tty: true
    links:
      - db
    build: 
        context: .
        dockerfile: Dockerfile
    depends_on:
      - db
    command: /bin/bash
    ports:
      - 5000:80
      - 42076:42076
      - 42066:42066
      - 4001:4001
      - 5005:5005
    environment: 
      - db:27017

For ease of use create this file in your root directory in a new folder. Then in command console use the command cd NameOfNewFolder

Step 4 - Run the Docker Container

Use the command docker-compose run --use-aliases --service-ports app

This will begin a bash shell within the directory Catalyst

Step 5 - Node Configurations

Step 5A - create .catalyst folder

First use the command mkdir -p /data/db and then the command mongod & to have mongodb running in the background.

Use the command cd Catalyst.Node.POA.CE then use the command dotnet run

This will then run the project creating the .catalyst folder, it will also ask you to set your passwords this is not necessary at this point. Press ctrl + c on your keyboard to exit this process.

Step 5B - Adding the Self Signed Certificate

Use the command 'cd ../../../root/.catalyst'

Within this folder use these commands in order:

  1. openssl genrsa 2048 > private.pem

  2. openssl req -x509 -new -key private.pem -out public.pem

NOTE: at this stage you will be required to input information, one of the fields must not be blank e.g. the first question asks for your country code for this input a two letter code for your country of residence. All other fields can be answered with .

  1. openssl pkcs12 -export -in public.pem -inkey private.pem -out mycert.pfx

NOTE: At this stage you will be asked to create a password. Ensure that you know this password as it will be needed in the next step.

Step 5C - Getting your public key

Use the command cd ../../Catalyst/src/Catalyst.Node.POA.CE and then dotnet run. You will be asked to create two passwords, one for the node and one for IPFS, create and remember these two passwords. You will then be asked to provide the password for your Self Signed Certificate from step 5B. The node will begin running. Once again press ctrl + c on the keyboard and use the search function to search for the phrase using PublicKey. This should show a phrase like using PublicKey: 3edzejbuvme3ed4wqr5pp23if7rguoy7yddlcy3whijywzvo7lfq. Copy and note down the series of letter and numbers.

Step 5D - Getting your external IP address

Use the command dig +short myip.opendns.com @resolver1.opendns.com and take note of the IP address shown.

Step 5E - Getting your internal IP address

Use the command ip addr show take note of the IPv4 address displayed.

Step 5F - Editing the devnet.json file.

Use the command 'cd ../../../root/.catalyst' then use the command nano devnet.json. This will allow you to edit the file. there are four fields to change, in order on the page they are:

  • Under peer change the "PublicKey": aaaaaaaaaaaaaaaaaaaaaaaaaaaaa to your own public key from step 5C
  • Under peer change the "BindAddress": to your internal IP address from step 5E
  • Under peer change the "PublicIpAddress": to your external IP address from step 5D
  • Under RPC change the "BindAddress": to your internal IP address from step 5E

Use ctrl + x to exit and save the file.

Step 6 - Port forward

If the ports on your computer are already being forwarded then you can skip this step as the docker container should replicate your port mapping.

Port forward if you are behind NAT. If your internal and external IP Addresses in step 5 were different then you are behind NAT.

There are steps that you can follow which will allow us to forward the ports for you automatically. This will only work with compatible routers. To try this run:

dotnet run --project ../Catalyst.Modules.UPnP --filepath ~/.catalyst/devnet.json

This will run a program which will attempt to configure your ports, it will provide feedback on whether this was successful or not.

If the above is unsuccessful will you will have to log into your router with administrator passwords. These can generally be found on the router.

Some common default IP addresses for router login are:

  • BT - 192.168.1.254
  • TalkTalk - 192.168.1.1
  • EE - 192.168.1.1
  • Virgin - 192.168.0.1
  • Sky - 192.168.0.1

The port forwards that will need to be set up are as follows : 42076(udp) 42066(tcp) 4001(tcp) / API: 5005(tcp). Here is a guide on how to port forward Port Forward.

Step 7 - Run the Node

Using the command cd ../../Catalyst/src/Catalyst.Node.POA.CE return to the Catalyst.Node.POA.CE folder use the command dotnet run to begin the node and input your passwords for your node, IPFS and keystore. The node will now be running and visible on Catalyst Node Dashboard

Clone this wiki locally