Skip to content

Commit b6f5e98

Browse files
authored
Merge pull request #15 from GoPlugin/revert-14-plugin_docker_installer
Revert "updated to my docker installer"
2 parents a27eff4 + d594979 commit b6f5e98

12 files changed

Lines changed: 975 additions & 938 deletions

1_prerequisite.bash

Lines changed: 256 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,256 @@
1+
#!/bin/bash
2+
tryCatch()
3+
{
4+
FNARG=("$@")
5+
echo ${FNARG[@]}
6+
IFS=',' read -ra GO_array <<< "${FNARG[@]}"
7+
for i in "${GO_array[@]}"
8+
do
9+
CMD=`$i`
10+
CMD_check=$?
11+
if [ $CMD_check -eq 0 ]
12+
then
13+
echo "$i: passed"
14+
else
15+
echo "$i: failed"
16+
echo "Fix the failure and restart the script"
17+
echo "Plugin installation: Abort"
18+
exit 1
19+
fi
20+
done
21+
}
22+
23+
echo `date` >>time.txt
24+
START=$(date +%s);
25+
#########################################OS check
26+
echo "Setting up your local Plugin Node"
27+
OS=`lsb_release -d | cut -f 2 | cut -d ' ' -f 1| grep -i 'ubuntu'`
28+
OS_STATUS=$?
29+
OS_VERSION=`lsb_release -r|cut -f 2|cut -d '.' -f 1`
30+
if [ $OS_VERSION -ge 18 ] && [ $OS_STATUS -eq 0 ]
31+
then
32+
echo "OS Compatibilty check: passed"
33+
else
34+
echo "Your OS $OS $OS_VERSION is not compatible for Plugin installation\nOS compatibility check: failed\nRefer the doc provided"
35+
exit 1
36+
fi
37+
#########################################
38+
#########################################GO installation
39+
40+
GO=(
41+
'curl -O https://dl.google.com/go/go1.17.3.linux-amd64.tar.gz',
42+
#'curl -O https://go.dev/dl/go1.17.3.linux-amd64.tar.gz',
43+
#'curl -O https://dl.google.com/go/go1.15.13.linux-amd64.tar.gz',
44+
#'sha256sum go1.15.13.linux-amd64.tar.gz',
45+
'sha256sum go1.17.3.linux-amd64.tar.gz',
46+
'tar xvf go1.17.3.linux-amd64.tar.gz',
47+
#'tar xvf go1.15.13.linux-amd64.tar.gz',
48+
'sudo chown -R root:root ./go',
49+
'sudo mv go /usr/local'
50+
)
51+
echo "<<<<<<<<<------------------Installing Go packages -- STEP 1/9 Started--------------------->>>>>>>>>"
52+
tryCatch ${GO[@]}
53+
echo "export GOROOT=/usr/local/go
54+
export GOPATH=\$HOME/work
55+
export PATH=\$PATH:\$GOROOT/bin:\$GOPATH/bin" >> ~/.profile
56+
GO_var_set=$?
57+
if [ $GO_var_set -eq 0 ]
58+
then
59+
echo "Go env var set: passed"
60+
else
61+
echo "Go env var set: failed"
62+
echo "Fix the error"
63+
exit 1
64+
fi
65+
. ~/.profile
66+
if [ $? -eq 0 ]
67+
then
68+
echo "Profile run set: passed"
69+
else
70+
echo "Profile run set: failed"
71+
echo "Fix the error"
72+
exit 1
73+
fi
74+
GO_VERSION=`go version`
75+
echo "<<<<<<<<<------------------$GO_VERSION installed successfully -- STEP 1/9 Completed--------------------->>>>>>>>>"
76+
#########################################
77+
#########################################NodeJs installation
78+
79+
Nodejs=(
80+
'curl https://deb.nodesource.com/setup_15.x -o setup_15.x',
81+
'sudo chmod 775 setup_15.x',
82+
'sudo -E ./setup_15.x',
83+
'sudo apt-get install -y nodejs'
84+
)
85+
echo "Installing NodeJs -- STEP 2/9 Started"
86+
tryCatch ${Nodejs[@]}
87+
NODE_VERSION=`node -v`
88+
NPM_VERSION=`npm -v`
89+
echo "Node version $NODE_VERSION and Npm version $NPM_VERSION installed successfully -- STEP 2/9 Completed--------------------->>>>>>>>>"
90+
#########################################
91+
92+
#########################################NVM installation
93+
NVM=(
94+
'curl https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh -o install.sh',
95+
'sudo chmod 775 install.sh',
96+
'./install.sh'
97+
)
98+
echo "<<<<<<<<<------------------Installing NVM -- STEP 3/9 Started"
99+
tryCatch ${NVM[@]}
100+
#Close and open fix and not taking from script
101+
NVM_VERSION=`nvm -v`
102+
export NVM_DIR="$HOME/.nvm"
103+
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
104+
echo "<<<<<<<<<------------------NVM version $NVM_VERSION installed successfully -- STEP 3/9 Completed--------------------->>>>>>>>>"
105+
#########################################
106+
#########################################Yarn installation
107+
echo "<<<<<<<<<------------------Installing Yarn -- STEP 4/9 Started--------------------->>>>>>>>>"
108+
YARN=`sudo npm install --global yarn`
109+
if [ $? -eq 0 ]
110+
then
111+
echo "Yarn installation: passed"
112+
else
113+
echo "Yarn installation: failed"
114+
echo "Fix the error"
115+
exit 1
116+
fi
117+
YARN_VERSION=`yarn -v`
118+
echo "<<<<<<<<<------------------Yarn version $YARN_VERSION installed successfully -- STEP 4/9 Completed--------------------->>>>>>>>>"
119+
#########################################
120+
#########################################Postgresql installation
121+
PG=(
122+
'sudo apt-get install -y postgresql-12',
123+
'sudo systemctl start postgresql@12-main'
124+
)
125+
echo "<<<<<<<<<------------------Installing Postgres -- STEP 5/9 Started--------------------->>>>>>>>>"
126+
PG1=`sudo apt-get install -y postgresql-12`
127+
if [ $? -eq 0 ]
128+
then
129+
echo "postgresql-12: passed"
130+
else
131+
echo "postgresql-12: failed"
132+
echo "Fix the error"
133+
exit 1
134+
fi
135+
PG2=`sudo systemctl start postgresql@12-main`
136+
if [ $? -eq 0 ]
137+
then
138+
echo "postgresql@12-main: passed"
139+
else
140+
echo "postgresql@12-main: failed"
141+
echo "Fix the error"
142+
exit 1
143+
fi
144+
145+
POSTGRES_VERSION=`psql -V`
146+
echo "<<<<<<<<<------------------Postgres version $POSTGRES_VERSION installed successfully -- STEP 5/9 Completed--------------------->>>>>>>>>"
147+
#########################################
148+
#########################################Plugin installation
149+
echo "<<<<<<<<<------------------Downloading Plugin and setting it up - STEP 6/9 Started--------------------->>>>>>>>>"
150+
PLI=(
151+
'git clone https://github.com/GoPlugin/Plugin.git'
152+
)
153+
tryCatch ${PLI[@]}
154+
cd Plugin
155+
if [ $? -eq 0 ]
156+
then
157+
echo "cd Plugin: passed"
158+
else
159+
echo "cd Plugin: failed"
160+
echo "Fix the error"
161+
exit 1
162+
fi
163+
sudo apt install make
164+
if [ $? -eq 0 ]
165+
then
166+
echo "apt install make: passed"
167+
else
168+
echo "apt install make: failed"
169+
echo "Fix the error"
170+
exit 1
171+
fi
172+
sudo apt-get install -y build-essential
173+
if [ $? -eq 0 ]
174+
then
175+
echo "build-essential: passed"
176+
else
177+
echo "build-essential: failed"
178+
echo "Fix the error"
179+
exit 1
180+
fi
181+
make install
182+
if [ $? -eq 0 ]
183+
then
184+
echo "make install: passed"
185+
else
186+
echo "make install: failed"
187+
echo "Fix the error"
188+
exit 1
189+
fi
190+
191+
echo "<<<<<<<<<------------------Downloading Plugin and setting it up - STEP 7/9 Completed--------------------->>>>>>>>>"
192+
#########################################
193+
#########################################Database creation
194+
echo "<<<<<<<<<------------------Creating database - STEP 8/9 Started--------------------->>>>>>>>>"
195+
sudo -u postgres psql -c "create database plugin_mainnet_db"
196+
if [ $? -eq 0 ]
197+
then
198+
echo "plugin_db creation: passed"
199+
else
200+
echo "plugin_db creation: failed"
201+
exit 1
202+
fi
203+
sudo -u postgres psql -c "alter user postgres PASSWORD 'postgres'"
204+
if [ $? -eq 0 ]
205+
then
206+
echo "Alter DB: passed"
207+
else
208+
echo "Alter DB: failed"
209+
exit 1
210+
fi
211+
echo "<<<<<<<<<------------------Creating database - STEP 9/9 Completed--------------------->>>>>>>>>"
212+
#########################################
213+
#########################################npm installation
214+
echo "<<<<<<<<<------------------pm2 installation Started--------------------->>>>>>>>>"
215+
sudo npm install -g pm2
216+
if [ $? -eq 0 ]
217+
then
218+
echo "pm2 installation: passed"
219+
else
220+
echo "pm2 installation: failed"
221+
exit 1
222+
fi
223+
echo "<<<<<<<<<------------------pm2 installation Completed--------------------->>>>>>>>>"
224+
#########################################Plugin Node kickstart
225+
#cd Plugin
226+
echo `date` >>time.txt
227+
END=$(date +%s);
228+
echo "Time taken for execution: $((END-START)) seconds"
229+
#########################################
230+
echo "<<<<<<<<<------------------SET UP COMPLETED--------------------->>>>>>>>>"
231+
echo "
232+
################################################################################
233+
# IMPORTANT MESSAGE #
234+
################################################################################
235+
# Make sure you have the below mentioned 2 files are available and populated #
236+
# as given below. Then start 'pm2 start 2_nodeStartPM2.sh' script to run your#
237+
# node in the background. To view your node log use 'pm2 logs 0'. #
238+
# #
239+
# File 1: password.txt => contains your keystore password #
240+
# *** KEYSTORE PASSWORD SHOULD FOLLOW THIS CONDITIONS *** #
241+
# “must be longer than 12 characters”, #
242+
# “must contain at least 3 lowercase characters”, #
243+
# “must contain at least 3 uppercase characters”, #
244+
# “must contain at least 3 numbers”, #
245+
# “must contain at least 3 symbols”, #
246+
# “must not contain more than 3 identical consecutive #
247+
# characters”. #
248+
# File 2: apicredentials.txt => first line of the file contians email id for UI#
249+
# second line of the file contains password for UI#
250+
# (This passwrod should be strong, but need not #
251+
# follow keystore password condition). #
252+
# #
253+
# NOTE: This 2 files have default contents, please change the mail & passwords #
254+
# before starting 'pm2 start 2_nodeStartPM2.sh'. #
255+
################################################################################
256+
################################################################################"

2_nodeStartPM2.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
echo "<<<<<<<<<------------------STARTING PLUGIN NODE--------------------->>>>>>>>>"
2+
. ~/.profile
3+
echo "export ETH_CHAIN_ID=50
4+
export ETH_URL=wss://pluginws.blocksscan.io
5+
export MIN_OUTGOING_CONFIRMATIONS=2
6+
export PLI_CONTRACT_ADDRESS=0xff7412ea7c8445c46a8254dfb557ac1e48094391
7+
export PLUGIN_TLS_PORT=0
8+
export SECURE_COOKIES=false
9+
export ALLOW_ORIGINS=*
10+
export DATABASE_TIMEOUT=0
11+
export FEATURE_EXTERNAL_INITIATORS=true
12+
export PLUGIN_DEV=true
13+
export DATABASE_URL=postgresql://postgres:postgres@127.0.0.1:5432/plugin_mainnet_db?sslmode=disable
14+
export ENABLE_EXPERIMENTAL_ADAPTERS=true" >> ~/.tmp_profile
15+
. ~/.tmp_profile
16+
plugin node start -d -p password.txt -a apicredentials.txt
17+
echo "<<<<<<<<<<<-------------------Plugin node is running .. use "pm2 status" to check the status-------->>>>>>>>>>>"

FAQ

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)