# Docker - Phase 1

{% hint style="info" %}
Please ensure, you have git & curl command installed already. If not, use the following command

sudo apt install git

sudo apt install curl
{% endhint %}

#### 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

{% hint style="info" %}
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.
{% endhint %}

```
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**.&#x20;

**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:plugin1234@172.17.0.1: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
```

![](/files/RIR6SEFjHJ96lCsXBDa5)

#### Step 6 - Change your credentials

{% hint style="info" %}
It is important to change the credentials in these two files, inside the plugin-deployment directory.&#x20;

These files are hidden files and you can edit using below command
{% endhint %}

![](/files/YEbdphMI9jg4aZ7H0qw6)

* **.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.&#x20;
  * 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 -&#x20;
    * ![](/files/xKK5uudn3iZJSKFbpbEu)
* **.env.apicre**d
  * This file has credentials that allows you to log in to PLUGIN GUI
  * You can use your email ID & password of your choice&#x20;
  * ![](/files/FYOFXWEyDLd75S6l8AWg)

{% hint style="info" %}
Once the above files are updated, then you can proceed to the next!
{% endhint %}

#### 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

![](/files/uzvYa6ZU7NN2uVcmNBFm)

#### Step 8 - Get the container ID using the below command

```
sudo docker ps -a => Get the <container_ID>
```

![](/files/2uevEW7PzfXv6Z3OedRO)

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 -&#x20;

{% embed url="<https://youtu.be/c_mQG4ortnI>" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.goplugin.co/plugin-1.0-installations-deprecated/how-to-install-plugin-1.0-node/docker-method/docker-phase-1.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
