Imrove control flow.
This commit is contained in:
parent
29038cfb0a
commit
4c214cf7ad
@ -5,13 +5,7 @@ cd "$(dirname "$0")"
|
|||||||
|
|
||||||
export DOCKER_HOST="ssh://ubuntu@$BTCPAY_FQDN"
|
export DOCKER_HOST="ssh://ubuntu@$BTCPAY_FQDN"
|
||||||
|
|
||||||
# run the btcpay setup script if it hasn't been done before.
|
./stub_btcpay_setup.sh
|
||||||
if ssh "$BTCPAY_FQDN" "[ ! -f "$REMOTE_DATA_PATH/btcpay.complete" ]"; then
|
|
||||||
./stub_btcpay_setup.sh
|
|
||||||
BACKUP_BTCPAY=false
|
|
||||||
fi
|
|
||||||
|
|
||||||
RUN_SERVICES=true
|
|
||||||
|
|
||||||
# we will re-run the btcpayserver provisioning scripts if directed to do so.
|
# we will re-run the btcpayserver provisioning scripts if directed to do so.
|
||||||
# if an update does occur, we grab another backup.
|
# if an update does occur, we grab another backup.
|
||||||
@ -49,7 +43,7 @@ if [ "$BACKUP_BTCPAY" = true ]; then
|
|||||||
./backup_btcpay.sh
|
./backup_btcpay.sh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$RUN_SERVICES" = true ] && [ "$STOP_SERVICES" = false ]; then
|
if [ "$STOP_SERVICES" = false ]; then
|
||||||
# The default is to resume services, though admin may want to keep services off (eg., for a migration)
|
# The default is to resume services, though admin may want to keep services off (eg., for a migration)
|
||||||
# we bring the services back up by default.
|
# we bring the services back up by default.
|
||||||
ssh "$FQDN" "bash -c $BTCPAY_SERVER_APPPATH/btcpay-up.sh"
|
ssh "$FQDN" "bash -c $BTCPAY_SERVER_APPPATH/btcpay-up.sh"
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
set -e
|
set -e
|
||||||
cd "$(dirname "$0")"
|
cd "$(dirname "$0")"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# default is for regtest
|
# default is for regtest
|
||||||
CLIGHTNING_WEBSOCKET_PORT=9736
|
CLIGHTNING_WEBSOCKET_PORT=9736
|
||||||
if [ "$BITCOIN_CHAIN" = testnet ]; then
|
if [ "$BITCOIN_CHAIN" = testnet ]; then
|
||||||
@ -13,6 +15,7 @@ fi
|
|||||||
|
|
||||||
export CLIGHTNING_WEBSOCKET_PORT="$CLIGHTNING_WEBSOCKET_PORT"
|
export CLIGHTNING_WEBSOCKET_PORT="$CLIGHTNING_WEBSOCKET_PORT"
|
||||||
|
|
||||||
|
|
||||||
# export BTCPAY_FASTSYNC_ARCHIVE_FILENAME="utxo-snapshot-bitcoin-testnet-1445586.tar"
|
# export BTCPAY_FASTSYNC_ARCHIVE_FILENAME="utxo-snapshot-bitcoin-testnet-1445586.tar"
|
||||||
# BTCPAY_REMOTE_RESTORE_PATH="/var/lib/docker/volumes/generated_bitcoin_datadir/_data"
|
# BTCPAY_REMOTE_RESTORE_PATH="/var/lib/docker/volumes/generated_bitcoin_datadir/_data"
|
||||||
|
|
||||||
|
10
deploy.sh
10
deploy.sh
@ -315,6 +315,16 @@ if ! lxc image list --format csv | grep -q "$DOCKER_BASE_IMAGE_NAME"; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
for VIRTUAL_MACHINE in www btcpayserver; do
|
for VIRTUAL_MACHINE in www btcpayserver; do
|
||||||
|
|
||||||
|
if [ "$VIRTUAL_MACHINE" = btcpayserver ] && [ "$SKIP_BTCPAY" = true ]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$VIRTUAL_MACHINE" = www ] && [ "$SKIP_WWW" = true ]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
export VIRTUAL_MACHINE="$VIRTUAL_MACHINE"
|
export VIRTUAL_MACHINE="$VIRTUAL_MACHINE"
|
||||||
FQDN=
|
FQDN=
|
||||||
|
|
||||||
|
@ -130,6 +130,13 @@ if [ "$RESTART_FRONT_END" = true ]; then
|
|||||||
./backup_path.sh
|
./backup_path.sh
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
else
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# build the clams docker image
|
||||||
|
if [ "$BUILD_CLAMS" = true ]; then
|
||||||
|
./clams/build.sh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# nginx gets deployed first since it "owns" the docker networks of downstream services.
|
# nginx gets deployed first since it "owns" the docker networks of downstream services.
|
||||||
@ -141,6 +148,8 @@ fi
|
|||||||
./stub/gitea_yml.sh
|
./stub/gitea_yml.sh
|
||||||
./stub/nostr_yml.sh
|
./stub/nostr_yml.sh
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# # start a browser session; point it to port 80 to ensure HTTPS redirect.
|
# # start a browser session; point it to port 80 to ensure HTTPS redirect.
|
||||||
# # WWW_FQDN is in our certificate, so we resolve to that.
|
# # WWW_FQDN is in our certificate, so we resolve to that.
|
||||||
# wait-for-it -t 320 "$WWW_FQDN:80"
|
# wait-for-it -t 320 "$WWW_FQDN:80"
|
||||||
|
@ -46,3 +46,10 @@ for DOMAIN_NAME in ${DOMAIN_LIST//,/ }; do
|
|||||||
done
|
done
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# remove the nginx stack
|
||||||
|
if docker stack list --format "{{.Name}}" | grep -q reverse-proxy; then
|
||||||
|
docker stack rm reverse-proxy
|
||||||
|
|
||||||
|
sleep 5
|
||||||
|
fi
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
set -eu
|
set -eu
|
||||||
cd "$(dirname "$0")"
|
cd "$(dirname "$0")"
|
||||||
|
|
||||||
|
DEPLOY_STACK=false
|
||||||
for DOMAIN_NAME in ${DOMAIN_LIST//,/ }; do
|
for DOMAIN_NAME in ${DOMAIN_LIST//,/ }; do
|
||||||
export DOMAIN_NAME="$DOMAIN_NAME"
|
export DOMAIN_NAME="$DOMAIN_NAME"
|
||||||
export SITE_PATH="$SITES_PATH/$DOMAIN_NAME"
|
export SITE_PATH="$SITES_PATH/$DOMAIN_NAME"
|
||||||
@ -12,6 +13,10 @@ for DOMAIN_NAME in ${DOMAIN_LIST//,/ }; do
|
|||||||
source "$SITE_PATH/site.conf"
|
source "$SITE_PATH/site.conf"
|
||||||
source ../../domain_env.sh
|
source ../../domain_env.sh
|
||||||
|
|
||||||
|
if [ "$DEPLOY_GHOST" = true ]; then
|
||||||
|
DEPLOY_STACK=true
|
||||||
|
fi
|
||||||
|
|
||||||
# for each language specified in the site.conf, we spawn a separate ghost container
|
# for each language specified in the site.conf, we spawn a separate ghost container
|
||||||
# at https://www.domain.com/$LANGUAGE_CODE
|
# at https://www.domain.com/$LANGUAGE_CODE
|
||||||
for LANGUAGE_CODE in ${SITE_LANGUAGE_CODES//,/ }; do
|
for LANGUAGE_CODE in ${SITE_LANGUAGE_CODES//,/ }; do
|
||||||
@ -103,7 +108,7 @@ EOL
|
|||||||
EOL
|
EOL
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$STOP_SERVICES" = false ]; then
|
if [ "$DEPLOY_STACK" = true ] && [ "$STOP_SERVICES" = false ]; then
|
||||||
docker stack deploy -c "$DOCKER_YAML_PATH" "$DOMAIN_IDENTIFIER-ghost-$LANGUAGE_CODE"
|
docker stack deploy -c "$DOCKER_YAML_PATH" "$DOMAIN_IDENTIFIER-ghost-$LANGUAGE_CODE"
|
||||||
sleep 2
|
sleep 2
|
||||||
fi
|
fi
|
||||||
|
@ -307,6 +307,8 @@ EOL
|
|||||||
EOL
|
EOL
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if [ "$DEPLOY_GHOST" = true ]; then
|
||||||
echo " # set up cache paths for nginx caching" >>"$NGINX_CONF_PATH"
|
echo " # set up cache paths for nginx caching" >>"$NGINX_CONF_PATH"
|
||||||
for LANGUAGE_CODE in ${SITE_LANGUAGE_CODES//,/ }; do
|
for LANGUAGE_CODE in ${SITE_LANGUAGE_CODES//,/ }; do
|
||||||
STACK_NAME="$DOMAIN_IDENTIFIER-$LANGUAGE_CODE"
|
STACK_NAME="$DOMAIN_IDENTIFIER-$LANGUAGE_CODE"
|
||||||
@ -438,7 +440,7 @@ EOL
|
|||||||
}
|
}
|
||||||
|
|
||||||
EOL
|
EOL
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "$DEPLOY_NEXTCLOUD" = true ]; then
|
if [ "$DEPLOY_NEXTCLOUD" = true ]; then
|
||||||
cat >>"$NGINX_CONF_PATH" <<EOL
|
cat >>"$NGINX_CONF_PATH" <<EOL
|
||||||
|
@ -18,7 +18,7 @@ services:
|
|||||||
networks:
|
networks:
|
||||||
EOL
|
EOL
|
||||||
|
|
||||||
for DOMAIN_NAME in ${DOMAIN_LIST//,/ }; do
|
for DOMAIN_NAME in ${DOMAIN_LIST//,/ }; do
|
||||||
export DOMAIN_NAME="$DOMAIN_NAME"
|
export DOMAIN_NAME="$DOMAIN_NAME"
|
||||||
export SITE_PATH="$SITES_PATH/$DOMAIN_NAME"
|
export SITE_PATH="$SITES_PATH/$DOMAIN_NAME"
|
||||||
|
|
||||||
@ -30,9 +30,12 @@ EOL
|
|||||||
|
|
||||||
for LANGUAGE_CODE in ${SITE_LANGUAGE_CODES//,/ }; do
|
for LANGUAGE_CODE in ${SITE_LANGUAGE_CODES//,/ }; do
|
||||||
# We create another ghost instance under /
|
# We create another ghost instance under /
|
||||||
|
|
||||||
|
if [ "$DEPLOY_GHOST" = true ]; then
|
||||||
cat >> "$DOCKER_YAML_PATH" <<EOL
|
cat >> "$DOCKER_YAML_PATH" <<EOL
|
||||||
- ghostnet-$DOMAIN_IDENTIFIER-$LANGUAGE_CODE
|
- ghostnet-$DOMAIN_IDENTIFIER-$LANGUAGE_CODE
|
||||||
EOL
|
EOL
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "$LANGUAGE_CODE" = en ]; then
|
if [ "$LANGUAGE_CODE" = en ]; then
|
||||||
if [ "$DEPLOY_GITEA" = "true" ]; then
|
if [ "$DEPLOY_GITEA" = "true" ]; then
|
||||||
@ -56,11 +59,11 @@ EOL
|
|||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
cat >> "$DOCKER_YAML_PATH" <<EOL
|
cat >> "$DOCKER_YAML_PATH" <<EOL
|
||||||
volumes:
|
volumes:
|
||||||
- ${REMOTE_DATA_PATH}/letsencrypt:/etc/letsencrypt:ro
|
- ${REMOTE_DATA_PATH_LETSENCRYPT}:/etc/letsencrypt:ro
|
||||||
EOL
|
EOL
|
||||||
if [ "$DEPLOY_CLAMS" = true ]; then
|
if [ "$DEPLOY_CLAMS" = true ]; then
|
||||||
cat >> "$DOCKER_YAML_PATH" <<EOL
|
cat >> "$DOCKER_YAML_PATH" <<EOL
|
||||||
@ -85,13 +88,11 @@ EOL
|
|||||||
|
|
||||||
|
|
||||||
################ NETWORKS SECTION
|
################ NETWORKS SECTION
|
||||||
|
cat >> "$DOCKER_YAML_PATH" <<EOL
|
||||||
cat >> "$DOCKER_YAML_PATH" <<EOL
|
|
||||||
networks:
|
networks:
|
||||||
EOL
|
EOL
|
||||||
|
|
||||||
|
for DOMAIN_NAME in ${DOMAIN_LIST//,/ }; do
|
||||||
for DOMAIN_NAME in ${DOMAIN_LIST//,/ }; do
|
|
||||||
export DOMAIN_NAME="$DOMAIN_NAME"
|
export DOMAIN_NAME="$DOMAIN_NAME"
|
||||||
export SITE_PATH="$SITES_PATH/$DOMAIN_NAME"
|
export SITE_PATH="$SITES_PATH/$DOMAIN_NAME"
|
||||||
|
|
||||||
@ -103,18 +104,18 @@ EOL
|
|||||||
# for each language specified in the site.conf, we spawn a separate ghost container
|
# for each language specified in the site.conf, we spawn a separate ghost container
|
||||||
# at https://www.domain.com/$LANGUAGE_CODE
|
# at https://www.domain.com/$LANGUAGE_CODE
|
||||||
for LANGUAGE_CODE in ${SITE_LANGUAGE_CODES//,/ }; do
|
for LANGUAGE_CODE in ${SITE_LANGUAGE_CODES//,/ }; do
|
||||||
|
if [ "$DEPLOY_GHOST" = true ]; then
|
||||||
cat >> "$DOCKER_YAML_PATH" <<EOL
|
cat >> "$DOCKER_YAML_PATH" <<EOL
|
||||||
ghostnet-$DOMAIN_IDENTIFIER-$LANGUAGE_CODE:
|
ghostnet-$DOMAIN_IDENTIFIER-$LANGUAGE_CODE:
|
||||||
attachable: true
|
attachable: true
|
||||||
|
|
||||||
EOL
|
EOL
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "$LANGUAGE_CODE" = en ]; then
|
if [ "$LANGUAGE_CODE" = en ]; then
|
||||||
if [ "$DEPLOY_GITEA" = true ]; then
|
if [ "$DEPLOY_GITEA" = true ]; then
|
||||||
cat >> "$DOCKER_YAML_PATH" <<EOL
|
cat >> "$DOCKER_YAML_PATH" <<EOL
|
||||||
giteanet-$DOMAIN_IDENTIFIER-en:
|
giteanet-$DOMAIN_IDENTIFIER-en:
|
||||||
attachable: true
|
attachable: true
|
||||||
|
|
||||||
EOL
|
EOL
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -122,7 +123,6 @@ EOL
|
|||||||
cat >> "$DOCKER_YAML_PATH" <<EOL
|
cat >> "$DOCKER_YAML_PATH" <<EOL
|
||||||
nextcloudnet-$DOMAIN_IDENTIFIER-en:
|
nextcloudnet-$DOMAIN_IDENTIFIER-en:
|
||||||
attachable: true
|
attachable: true
|
||||||
|
|
||||||
EOL
|
EOL
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -133,9 +133,12 @@ EOL
|
|||||||
EOL
|
EOL
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
done
|
||||||
|
|
||||||
if [ "$STOP_SERVICES" = false ]; then
|
if [ "$STOP_SERVICES" = false ]; then
|
||||||
docker stack deploy -c "$DOCKER_YAML_PATH" "reverse-proxy"
|
docker stack deploy -c "$DOCKER_YAML_PATH" reverse-proxy
|
||||||
# iterate over all our domains and create the nginx config file.
|
# iterate over all our domains and create the nginx config file.
|
||||||
sleep 1
|
sleep 3
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user