-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsetup.sh
executable file
·75 lines (62 loc) · 2.69 KB
/
setup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/bash
echo "Installing apt deps..."
sudo apt update
sudo apt install postgresql postgresql-contrib build-essential python-dev python3-dev python3-psycopg2 libpq-dev libmysqlclient-dev default-libmysqlclient-dev pkg-config
echo "Setup Python 3.10..."
sudo apt update && sudo apt upgrade -y
sudo apt install software-properties-common python3-apt jq -y
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update
sudo apt install python3.10 python3.10-distutils -y
sudo ln -sf /usr/bin/python3.10 /usr/bin/python3
curl -sS https://bootstrap.pypa.io/get-pip.py | python3
echo "Getting coins..."
wget https://raw.githubusercontent.com/KomodoPlatform/coins/master/coins
cp coins $(pwd)/mm2/coins
cp coins $(pwd)/mm2_8762/coins
echo "Setup mm2..."
rpc_password="$(openssl rand -hex 20)-E"
passphrase=$(openssl rand -hex 128)
contents=$(jq '.rpc_password = "'${rpc_password}'"' $(pwd)/mm2_8762/MM2.template.json) && echo -E "${contents}" > $(pwd)/mm2_8762/MM2.json
contents=$(jq '.passphrase = "'${passphrase}'"' $(pwd)/mm2_8762/MM2.json) && echo -E "${contents}" > $(pwd)/mm2_8762/MM2.json
rpc_password="$(openssl rand -hex 20)-E"
passphrase=$(openssl rand -hex 128)
contents=$(jq '.rpc_password = "'${rpc_password}'"' $(pwd)/mm2/MM2.template.json) && echo -E "${contents}" > $(pwd)/mm2/MM2.json
contents=$(jq '.passphrase = "'$passphrase'"' $(pwd)/mm2/MM2.json) && echo -E "${contents}" > $(pwd)/mm2/MM2.json
echo "Setting up .env [netid 7777] file..."
USER_ID=$(id -u)
GROUP_ID=$(id -g)
userpass=$(cat mm2/MM2.json | jq -r '.rpc_password')
echo "MM_CONF_PATH=/home/komodian/mm2/MM2.json" > mm2/.env
echo "MM_COINS_PATH=/home/komodian/mm2/coins" >> mm2/.env
echo "MM_LOG=/home/komodian/mm2/mm2.log" >> mm2/.env
echo "USERPASS=${userpass}" >> mm2/.env
echo "USER_ID=${USER_ID}" >> mm2/.env
echo "GROUP_ID=${GROUP_ID}" >> mm2/.env
echo "Setting up .env [netid 8762] file..."
USER_ID=$(id -u)
GROUP_ID=$(id -g)
userpass=$(cat mm2_8762/MM2.json | jq -r '.rpc_password')
echo "MM_CONF_PATH=/home/komodian/mm2/MM2.json" > mm2_8762/.env
echo "MM_COINS_PATH=/home/komodian/mm2/coins" >> mm2_8762/.env
echo "MM_LOG=/home/komodian/mm2/mm2.log" >> mm2_8762/.env
echo "USERPASS=${userpass}" >> mm2_8762/.env
echo "USER_ID=${USER_ID}" >> mm2_8762/.env
echo "GROUP_ID=${GROUP_ID}" >> mm2_8762/.env
echo "username=${USER}" > username
echo "Installing poetry..."
pip install poetry
poetry config virtualenvs.in-project true
cd $(pwd)/api
poetry update
cd ..
echo "Setup Docker..."
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh ./get-docker.sh
sudo groupadd docker
sudo usermod -aG docker $USER
newgrp docker
sudo systemctl enable docker.service
sudo systemctl enable containerd.service
sudo apt-get update
sudo apt-get install docker-compose-plugin