forked from kirbyzhu/v2ray-heroku
-
Notifications
You must be signed in to change notification settings - Fork 3
/
entrypoint.sh
49 lines (45 loc) · 1.62 KB
/
entrypoint.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
if [ ! -d /v2raybin/v2ray-v$V2RAY_VER-linux-64 ]; then
rm -rf /v2raybin
mkdir /v2raybin
cd /v2raybin
wget -O v2ray.zip https://github.com/v2ray/v2ray-core/releases/download/v$V2RAY_VER/v2ray-linux-64.zip
unzip v2ray.zip
cd /v2raybin/v2ray-v$V2RAY_VER-linux-64
chmod +x v2ray
chmod +x v2ctl
fi
if [ ! -d /caddybin/caddy_v$CADDY_VER ]; then
rm -rf /caddybin
mkdir /caddybin
mkdir /caddybin/caddy_v$CADDY_VER
cd /caddybin/caddy_v$CADDY_VER
wget -O caddy.tar.gz https://github.com/mholt/caddy/releases/download/v$CADDY_VER/caddy_v$CADDY_VER'_linux_amd64.tar.gz'
tar xvf caddy.tar.gz
chmod +x caddy
fi
if [ ! -d $CADDY_ROOT ]; then
mkdir $CADDY_ROOT
cd $CADDY_ROOT
wget -O wallet.bitshares.org-gh-pages.zip https://github.com/bitshares/wallet.bitshares.org/archive/gh-pages.zip
unzip wallet.bitshares.org-gh-pages.zip
fi
cd /v2raybin/v2ray-v$V2RAY_VER-linux-64
echo -e -n "$CONFIG_JSON1" > config.json
echo -e -n "$V2_WS_PORT,\"listen\":\"$V2_WS_IP\"" >> config.json
echo -e -n "$CONFIG_JSON2" >> config.json
echo -e -n "$UUID" >> config.json
echo -e -n "$CONFIG_JSON3" >> config.json
echo -e -n "$V2_WS_PATH" >> config.json
echo -e -n "$CONFIG_JSON4" >> config.json
echo -e -n "$CONFIG_JSON5" >> config.json
./v2ray &
cd /caddybin/caddy_v$CADDY_VER
echo $CADDY_LS_IP:$PORT { > HerokuCaddyfile
echo root $CADDY_ROOT/wallet.bitshares.org-gh-pages >> HerokuCaddyfile
echo gzip >> HerokuCaddyfile
echo index $CADDY_INDEX >> HerokuCaddyfile
echo proxy $V2_WS_PATH $V2_WS_IP:$V2_WS_PORT { >> HerokuCaddyfile
echo websocket >> HerokuCaddyfile
echo } >> HerokuCaddyfile
echo } >> HerokuCaddyfile
./caddy -conf="HerokuCaddyfile"