2021-12-25 18:43:01 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2022-05-24 18:13:54 +00:00
|
|
|
set -e
|
2022-05-20 15:05:38 +00:00
|
|
|
cd "$(dirname "$0")"
|
|
|
|
|
2022-05-24 18:13:54 +00:00
|
|
|
cat ./certs/docker.gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
|
2022-05-10 16:15:32 +00:00
|
|
|
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
|
|
|
|
|
2021-12-25 18:43:01 +00:00
|
|
|
sudo apt-get update
|
|
|
|
|
2022-05-24 18:13:54 +00:00
|
|
|
sudo apt-get install -y wait-for-it dnsutils rsync sshfs \
|
|
|
|
apt-transport-https ca-certificates \
|
|
|
|
curl gnupg lsb-release docker-ce-cli \
|
|
|
|
docker-ce python3-pip libusb-1.0-0-dev \
|
|
|
|
pinentry-curses containerd.io docker-compose-plugin
|
2022-05-20 15:05:38 +00:00
|
|
|
#libudev-dev
|
2021-12-25 18:43:01 +00:00
|
|
|
|
2022-05-20 15:05:38 +00:00
|
|
|
# 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
|
2021-12-25 18:43:01 +00:00
|
|
|
sudo snap install lxd
|
|
|
|
fi
|
|
|
|
|
2022-05-20 15:05:38 +00:00
|
|
|
# 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
|
|
|
|
|
|
|
|
|
|
|
|
# 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
|
2021-12-25 18:43:01 +00:00
|
|
|
|
|
|
|
pip3 install trezor_agent
|
|
|
|
|
|
|
|
sudo cp ./51-trezor.rules /etc/udev/rules.d/51-trezor.rules
|
2022-05-20 15:05:38 +00:00
|
|
|
|
|
|
|
# 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
|
2022-05-24 18:13:54 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# make ss-deploy available to the user
|
|
|
|
|
|
|
|
sudo groupadd docker
|
|
|
|
sudo usermod -aG docker "$USER"
|
|
|
|
|
|
|
|
|
|
|
|
# TODO CHECK IF EXISTS
|
|
|
|
echo "alias ss-deploy='/home/$USER/sovereign-stack/deploy.sh \$@'" >> "$HOME/.bashrc"
|