INstaller improvements.
Signed-off-by: Derek Smith <derek@farscapian.com>
This commit is contained in:
parent
7d62c573ab
commit
6e9803357b
36
deploy.sh
36
deploy.sh
@ -82,6 +82,15 @@ for i in "$@"; do
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# check for the env file. Source it if there.
|
||||||
|
if [ -f "$(pwd)/env" ]; then
|
||||||
|
source "$(pwd)/env";
|
||||||
|
else
|
||||||
|
echo "ERROR: '$(pwd)/env' does not exist. Please go run install.sh again."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# ensure the VPS_HOSTING_TARGET
|
||||||
if [ -z "$VPS_HOSTING_TARGET" ]; then
|
if [ -z "$VPS_HOSTING_TARGET" ]; then
|
||||||
echo "ERROR: You MUST specicy --hosting-provider=[lxd|aws]"
|
echo "ERROR: You MUST specicy --hosting-provider=[lxd|aws]"
|
||||||
exit 1
|
exit 1
|
||||||
@ -105,18 +114,7 @@ export MACVLAN_INTERFACE="$MACVLAN_INTERFACE"
|
|||||||
# fi
|
# fi
|
||||||
|
|
||||||
# shellcheck disable=SC1091
|
# shellcheck disable=SC1091
|
||||||
source ./defaults.sh
|
source "$(pwd)/deployment/defaults.sh"
|
||||||
|
|
||||||
# if there's a ./env file here, let's execute it. Admins can put various deployment-specific things there.
|
|
||||||
if [ -f "$(pwd)/env" ]; then
|
|
||||||
source "$(pwd)/env";
|
|
||||||
else
|
|
||||||
echo "#!/bin/bash" >> "$(pwd)/env"
|
|
||||||
chmod 0744 "$(pwd)/env"
|
|
||||||
echo "We stubbed out a '$(pwd)/env' file for you. Put any LXD-remote specific information in there."
|
|
||||||
echo "Check out 'https://www.sovereign-stack.org/env' for an example."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# iterate over all our server endpoints and provision them if needed.
|
# iterate over all our server endpoints and provision them if needed.
|
||||||
# www
|
# www
|
||||||
@ -125,7 +123,7 @@ for APP_TO_DEPLOY in btcpay www umbrel; do
|
|||||||
FQDN=
|
FQDN=
|
||||||
export APP_TO_DEPLOY="$APP_TO_DEPLOY"
|
export APP_TO_DEPLOY="$APP_TO_DEPLOY"
|
||||||
# shellcheck disable=SC1091
|
# shellcheck disable=SC1091
|
||||||
source ./shared.sh
|
source "$(pwd)/deployment/shared.sh"
|
||||||
|
|
||||||
# skip this iteration if the site_definition says not to deploy btcpay server.
|
# skip this iteration if the site_definition says not to deploy btcpay server.
|
||||||
if [ "$APP_TO_DEPLOY" = btcpay ]; then
|
if [ "$APP_TO_DEPLOY" = btcpay ]; then
|
||||||
@ -159,8 +157,8 @@ for APP_TO_DEPLOY in btcpay www umbrel; do
|
|||||||
export FQDN="$VPS_HOSTNAME.$DOMAIN_NAME"
|
export FQDN="$VPS_HOSTNAME.$DOMAIN_NAME"
|
||||||
|
|
||||||
# generate the docker yaml and nginx configs.
|
# generate the docker yaml and nginx configs.
|
||||||
./stub_docker_yml.sh
|
bash -c "$(pwd)/deployment/stub_docker_yml.sh"
|
||||||
./stub_nginxconf.sh
|
bash -c "$(pwd)/deployment/stub_nginxconf.sh"
|
||||||
|
|
||||||
MACHINE_EXISTS=false
|
MACHINE_EXISTS=false
|
||||||
if [ "$VPS_HOSTING_TARGET" = aws ] && docker-machine ls -q | grep -q "$FQDN"; then
|
if [ "$VPS_HOSTING_TARGET" = aws ] && docker-machine ls -q | grep -q "$FQDN"; then
|
||||||
@ -185,7 +183,7 @@ for APP_TO_DEPLOY in btcpay www umbrel; do
|
|||||||
echo "Machine exists. We don't need to back it up because the user has directed --no-backup."
|
echo "Machine exists. We don't need to back it up because the user has directed --no-backup."
|
||||||
else
|
else
|
||||||
echo "Machine exists. Since we're going to delete it, let's grab a backup. We don't need to restore services since we're deleting it."
|
echo "Machine exists. Since we're going to delete it, let's grab a backup. We don't need to restore services since we're deleting it."
|
||||||
RUN_RESTORE=false RUN_BACKUP=true RUN_SERVICES=false ./domain_init.sh
|
RUN_RESTORE=false RUN_BACKUP=true RUN_SERVICES=false "$(pwd)/deployment/domain_init.sh"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# delete the remote VPS.
|
# delete the remote VPS.
|
||||||
@ -202,7 +200,7 @@ for APP_TO_DEPLOY in btcpay www umbrel; do
|
|||||||
# Then we run the script again to re-instantiate a new VPS, restoring all user data
|
# Then we run the script again to re-instantiate a new VPS, restoring all user data
|
||||||
# if restore directory doesn't exist, then we end up with a new site.
|
# if restore directory doesn't exist, then we end up with a new site.
|
||||||
echo "INFO: Recreating the remote VPS then restoring user data."
|
echo "INFO: Recreating the remote VPS then restoring user data."
|
||||||
RUN_RESTORE="$USER_RUN_RESTORE" RUN_BACKUP=false RUN_SERVICES=true ./domain_init.sh
|
RUN_RESTORE="$USER_RUN_RESTORE" RUN_BACKUP=false RUN_SERVICES=true "$(pwd)/deployment/domain_init.sh"
|
||||||
else
|
else
|
||||||
if [ "$USER_NO_BACKUP" = true ]; then
|
if [ "$USER_NO_BACKUP" = true ]; then
|
||||||
RUN_BACKUP=false
|
RUN_BACKUP=false
|
||||||
@ -212,7 +210,7 @@ for APP_TO_DEPLOY in btcpay www umbrel; do
|
|||||||
echo "INFO: Maintaining existing VPS. RUN_BACKUP=$RUN_BACKUP RUN_RESTORE=$USER_RUN_RESTORE"
|
echo "INFO: Maintaining existing VPS. RUN_BACKUP=$RUN_BACKUP RUN_RESTORE=$USER_RUN_RESTORE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
RUN_RESTORE="$USER_RUN_RESTORE" RUN_BACKUP="$RUN_BACKUP" RUN_SERVICES=true ./domain_init.sh
|
RUN_RESTORE="$USER_RUN_RESTORE" RUN_BACKUP="$RUN_BACKUP" RUN_SERVICES=true "$(pwd)/deployment/domain_init.sh"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if [ "$MIGRATE_VPS" = true ]; then
|
if [ "$MIGRATE_VPS" = true ]; then
|
||||||
@ -221,6 +219,6 @@ for APP_TO_DEPLOY in btcpay www umbrel; do
|
|||||||
|
|
||||||
# The machine does not exist. Let's bring it into existence, restoring from latest backup.
|
# The machine does not exist. Let's bring it into existence, restoring from latest backup.
|
||||||
echo "Machine does not exist. RUN_RESTORE=$USER_RUN_RESTORE RUN_BACKUP=false"
|
echo "Machine does not exist. RUN_RESTORE=$USER_RUN_RESTORE RUN_BACKUP=false"
|
||||||
RUN_RESTORE="$USER_RUN_RESTORE" RUN_BACKUP=false RUN_SERVICES=true ./domain_init.sh
|
RUN_RESTORE="$USER_RUN_RESTORE" RUN_BACKUP=false RUN_SERVICES=true "$(pwd)/deployment/domain_init.sh"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
33
install.sh
33
install.sh
@ -1,5 +1,8 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -ex
|
||||||
|
cd "$(dirname "$0")"
|
||||||
|
|
||||||
sudo apt-get remove docker docker-engine docker.io containerd runc
|
sudo apt-get remove docker docker-engine docker.io containerd runc
|
||||||
|
|
||||||
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
|
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
|
||||||
@ -7,18 +10,34 @@ echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg]
|
|||||||
|
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
|
|
||||||
sudo apt-get install -y wait-for-it dnsutils rsync sshfs apt-transport-https ca-certificates curl gnupg lsb-release docker-ce-cli python3-pip libusb-1.0-0-dev libudev-dev pinentry-curses
|
sudo apt-get install -y wait-for-it dnsutils rsync sshfs apt-transport-https ca-certificates curl gnupg lsb-release docker-ce-cli python3-pip libusb-1.0-0-dev pinentry-curses
|
||||||
|
#libudev-dev
|
||||||
|
|
||||||
if [ ! -f $(which lxd) ]; then
|
# install lxd as a snap if it's not installed. We only really use the LXC part of this package.
|
||||||
|
if ! snap list | grep -q lxd; then
|
||||||
sudo snap install lxd
|
sudo snap install lxd
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# let's ensure docker-machine is available.
|
# let's ensure docker-machine is available. This is only temporary though.
|
||||||
base="https://github.com/docker/machine/releases/download/v0.16.2"
|
curl -L https://github.com/docker/machine/releases/download/v0.16.2/docker-machine-$(uname -s)-$(uname -m) >/tmp/docker-machine &&
|
||||||
curl -s -L "$base/docker-machine-$(uname -s)-$(uname -m)" >/tmp/docker-machine
|
chmod +x /tmp/docker-machine &&
|
||||||
sudo mv /tmp/docker-machine /usr/local/bin/docker-machine
|
sudo cp /tmp/docker-machine /usr/local/bin/docker-machine
|
||||||
chmod +x /usr/local/bin/docker-machine
|
|
||||||
|
|
||||||
|
# base="https://github.com/docker/machine/releases/download/v0.16.2"
|
||||||
|
# curl -s -L "$base/docker-machine-$(uname -s)-$(uname -m)" >/tmp/docker-machine
|
||||||
|
# sudo mv /tmp/docker-machine /usr/local/bin/docker-machine
|
||||||
|
# chmod +x /usr/local/bin/docker-machine
|
||||||
|
|
||||||
pip3 install trezor_agent
|
pip3 install trezor_agent
|
||||||
|
|
||||||
sudo cp ./51-trezor.rules /etc/udev/rules.d/51-trezor.rules
|
sudo cp ./51-trezor.rules /etc/udev/rules.d/51-trezor.rules
|
||||||
|
|
||||||
|
# if there's a ./env file here, let's execute it. Admins can put various deployment-specific things there.
|
||||||
|
if [ ! -f "$(pwd)/env" ]; then
|
||||||
|
echo "#!/bin/bash" >> "$(pwd)/env"
|
||||||
|
chmod 0744 "$(pwd)/env"
|
||||||
|
echo "We stubbed out a '$(pwd)/env' file for you. Put any LXD-remote specific information in there."
|
||||||
|
echo "Check out 'https://www.sovereign-stack.org/env' for an example."
|
||||||
|
exit 1
|
||||||
|
fi
|
Loading…
Reference in New Issue
Block a user