Docker - Phase 1

Setup Postgres, Docker, Pull Plugin Docker Image & Setup Plugin Node
Please ensure, you have git & curl command installed already. If not, use the following command
sudo apt install git
sudo apt install curl

Step 1 - Download the Plugin Installation Script

NOTE: If you are having root access, please don't install from /root folder, better start from /home
git clone -b docker_branch_v1 https://github.com/GoPlugin/plugin-deployment.git && cd plugin-deployment

Step 2 - Postgres Setup

To set up custom password for PostgreSQL database execute the below mentioned command in plugin-deployment directory. The user needs to change the word ‘password’ to their own password for the database.
perl -i -p -e 's/plugin1234/yourpassword/g' postgresInstall.bash plugin.env ei.env
For example, here the password we are setting is 'yourpassword', please change it to your custom password.
NOTE: Don't use any special characters, just alphanumeric password is sufficient
perl -i -p -e 's/plugin1234/mypassword/g' postgresInstall.bash plugin.env ei.env

What's inside the plugin.env?

ETH_CHAIN_ID=50
ETH_URL=wss://pluginws.blocksscan.io
MIN_OUTGOING_CONFIRMATIONS=2
PLI_CONTRACT_ADDRESS=0xff7412ea7c8445c46a8254dfb557ac1e48094391
PLUGIN_TLS_PORT=0
SECURE_COOKIES=false
ALLOW_ORIGINS=*
DATABASE_TIMEOUT=0
FEATURE_EXTERNAL_INITIATORS=true
PLUGIN_DEV=true
DATABASE_URL=postgresql://postgres:[email protected]:5432/plugin_mainnet_db?sslmode=disable
ENABLE_EXPERIMENTAL_ADAPTERS=true
POSTGRES_USER=postgres
POSTGRES_PASSWORD=plugin1234
POSTGRES_DB=plugin_mainnet_db
Install PostgreSQL & Config PostgreSQL: (Just copy and paste each line) and make sure there is no error before you move on to the next line of commands
1) /bin/bash postgresInstall.bash
2) sudo perl -i -p -e "s/^\#listen_addresses.*$/listen_addresses = \'172.17.0.1\'/" /etc/postgresql/12/main/postgresql.conf
3) sudo chmod 666 /etc/postgresql/12/main/pg_hba.conf
4) sudo echo "host all all 172.17.0.1/16 md5" >>/etc/postgresql/12/main/pg_hba.conf
5) sudo pg_ctlcluster 12 main start

Step 3 - Setup Docker

sudo apt update
sudo apt install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"
apt-cache policy docker-ce
sudo apt install docker-ce
sudo systemctl status docker

Step 4 - Pull Plugin image

sudo docker pull goplugin/pluginode:v1
For latest docker image(in which Pli balance will be reflecting in Keys), please
use the v2 version of docker image:
sudo docker pull goplugin/pluginode:v2
Step 5 - Copy down the image ID using below command
sudo docker images

Step 6 - Change your credentials

It is important to change the credentials in these two files, inside the plugin-deployment directory.
These files are hidden files and you can edit using below command
  • .env.password
    • This is the password that helps generate and secure the Keystore wallet. Basically, your Plugin node will generate a wallet and this password is key to the same.
    • It follows certain standards and password conditions which you can get it from here
      • # *** KEYSTORE PASSWORD SHOULD FOLLOW THIS CONDITIONS *** #
        # “must be longer than 12 characters”,
        # “must contain at least 3 lowercase characters”,
        # “must contain at least 3 uppercase characters”,
        # “must contain at least 3 numbers”,
        # “must contain at least 3 symbols”,
        # “must not contain more than 3 identical consecutive #characters”.
        For example -
  • .env.apicred
    • This file has credentials that allows you to log in to PLUGIN GUI
    • You can use your email ID & password of your choice
Once the above files are updated, then you can proceed to the next!

Step 7 - Override the Image ID in the below command and run the docker container

sudo docker run --env-file plugin.env -it -d -p 6688:6688 -p 8080:8080 -v <Absolute path of your plugin-deployment directory>:/pluginAdm --add-host=host:192.168.0.1 <IMAGE_ID>
For example, after you change the image ID, the command should be-
sudo docker run --env-file plugin.env -it -d -p 6688:6688 -p 8080:8080 -v /home/ubuntu/plugin-deployment:/pluginAdm --add-host=host:192.168.0.1 ac37806848a0
Once it is successful, you will see something like this

Step 8 - Get the container ID using the below command

sudo docker ps -a => Get the <container_ID>
Step 9 - Change the container_ID in below command and execute from your directory
sudo pg_ctlcluster 12 main restart
sudo docker exec -it <container_ID> /bin/bash -c ". ~/.profile && pm2 start /pluginAdm/startNode.sh"
For instance
sudo docker exec -it 59961fcd0f4f /bin/bash -c ". ~/.profile && pm2 start /pluginAdm/startNode.sh"
Your node will start with status as ‘online’.
If you want to probe your running node, then you can use the command format given below.
sudo docker exec -it <container_ID> /bin/bash -c ". ~/.profile && <YOUR_COMMAND>"
You can replace <YOUR_COMMAND> with
- pm2 status - pm2 logs 0

Video Tutorial for this section -