Add user_target_project to deploy.sh
This commit is contained in:
parent
2411067cd1
commit
72c4df897a
45
deploy.sh
45
deploy.sh
@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -ex
|
set -e
|
||||||
cd "$(dirname "$0")"
|
cd "$(dirname "$0")"
|
||||||
|
|
||||||
LATEST_GIT_COMMIT="$(cat ./.git/refs/heads/main)"
|
LATEST_GIT_COMMIT="$(cat ./.git/refs/heads/main)"
|
||||||
@ -56,6 +56,7 @@ REMOTE_NAME="$(lxc remote get-default)"
|
|||||||
STOP_SERVICES=false
|
STOP_SERVICES=false
|
||||||
USER_SAYS_YES=false
|
USER_SAYS_YES=false
|
||||||
RESTART_FRONT_END=true
|
RESTART_FRONT_END=true
|
||||||
|
USER_TARGET_PROJECT=
|
||||||
|
|
||||||
# grab any modifications from the command line.
|
# grab any modifications from the command line.
|
||||||
for i in "$@"; do
|
for i in "$@"; do
|
||||||
@ -91,6 +92,10 @@ for i in "$@"; do
|
|||||||
BACKUP_BTCPAY_ARCHIVE_PATH="${i#*=}"
|
BACKUP_BTCPAY_ARCHIVE_PATH="${i#*=}"
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
--project=*)
|
||||||
|
USER_TARGET_PROJECT="${i#*=}"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
--update-btcpay)
|
--update-btcpay)
|
||||||
UPDATE_BTCPAY=true
|
UPDATE_BTCPAY=true
|
||||||
shift
|
shift
|
||||||
@ -188,7 +193,7 @@ function stub_site_definition {
|
|||||||
|
|
||||||
# stub out a site.conf with new passwords.
|
# stub out a site.conf with new passwords.
|
||||||
cat >"$SITE_DEFINITION_PATH" <<EOL
|
cat >"$SITE_DEFINITION_PATH" <<EOL
|
||||||
#!/bin/bash
|
# https://www.sovereign-stack.org/ss-deploy/#siteconf
|
||||||
|
|
||||||
export DOMAIN_NAME="${DOMAIN_NAME}"
|
export DOMAIN_NAME="${DOMAIN_NAME}"
|
||||||
#export BTCPAY_ALT_NAMES="tip,store,pay,send"
|
#export BTCPAY_ALT_NAMES="tip,store,pay,send"
|
||||||
@ -227,6 +232,18 @@ for PROJECT_CHAIN in ${DEPLOYMENT_STRING//,/ }; do
|
|||||||
PROJECT_NAME="$PROJECT_PREFIX-$BITCOIN_CHAIN"
|
PROJECT_NAME="$PROJECT_PREFIX-$BITCOIN_CHAIN"
|
||||||
PROJECT_PATH="$PROJECTS_DIR/$PROJECT_NAME"
|
PROJECT_PATH="$PROJECTS_DIR/$PROJECT_NAME"
|
||||||
|
|
||||||
|
# if the user sets USER_TARGET_PROJECT, let's ensure the project exists.
|
||||||
|
if [ -n "$USER_TARGET_PROJECT" ]; then
|
||||||
|
|
||||||
|
if [ "$PROJECT_NAME" != "$USER_TARGET_PROJECT" ]; then
|
||||||
|
echo "INFO: Skipping project '$PROJECT_NAME' since the system owner has used the --project switch."
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
export PROJECT_NAME="$PROJECT_NAME"
|
||||||
|
export PROJECT_PATH="$PROJECT_PATH"
|
||||||
|
|
||||||
mkdir -p "$PROJECT_PATH" "$REMOTE_PATH/projects"
|
mkdir -p "$PROJECT_PATH" "$REMOTE_PATH/projects"
|
||||||
|
|
||||||
# create a symlink from ./remotepath/projects/project
|
# create a symlink from ./remotepath/projects/project
|
||||||
@ -234,13 +251,16 @@ for PROJECT_CHAIN in ${DEPLOYMENT_STRING//,/ }; do
|
|||||||
ln -s "$PROJECT_PATH" "$REMOTE_PATH/projects/$PROJECT_NAME"
|
ln -s "$PROJECT_PATH" "$REMOTE_PATH/projects/$PROJECT_NAME"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# check to see if the enf file exists. exist if not.
|
# check to see if the enf file exists. exist if not.
|
||||||
PROJECT_DEFINITION_PATH="$PROJECT_PATH/project.conf"
|
PROJECT_DEFINITION_PATH="$PROJECT_PATH/project.conf"
|
||||||
if [ ! -f "$PROJECT_DEFINITION_PATH" ]; then
|
if [ ! -f "$PROJECT_DEFINITION_PATH" ]; then
|
||||||
|
|
||||||
# stub out a project.conf
|
# stub out a project.conf
|
||||||
cat >"$PROJECT_DEFINITION_PATH" <<EOL
|
cat >"$PROJECT_DEFINITION_PATH" <<EOL
|
||||||
#!/bin/bash
|
# see https://www.sovereign-stack.org/ss-deploy/#projectconf for more info.
|
||||||
|
|
||||||
|
PRIMARY_DOMAIN="domain0.tld"
|
||||||
|
# OTHER_SITES_LIST="domain1.tld,domain2.tld,domain3.tld"
|
||||||
|
|
||||||
WWW_SERVER_MAC_ADDRESS=
|
WWW_SERVER_MAC_ADDRESS=
|
||||||
# WWW_SERVER_CPU_COUNT="6"
|
# WWW_SERVER_CPU_COUNT="6"
|
||||||
@ -262,21 +282,21 @@ EOL
|
|||||||
# source project defition.
|
# source project defition.
|
||||||
source "$PROJECT_DEFINITION_PATH"
|
source "$PROJECT_DEFINITION_PATH"
|
||||||
|
|
||||||
if [ -z "$PRIMARY_DOMAIN" ]; then
|
if [ -z "$PRIMARY_DOMAIN" ]; then
|
||||||
echo "ERROR: The PRIMARY_DOMAIN is not specified. Check your project.conf."
|
echo "ERROR: The PRIMARY_DOMAIN is not specified. Check your project.conf."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$WWW_SERVER_MAC_ADDRESS" ]; then
|
if [ -z "$WWW_SERVER_MAC_ADDRESS" ]; then
|
||||||
echo "ERROR: the WWW_SERVER_MAC_ADDRESS is not specified. Check your project.conf."
|
echo "ERROR: the WWW_SERVER_MAC_ADDRESS is not specified. Check your project.conf."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if [ -z "$BTCPAYSERVER_MAC_ADDRESS" ]; then
|
if [ -z "$BTCPAYSERVER_MAC_ADDRESS" ]; then
|
||||||
echo "ERROR: the BTCPAYSERVER_MAC_ADDRESS is not specified. Check your project.conf."
|
echo "ERROR: the BTCPAYSERVER_MAC_ADDRESS is not specified. Check your project.conf."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# the DOMAIN_LIST is a complete list of all our domains. We often iterate over this list.
|
# the DOMAIN_LIST is a complete list of all our domains. We often iterate over this list.
|
||||||
DOMAIN_LIST="${PRIMARY_DOMAIN}"
|
DOMAIN_LIST="${PRIMARY_DOMAIN}"
|
||||||
@ -434,4 +454,5 @@ fi
|
|||||||
|
|
||||||
ssh ubuntu@"$BTCPAY_FQDN" "echo $LATEST_GIT_COMMIT > /home/ubuntu/.ss-githead"
|
ssh ubuntu@"$BTCPAY_FQDN" "echo $LATEST_GIT_COMMIT > /home/ubuntu/.ss-githead"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
done
|
done
|
Loading…
Reference in New Issue
Block a user