forked from ss/sovereign-stack
Various reliability checks.
This commit is contained in:
parent
b3857bb34d
commit
eb6c354922
76
install.sh
76
install.sh
@ -3,38 +3,46 @@
|
|||||||
set -ex
|
set -ex
|
||||||
cd "$(dirname "$0")"
|
cd "$(dirname "$0")"
|
||||||
|
|
||||||
cat ./certs/docker.gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
|
# let's check to ensure the management machine is on the Baseline ubuntu 21.04
|
||||||
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
|
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
|
||||||
|
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
|
|
||||||
sudo apt-get install -y wait-for-it dnsutils rsync sshfs \
|
sudo apt-get install -y wait-for-it dnsutils rsync sshfs curl gnupg \
|
||||||
apt-transport-https ca-certificates \
|
apt-transport-https ca-certificates lsb-release \
|
||||||
curl gnupg lsb-release docker-ce-cli \
|
docker-ce-cli docker-ce containerd.io docker-compose-plugin \
|
||||||
docker-ce python3-pip libusb-1.0-0-dev \
|
python3-pip python3-dev libusb-1.0-0-dev libudev-dev pinentry-curses \
|
||||||
pinentry-curses containerd.io docker-compose-plugin \
|
|
||||||
libcanberra-gtk-module
|
libcanberra-gtk-module
|
||||||
#libudev-dev
|
|
||||||
|
|
||||||
# install lxd as a snap if it's not installed. We only really use the LXC part of this package.
|
# 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.
|
||||||
if ! snap list | grep -q lxd; then
|
if ! snap list | grep -q lxd; then
|
||||||
sudo snap install lxd
|
sudo snap install lxd
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# let's ensure docker-machine is available. This is only temporary though.
|
# TODO WORK ON GETTING RID OF THIS DEPENDENCY
|
||||||
curl -L "https://github.com/docker/machine/releases/download/v0.16.2/docker-machine-$(uname -s)-$(uname -m)" >/tmp/docker-machine &&
|
if [ ! -f /usr/local/bin/docker-machine ]; then
|
||||||
chmod +x /tmp/docker-machine &&
|
# let's ensure docker-machine is available. This is only temporary though.
|
||||||
sudo cp /tmp/docker-machine /usr/local/bin/docker-machine
|
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
|
||||||
# base="https://github.com/docker/machine/releases/download/v0.16.2"
|
fi
|
||||||
# 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
|
|
||||||
|
|
||||||
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 there's a ./env file here, let's execute it. Admins can put various deployment-specific things there.
|
||||||
if [ ! -f "$(pwd)/env" ]; then
|
if [ ! -f "$(pwd)/env" ]; then
|
||||||
@ -47,9 +55,25 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
# make ss-deploy available to the user
|
# make ss-deploy available to the user
|
||||||
|
if ! groups | grep -q docker; then
|
||||||
|
sudo groupadd docker
|
||||||
|
fi
|
||||||
|
|
||||||
sudo groupadd docker
|
|
||||||
sudo usermod -aG docker "$USER"
|
sudo usermod -aG docker "$USER"
|
||||||
|
|
||||||
# TODO CHECK IF EXISTS
|
# make the Sovereign Stack commands available to the user.
|
||||||
echo "alias ss-deploy='/home/$USER/sovereign-stack/deploy.sh \$@'" >> "$HOME/.bashrc"
|
# we use ~/.bashrc
|
||||||
|
ADDED_COMMAND=false
|
||||||
|
if ! cat "$HOME/.bashrc" | grep -q "ss-deploy"; then
|
||||||
|
echo "alias ss-deploy='/home/$USER/sovereign-stack/deploy.sh \$@'" >> "$HOME/.bashrc"
|
||||||
|
ADDED_COMMAND=true
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! cat "$HOME/.bashrc" | grep -q "ss-cluster"; then
|
||||||
|
echo "alias ss-cluster='/home/$USER/sovereign-stack/cluster.sh \$@'" >> "$HOME/.bashrc"
|
||||||
|
ADDED_COMMAND=true
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$ADDED_COMMAND" = true ]; then
|
||||||
|
echo "WARNING! You need to run 'source ~/.bashrc' before continuing."
|
||||||
|
fi
|
Loading…
Reference in New Issue
Block a user