-
Notifications
You must be signed in to change notification settings - Fork 21
/
setup_gitpod.sh
executable file
·78 lines (68 loc) · 3.28 KB
/
setup_gitpod.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
76
77
78
#!/bin/bash
set -e
# Increase MaxConcurrentConnections for improving gitpod overload problems
sed -i '/MaxConcurrentConnections/c\\t\t\t\t"MaxConcurrentConnections": '1000',' ./docker-compose-eco-network/neo-cli/configs/plugins/rpcServer1.json
# check if gitpod exists
gp info > gitpod.txt
# ================
# get workspace id
#
WID=`sed -n 1p gitpod.txt | awk -F: '{print $2}' | sed -e 's/ //g'`
echo "Workspace ID: $WID"
# ================
# get cluster host
#
CHOST=`sed -n 6p gitpod.txt | awk -F: '{print $2}' | sed -e 's/ //g'`
echo "Cluster Host: $CHOST"
# https://www.gitpod.io/docs/configure/workspaces/ports
# EXAMPLE:
# https://8000-neoresearch-neocompiler-len9qk36eo0.ws-us104.gitpod.io
# PORT_8000=`gp url 8000` # HARDER TO REMOVE https:// prefix...
PORT_8000=`echo "8000-${WID}.${CHOST}"`
# echo $PORT_8000 # NO HTTPS HERE!!!
# 8000-neoresearch-neocompiler-len9qk36eo0.ws-us104.gitpod.io
PORT_9000=`echo "9000-${WID}.${CHOST}"`
PORT_10000=`echo "10000-${WID}.${CHOST}"`
PORT_30333=`echo "30333-${WID}.${CHOST}"`
PORT_30334=`echo "30334-${WID}.${CHOST}"`
PORT_30337=`echo "30337-${WID}.${CHOST}"`
# personalized javascript url
P_URL="assets/info/personalized.js"
echo " personalizedNodes = [" > $P_URL
echo " {" >> $P_URL
echo " \"protocol\": \"https\"," >> $P_URL
echo " \"url\": \"$PORT_10000\"," >> $P_URL
echo " \"location\": \"worldwide\"," >> $P_URL
echo " \"locale\": \"worldwide\"," >> $P_URL
echo " \"type\": \"ecocompilers\"" >> $P_URL
echo " }," >> $P_URL
echo " {" >> $P_URL
echo " \"protocol\": \"https\"," >> $P_URL
echo " \"url\": \"$PORT_9000\"," >> $P_URL
echo " \"location\": \"worldwide\"," >> $P_URL
echo " \"locale\": \"worldwide\"," >> $P_URL
echo " \"type\": \"ecoservices\"" >> $P_URL
echo " }," >> $P_URL
echo " {" >> $P_URL
echo " \"protocol\": \"https\"," >> $P_URL
echo " \"url\": \"$PORT_30333\"," >> $P_URL
echo " \"location\": \"worldwide\"," >> $P_URL
echo " \"locale\": \"worldwide\"," >> $P_URL
echo " \"type\": \"RPC\"" >> $P_URL
echo " }," >> $P_URL
echo " {" >> $P_URL
echo " \"protocol\": \"https\"," >> $P_URL
echo " \"url\": \"$PORT_30334\"," >> $P_URL
echo " \"location\": \"worldwide\"," >> $P_URL
echo " \"locale\": \"worldwide\"," >> $P_URL
echo " \"type\": \"RPC\"" >> $P_URL
echo " }," >> $P_URL
echo " {" >> $P_URL
echo " \"protocol\": \"https\"," >> $P_URL
echo " \"url\": \"$PORT_30337\"," >> $P_URL
echo " \"location\": \"worldwide\"," >> $P_URL
echo " \"locale\": \"worldwide\"," >> $P_URL
echo " \"type\": \"RPC\"" >> $P_URL
echo " }" >> $P_URL
echo " ]" >> $P_URL
echo "Finished updating $P_URL"