-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSubInstallZerro800GB
198 lines (182 loc) · 7.79 KB
/
SubInstallZerro800GB
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
#!/bin/bash
function colors {
GREEN="\e[32m"
RED="\e[39m"
NORMAL="\e[0m"
}
function logo {
curl -s https://raw.githubusercontent.com/razumv/helpers/main/doubletop.sh | bash
}
function line_1 {
echo -e "${GREEN}-----------------------------------------------------------------------------${NORMAL}"
}
function line_2 {
echo -e "${RED}##############################################################################${NORMAL}"
}
function install_tools {
sudo apt update && sudo apt install mc wget htop jq git -y
}
function install_docker {
curl -s https://raw.githubusercontent.com/razumv/helpers/main/tools/install_docker.sh | bash
}
function install_ufw {
curl -s https://raw.githubusercontent.com/razumv/helpers/main/tools/install_ufw.sh | bash
}
function read_nodename {
if [ ! $SUBSPACE_NODENAME ]; then
echo -e "Enter your node name(random name for telemetry)"
line_1
read SUBSPACE_NODENAME
fi
}
function read_wallet {
if [ ! $WALLET_ADDRESS ]; then
echo -e "Enter your polkadot.js extension address"
line_1
read WALLET_ADDRESS
fi
}
# function source_git {
# git clone https://github.com/subspace/subspace
# cd $HOME/subspace
# git fetch
# git checkout gemini-1b-2022-june-05
# }
#
# function build_image_node {
# cd $HOME/subspace
# docker build -t subspacelabs/subspace-node:gemini-1b-2022-june-05 -f $HOME/subspace/Dockerfile-node .
# }
#
# function build_image_farmer {
# cd $HOME/subspace
# docker build -t subspacelabs/subspace-farmer:gemini-1b-2022-june-05 -f $HOME/subspace/Dockerfile-farmer .
# }
function eof_docker_compose {
mkdir -p $HOME/subspace_docker/
sudo tee <<EOF >/dev/null $HOME/subspace_docker/docker-compose.yml
version: "3.7"
services:
node:
image: ghcr.io/subspace/node:gemini-1b-2022-jun-13
volumes:
- node-data:/var/subspace:rw
ports:
- "0.0.0.0:30333:30333"
restart: unless-stopped
command: [
"--chain", "gemini-1",
"--base-path", "/var/subspace",
"--execution", "wasm",
"--pruning", "1024",
"--keep-blocks", "1024",
"--port", "30333",
"--rpc-cors", "all",
"--rpc-methods", "safe",
"--unsafe-ws-external",
"--validator",
"--name", "$SUBSPACE_NODENAME",
"--telemetry-url", "wss://telemetry.subspace.network/submit 0",
"--telemetry-url", "wss://telemetry.postcapitalist.io/submit 0",
"--reserved-nodes", "/dns/bootstrap-0.gemini-1b.subspace.network/tcp/30333/p2p/12D3KooWF9CgB8bDvWCvzPPZrWG3awjhS7gPFu7MzNPkF9F9xWwc",
"--reserved-nodes", "/dns/bootstrap-1.gemini-1b.subspace.network/tcp/30333/p2p/12D3KooWLrpSArNaZ3Hvs4mABwYGDY1Rf2bqiNTqUzLm7koxedQQ",
"--reserved-nodes", "/dns/bootstrap-2.gemini-1b.subspace.network/tcp/30333/p2p/12D3KooWNN5uuzPtDNtWoLU28ZDCQP7HTdRjyWbNYo5EA6fZDAMD",
"--reserved-nodes", "/dns/bootstrap-3.gemini-1b.subspace.network/tcp/30333/p2p/12D3KooWM47uyGtvbUFt5tmWdFezNQjwbYZmWE19RpWhXgRzuEqh",
"--reserved-nodes", "/dns/bootstrap-4.gemini-1b.subspace.network/tcp/30333/p2p/12D3KooWNMEKxFZm9mbwPXfQ3LQaUgin9JckCq7TJdLS2UnH6E7z",
"--reserved-nodes", "/ip4/117.173.218.133/tcp/40901/p2p/12D3KooWPKUXNhaPEMQaZ7GPJz3XtFeoqhqKycSqyjjqA8jcYmyE",
"--reserved-nodes", "/ip4/65.108.245.30/tcp/30333/p2p/12D3KooWRhYHBQyzghHwzaNmVgGSVMj5spusCahozNgHz7aSTN4t",
"--reserved-nodes", "/ip4/167.235.21.149/tcp/30333/p2p/12D3KooW9uhGQajt1EkYhNom4BKfhrAxb2jgma7kDsTJ4Zafsksh",
"--reserved-nodes", "/ip4/159.69.58.44/tcp/30333/p2p/12D3KooWGiqtXPWiYCSA22ZYkue27kRQ8tD7S6dv6jSocBShNGpg",
"--reserved-nodes", "/ip4/78.47.14.110/tcp/30333/p2p/12D3KooWHMCPXMgCX81bJyoTqGtdJzmmQuhbP7LqWyEyuF5JT7m8",
"--reserved-nodes", "/ip4/188.34.190.67/tcp/30333/p2p/12D3KooWEwscz2uLwUTHruYuzqrCQJWRyoS813ZB7apRc7cFmvuD",
"--reserved-nodes", "/ip4/209.145.48.32/tcp/30333/p2p/12D3KooWSa3ZTTT2UBhVK6B1PTh5oQ3kAxqVAsnBKwi4KcN6pKjR",
"--reserved-nodes", "/ip4/46.4.115.242/tcp/30333/p2p/12D3KooWFSfbto9b7DfMWSgGkLvaMYTim9JcYuN4iCQKxfeYEiXH",
"--reserved-nodes", "/ip4/117.173.218.222/tcp/41100/p2p/12D3KooWG6YrNjWd6fn78Zo6UEBNqBwEHd3uu2tc63D3ycGV218s",
"--reserved-nodes", "/dns/bootstrap-5.gemini-1b.subspace.network/tcp/30333/p2p/12D3KooWFfEtDmpb8BWKXoEAgxkKAMfxU2yGDq8nK87MqnHvXsok",
"--reserved-nodes", "/dns/bootstrap-6.gemini-1b.subspace.network/tcp/30333/p2p/12D3KooWHSeob6t43ukWAGnkTcQEoRaFSUWphGDCKF1uefG2UGDh",
"--reserved-nodes", "/dns/bootstrap-7.gemini-1b.subspace.network/tcp/30333/p2p/12D3KooWKwrGSmaGJBD29agJGC3MWiA7NZt34Vd98f6VYgRbV8hH",
"--reserved-nodes", "/dns/bootstrap-8.gemini-1b.subspace.network/tcp/30333/p2p/12D3KooWCXFrzVGtAzrTUc4y7jyyvhCcNTAcm18Zj7UN46whZ5Bm",
"--reserved-nodes", "/dns/bootstrap-9.gemini-1b.subspace.network/tcp/30333/p2p/12D3KooWNGxWQ4sajzW1akPRZxjYM5TszRtsCnEiLhpsGrsHrFC6",
"--reserved-nodes", "/dns/bootstrap-10.gemini-1b.subspace.network/tcp/30333/p2p/12D3KooWNGf1qr5411JwPHgwqftjEL6RgFRUEFnsJpTMx6zKEdWn",
"--reserved-nodes", "/dns/bootstrap-11.gemini-1b.subspace.network/tcp/30333/p2p/12D3KooWM7Qe4rVfzUAMucb5GTs3m4ts5ZrFg83LZnLhRCjmYEJK",
"--reserved-only"
]
healthcheck:
timeout: 5s
interval: 30s
retries: 5
farmer:
depends_on:
- node
image: ghcr.io/subspace/farmer:gemini-1b-2022-june-05
volumes:
- farmer-data:/var/subspace:rw
restart: unless-stopped
command: [
"--base-path", "/var/subspace",
"farm",
"--node-rpc-url", "ws://node:9944",
"--ws-server-listen-addr", "0.0.0.0:9955",
"--reward-address", "$WALLET_ADDRESS",
"--plot-size", "800G"
]
volumes:
node-data:
farmer-data:
EOF
}
function docker_compose_up {
docker-compose -f $HOME/subspace_docker/docker-compose.yml up -d
}
function echo_info {
echo -e "${GREEN}Для остановки ноды и фармера subspace: ${NORMAL}"
echo -e "${RED} docker-compose -f $HOME/subspace_docker/docker-compose.yml down \n ${NORMAL}"
echo -e "${GREEN}Для запуска ноды и фармера subspace: ${NORMAL}"
echo -e "${RED} docker-compose -f $HOME/subspace_docker/docker-compose.yml up -d \n ${NORMAL}"
echo -e "${GREEN}Для перезагрузки ноды subspace: ${NORMAL}"
echo -e "${RED} docker-compose -f $HOME/subspace_docker/docker-compose.yml restart node \n ${NORMAL}"
echo -e "${GREEN}Для перезагрузки фармера subspace: ${NORMAL}"
echo -e "${RED} docker-compose -f $HOME/subspace_docker/docker-compose.yml restart farmer \n ${NORMAL}"
echo -e "${GREEN}Для проверки логов ноды выполняем команду: ${NORMAL}"
echo -e "${RED} docker-compose -f $HOME/subspace_docker/docker-compose.yml logs -f --tail=100 node \n ${NORMAL}"
echo -e "${GREEN}Для проверки логов фармера выполняем команду: ${NORMAL}"
echo -e "${RED} docker-compose -f $HOME/subspace_docker/docker-compose.yml logs -f --tail=100 farmer \n ${NORMAL}"
}
function delete_old {
docker-compose -f $HOME/subspace_docker/docker-compose.yml down &>/dev/null
docker volume rm subspace_docker_subspace-farmer subspace_docker_subspace-node &>/dev/null
}
colors
line_1
logo
line_2
read_nodename
line_2
read_wallet
line_2
echo -e "Установка tools, ufw, docker"
line_1
install_tools
install_ufw
install_docker
delete_old
line_1
# echo -e "Скачиваем репозиторий"
# source_git
# line_1
# echo -e "Билдим образ ноды"
# build_image_node
# line_1
# echo -e "Билдим образ фармера"
# build_image_farmer
# line_1
echo -e "Создаем docker-compose файл"
line_1
eof_docker_compose
line_1
echo -e "Запускаем docker контейнеры для node and farmer Subspace"
line_1
docker_compose_up
line_2
echo_info
line_2