forked from btcpayserver/btcpayserver-docker
-
Notifications
You must be signed in to change notification settings - Fork 1
/
btcpay-update.sh
executable file
·64 lines (49 loc) · 1.99 KB
/
btcpay-update.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
#!/bin/bash
set -e
if [[ "$OSTYPE" == "darwin"* ]]; then
# Mac OS
BASH_PROFILE_SCRIPT="$HOME/btcpay-env.sh"
else
# Linux
BASH_PROFILE_SCRIPT="/etc/profile.d/btcpay-env.sh"
fi
. ${BASH_PROFILE_SCRIPT}
if [ ! -z $BTCPAY_DOCKER_COMPOSE ] && [ ! -z $DOWNLOAD_ROOT ] && [ -z $BTCPAYGEN_OLD_PREGEN ]; then
echo "Your deployment is too old, you need to migrate by following instructions on this link https://github.com/btcpayserver/btcpayserver-docker/tree/master#i-deployed-before-btcpay-setupsh-existed-before-may-17-can-i-migrate-to-this-new-system"
exit
fi
if [[ $BTCPAY_DOCKER_COMPOSE != *docker-compose.generated.yml ]]; then
echo "Your deployment is too old, you need to migrate by following instructions on this link https://github.com/btcpayserver/btcpayserver-docker/tree/master#i-deployed-before-btcpay-setupsh-existed-before-may-17-can-i-migrate-to-this-new-system"
exit
fi
cd "$BTCPAY_BASE_DIRECTORY/btcpayserver-docker"
if [[ "$1" != "--skip-git-pull" ]]; then
git pull --force
exec "btcpay-update.sh" --skip-git-pull
return
fi
if ! [[ "$OSTYPE" == "darwin"* ]]; then
# Not Mac OS
# TODO Should we configure logging for Mac OS too? The file path will be different and access rights need to be considered too...
if ! [ -f "/etc/docker/daemon.json" ]; then
echo "{
\"log-driver\": \"json-file\",
\"log-opts\": {\"max-size\": \"5m\", \"max-file\": \"3\"}
}" > /etc/docker/daemon.json
echo "Setting limited log files in /etc/docker/daemon.json"
fi
fi
. ./build.sh
if [ "$BTCPAYGEN_OLD_PREGEN" == "true" ]; then
cp Generated/docker-compose.generated.yml $BTCPAY_DOCKER_COMPOSE
cp Generated/torrc.tmpl "$(dirname "$BTCPAY_DOCKER_COMPOSE")/torrc.tmpl"
fi
if ! grep -Fxq "export COMPOSE_HTTP_TIMEOUT=\"180\"" "$BASH_PROFILE_SCRIPT"; then
echo "export COMPOSE_HTTP_TIMEOUT=\"180\"" >> "$BASH_PROFILE_SCRIPT"
export COMPOSE_HTTP_TIMEOUT=180
echo "Adding COMPOSE_HTTP_TIMEOUT=180 in btcpay-env.sh"
fi
. helpers.sh
install_tooling
btcpay_update_docker_env
btcpay_up