59 lines
1.6 KiB
Plaintext
59 lines
1.6 KiB
Plaintext
|
#!/bin/bash
|
||
|
|
||
|
prog="$(basename "$0")"
|
||
|
|
||
|
usage() {
|
||
|
cat >&2 <<-EOF
|
||
|
usage: $prog [-h] [-Z POOL]
|
||
|
installs nasbeery onto your raspberry pi os
|
||
|
-Z POOL Name of the zpool to create (default: tank)
|
||
|
---------------------------------------------------------------------------
|
||
|
(C) 2022 nasbeery installer by bashclub (https://github.com/bashclub)
|
||
|
---------------------------------------------------------------------------
|
||
|
EOF
|
||
|
exit $1
|
||
|
}
|
||
|
|
||
|
ZPOOL=tank
|
||
|
|
||
|
|
||
|
while getopts "hZ:" opt; do
|
||
|
case $opt in
|
||
|
h) usage 0 ;;
|
||
|
Z) ZPOOL=$OPTARG ;;
|
||
|
*) usage 1 ;;
|
||
|
esac
|
||
|
done
|
||
|
shift $((OPTIND-1))
|
||
|
|
||
|
# create zfs filesystems
|
||
|
zfs create -o com.sun:auto-snapshot=false -o mountpoint=/var/lib/docker $ZPOOL/docker
|
||
|
zfs create -o com.sun:auto-snapshot=true -o mountpoint=/portainer $ZPOOL/portainer
|
||
|
|
||
|
# add docker repository
|
||
|
apt-key adv --fetch-keys https://download.docker.com/linux/debian/gpg
|
||
|
echo "deb https://download.docker.com/linux/debian $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
|
||
|
|
||
|
# update package lists and install docker engine + docker-compose
|
||
|
apt update
|
||
|
DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt install -y -qq --no-install-recommends docker-ce docker-ce-cli containerd.io docker-compose
|
||
|
|
||
|
# install portainer
|
||
|
cd /portainer
|
||
|
mkdir data
|
||
|
cat << EOF > /portainer/docker-compose.yml
|
||
|
version: '3.2'
|
||
|
services:
|
||
|
portainer:
|
||
|
image: portainer/portainer-ce
|
||
|
ports:
|
||
|
- "9443:9443"
|
||
|
- "8000:8000"
|
||
|
volumes:
|
||
|
- /portainer/data:/data
|
||
|
- /var/run/docker.sock:/var/run/docker.sock
|
||
|
restart: always
|
||
|
EOF
|
||
|
# start portainer
|
||
|
docker-compose up -d
|