Whitespace, formatting, control udpates.
This commit is contained in:
parent
1ecbfe4442
commit
e38172dd2d
4
.vscode/settings.json
vendored
4
.vscode/settings.json
vendored
@ -13,8 +13,8 @@
|
|||||||
"shellcheck.customArgs": [],
|
"shellcheck.customArgs": [],
|
||||||
"shellcheck.ignorePatterns": {},
|
"shellcheck.ignorePatterns": {},
|
||||||
"shellcheck.exclude": [
|
"shellcheck.exclude": [
|
||||||
"SC1090",
|
// "SC1090",
|
||||||
"SC1091",
|
// "SC1091",
|
||||||
"SC2029"
|
"SC2029"
|
||||||
],
|
],
|
||||||
"terminal.integrated.fontFamily": "monospace",
|
"terminal.integrated.fontFamily": "monospace",
|
||||||
|
10
cluster.sh
10
cluster.sh
@ -3,9 +3,9 @@
|
|||||||
set -eux
|
set -eux
|
||||||
cd "$(dirname "$0")"
|
cd "$(dirname "$0")"
|
||||||
|
|
||||||
# NOTE This script is meant to be executed on your LXD bare metal servers. This script
|
# This script is meant to be executed on the management machine.
|
||||||
# ensures that the LXD daemon is installed via snap package, then initialize the daemon
|
# it reaches out to an SSH endpoint and provisions that machine
|
||||||
# to operate in clustered mode
|
# to use LXD.
|
||||||
|
|
||||||
COMMAND="${1:-}"
|
COMMAND="${1:-}"
|
||||||
DATA_PLANE_MACVLAN_INTERFACE=
|
DATA_PLANE_MACVLAN_INTERFACE=
|
||||||
@ -16,6 +16,7 @@ if [ "$COMMAND" = create ]; then
|
|||||||
# override the cluster name.
|
# override the cluster name.
|
||||||
CLUSTER_NAME="${2:-}"
|
CLUSTER_NAME="${2:-}"
|
||||||
|
|
||||||
|
|
||||||
if [ -z "$CLUSTER_NAME" ]; then
|
if [ -z "$CLUSTER_NAME" ]; then
|
||||||
echo "ERROR: The cluster name was not provided."
|
echo "ERROR: The cluster name was not provided."
|
||||||
exit 1
|
exit 1
|
||||||
@ -61,6 +62,7 @@ EOL
|
|||||||
|
|
||||||
if ! lxc remote list | grep -q "$CLUSTER_NAME"; then
|
if ! lxc remote list | grep -q "$CLUSTER_NAME"; then
|
||||||
FQDN="${3:-}"
|
FQDN="${3:-}"
|
||||||
|
shift
|
||||||
|
|
||||||
if [ -z "$FQDN" ]; then
|
if [ -z "$FQDN" ]; then
|
||||||
echo "ERROR: The Fully Qualified Domain Name of the new cluster member was not set."
|
echo "ERROR: The Fully Qualified Domain Name of the new cluster member was not set."
|
||||||
@ -85,7 +87,7 @@ EOL
|
|||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
# unknown option
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
@ -14,9 +14,12 @@ if [ "$UPDATE_BTCPAY" = true ]; then
|
|||||||
# btcpay-update.sh brings services back up, but does not take them down.
|
# btcpay-update.sh brings services back up, but does not take them down.
|
||||||
ssh "$FQDN" "sudo bash -c $BTCPAY_SERVER_APPPATH/btcpay-update.sh"
|
ssh "$FQDN" "sudo bash -c $BTCPAY_SERVER_APPPATH/btcpay-update.sh"
|
||||||
|
|
||||||
|
sleep 20
|
||||||
|
|
||||||
elif [ "$RESTORE_BTCPAY" = true ]; then
|
elif [ "$RESTORE_BTCPAY" = true ]; then
|
||||||
# run the update.
|
# run the update.
|
||||||
ssh "$FQDN" "bash -c $BTCPAY_SERVER_APPPATH/btcpay-down.sh"
|
ssh "$FQDN" "bash -c $BTCPAY_SERVER_APPPATH/btcpay-down.sh"
|
||||||
|
sleep 10
|
||||||
|
|
||||||
./restore.sh
|
./restore.sh
|
||||||
|
|
||||||
@ -54,7 +57,14 @@ if [ "$RUN_SERVICES" = true ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$OPEN_URL" = true ]; then
|
if [ "$OPEN_URL" = true ]; then
|
||||||
|
|
||||||
|
if [ "$VPS_HOSTING_TARGET" = lxd ]; then
|
||||||
|
if wait-for-it -t 5 "$WWW_FQDN:443"; then
|
||||||
|
xdg-open "https://$WWW_FQDN" > /dev/null 2>&1
|
||||||
|
fi
|
||||||
|
else
|
||||||
if wait-for-it -t 5 "$FQDN:443"; then
|
if wait-for-it -t 5 "$FQDN:443"; then
|
||||||
xdg-open "https://$FQDN" > /dev/null 2>&1
|
xdg-open "https://$FQDN" > /dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
@ -49,9 +49,7 @@ if ! lxc image list --format csv "$VM_NAME" | grep -q "$VM_NAME"; then
|
|||||||
lxc config set "$VM_NAME" "volatile.enp5s0.hwaddr=$SOVEREIGN_STACK_MAC_ADDRESS"
|
lxc config set "$VM_NAME" "volatile.enp5s0.hwaddr=$SOVEREIGN_STACK_MAC_ADDRESS"
|
||||||
|
|
||||||
lxc start "$VM_NAME"
|
lxc start "$VM_NAME"
|
||||||
|
sleep 10
|
||||||
# let's wait a minimum of 15 seconds before we start checking for an IP address.
|
|
||||||
sleep 15
|
|
||||||
|
|
||||||
# let's wait for the LXC vm remote machine to get an IP address.
|
# let's wait for the LXC vm remote machine to get an IP address.
|
||||||
./wait_for_lxc_ip.sh "$VM_NAME"
|
./wait_for_lxc_ip.sh "$VM_NAME"
|
||||||
@ -59,5 +57,5 @@ if ! lxc image list --format csv "$VM_NAME" | grep -q "$VM_NAME"; then
|
|||||||
# stop the VM and get a snapshot.
|
# stop the VM and get a snapshot.
|
||||||
lxc stop "$VM_NAME"
|
lxc stop "$VM_NAME"
|
||||||
lxc publish "$CLUSTER_NAME:$VM_NAME" --alias "$VM_NAME" --public
|
lxc publish "$CLUSTER_NAME:$VM_NAME" --alias "$VM_NAME" --public
|
||||||
lxc delete "$VM_NAME"
|
|
||||||
fi
|
fi
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
set -eux
|
set -eux
|
||||||
cd "$(dirname "$0")"
|
cd "$(dirname "$0")"
|
||||||
|
|
||||||
|
|
||||||
# let's make sure we have an ssh keypair. We just use ~/.ssh/id_rsa
|
# let's make sure we have an ssh keypair. We just use ~/.ssh/id_rsa
|
||||||
# TODO convert this to SSH private key held on Trezor. THus trezor-T required for
|
# TODO convert this to SSH private key held on Trezor. THus trezor-T required for
|
||||||
# login operations. This should be configurable of course.
|
# login operations. This should be configurable of course.
|
||||||
@ -83,4 +82,4 @@ export DOCKER_HOST="ssh://ubuntu@$FQDN"
|
|||||||
# the following scripts take responsibility for the rest of the provisioning depending on the app you're deploying.
|
# the following scripts take responsibility for the rest of the provisioning depending on the app you're deploying.
|
||||||
bash -c "./$VIRTUAL_MACHINE/go.sh"
|
bash -c "./$VIRTUAL_MACHINE/go.sh"
|
||||||
|
|
||||||
echo "Successfull deployed '$DOMAIN_NAME' with git commit '$(cat ./.git/refs/heads/master)' VPS_HOSTING_TARGET=$VPS_HOSTING_TARGET;"
|
echo "Successfully deployed '$DOMAIN_NAME' with git commit '$(cat ./.git/refs/heads/master)' VPS_HOSTING_TARGET=$VPS_HOSTING_TARGET;"
|
||||||
|
@ -22,5 +22,7 @@ done
|
|||||||
# we are using IP address here so we don't have to rely on external DNS
|
# we are using IP address here so we don't have to rely on external DNS
|
||||||
# configuration for the base image preparataion.
|
# configuration for the base image preparataion.
|
||||||
ssh-keygen -R "$IP_V4_ADDRESS"
|
ssh-keygen -R "$IP_V4_ADDRESS"
|
||||||
|
|
||||||
ssh-keyscan -H -t ecdsa "$IP_V4_ADDRESS" >> "$SSH_HOME/known_hosts"
|
ssh-keyscan -H -t ecdsa "$IP_V4_ADDRESS" >> "$SSH_HOME/known_hosts"
|
||||||
|
|
||||||
ssh "ubuntu@$IP_V4_ADDRESS" sudo chown -R ubuntu:ubuntu /home/ubuntu
|
ssh "ubuntu@$IP_V4_ADDRESS" sudo chown -R ubuntu:ubuntu /home/ubuntu
|
||||||
|
Loading…
Reference in New Issue
Block a user