2021-12-25 18:43:01 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2022-05-28 03:07:17 +00:00
|
|
|
set -ex
|
2022-05-20 15:05:38 +00:00
|
|
|
cd "$(dirname "$0")"
|
|
|
|
|
2022-06-22 17:40:34 +00:00
|
|
|
# let's check to ensure the management machine is on the Baseline ubuntu 21.04
|
|
|
|
if ! lsb_release -d | grep -q "Ubuntu 22.04 LTS"; then
|
|
|
|
echo "ERROR: Your machine is not running the Ubuntu 22.04 LTS baseline OS on your management machine."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -f /usr/share/keyrings/docker-archive-keyring.gpg ]; then
|
|
|
|
cat ./certs/docker.gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
|
|
|
|
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
|
|
|
|
fi
|
2022-05-10 16:15:32 +00:00
|
|
|
|
2021-12-25 18:43:01 +00:00
|
|
|
sudo apt-get update
|
|
|
|
|
2022-06-22 17:40:34 +00:00
|
|
|
sudo apt-get install -y wait-for-it dnsutils rsync sshfs curl gnupg \
|
|
|
|
apt-transport-https ca-certificates lsb-release \
|
|
|
|
docker-ce-cli docker-ce containerd.io docker-compose-plugin \
|
|
|
|
python3-pip python3-dev libusb-1.0-0-dev libudev-dev pinentry-curses \
|
2022-05-30 02:43:42 +00:00
|
|
|
libcanberra-gtk-module
|
2021-12-25 18:43:01 +00:00
|
|
|
|
2022-06-22 17:40:34 +00:00
|
|
|
# for trezor installation
|
|
|
|
pip3 install setuptools wheel
|
|
|
|
pip3 install trezor_agent
|
|
|
|
|
|
|
|
if [ ! -f /etc/udev/rules.d/51-trezor.rules ]; then
|
|
|
|
sudo cp ./51-trezor.rules /etc/udev/rules.d/51-trezor.rules
|
|
|
|
fi
|
|
|
|
|
|
|
|
# install lxd as a snap if it's not installed. We only really use the client part of this package
|
|
|
|
# on the management machine.
|
2022-05-20 15:05:38 +00:00
|
|
|
if ! snap list | grep -q lxd; then
|
2022-10-26 23:33:43 +00:00
|
|
|
sudo snap install lxd --candidate
|
2021-12-25 18:43:01 +00:00
|
|
|
fi
|
|
|
|
|
2022-06-22 17:40:34 +00:00
|
|
|
# TODO WORK ON GETTING RID OF THIS DEPENDENCY
|
|
|
|
if [ ! -f /usr/local/bin/docker-machine ]; then
|
|
|
|
# let's ensure docker-machine is available. This is only temporary though.
|
|
|
|
curl -L "https://github.com/docker/machine/releases/download/v0.16.2/docker-machine-$(uname -s)-$(uname -m)" >/tmp/docker-machine &&
|
|
|
|
chmod +x /tmp/docker-machine &&
|
|
|
|
sudo cp /tmp/docker-machine /usr/local/bin/docker-machine
|
|
|
|
fi
|
2022-05-20 15:05:38 +00:00
|
|
|
|
2022-05-24 18:13:54 +00:00
|
|
|
# make ss-deploy available to the user
|
2022-06-22 17:40:34 +00:00
|
|
|
if ! groups | grep -q docker; then
|
|
|
|
sudo groupadd docker
|
|
|
|
fi
|
2022-05-24 18:13:54 +00:00
|
|
|
|
|
|
|
sudo usermod -aG docker "$USER"
|
|
|
|
|
2022-06-22 17:40:34 +00:00
|
|
|
# make the Sovereign Stack commands available to the user.
|
|
|
|
# we use ~/.bashrc
|
|
|
|
ADDED_COMMAND=false
|
2022-07-27 16:38:33 +00:00
|
|
|
if ! < "$HOME/.bashrc" grep -q "ss-deploy"; then
|
2022-06-22 17:40:34 +00:00
|
|
|
echo "alias ss-deploy='/home/$USER/sovereign-stack/deploy.sh \$@'" >> "$HOME/.bashrc"
|
|
|
|
ADDED_COMMAND=true
|
|
|
|
fi
|
|
|
|
|
2022-07-27 16:38:33 +00:00
|
|
|
if ! < "$HOME/.bashrc" grep -q "ss-cluster"; then
|
2022-06-22 17:40:34 +00:00
|
|
|
echo "alias ss-cluster='/home/$USER/sovereign-stack/cluster.sh \$@'" >> "$HOME/.bashrc"
|
|
|
|
ADDED_COMMAND=true
|
|
|
|
fi
|
|
|
|
|
2022-08-24 14:09:09 +00:00
|
|
|
if ! < "$HOME/.bashrc" grep -q "ss-projects"; then
|
|
|
|
echo "alias ss-projects='/home/$USER/sovereign-stack/projects.sh \$@'" >> "$HOME/.bashrc"
|
|
|
|
ADDED_COMMAND=true
|
|
|
|
fi
|
|
|
|
|
2022-06-22 17:40:34 +00:00
|
|
|
if [ "$ADDED_COMMAND" = true ]; then
|
|
|
|
echo "WARNING! You need to run 'source ~/.bashrc' before continuing."
|
|
|
|
fi
|