44 lines
1.2 KiB
Bash
Executable File
44 lines
1.2 KiB
Bash
Executable File
#!/bin/bash
|
|
# setup photoview
|
|
# run as root
|
|
|
|
if [[ $(id -u) != "0" ]]; then
|
|
echo RUN AS ROOT!!
|
|
exit 1
|
|
fi
|
|
|
|
# install docker
|
|
apt-get update
|
|
apt-get install ca-certificates curl gnupg -y
|
|
install -m 0755 -d /etc/apt/keyrings
|
|
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
|
|
chmod a+r /etc/apt/keyrings/docker.gpg
|
|
echo \
|
|
"deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
|
|
"$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" > /etc/apt/sources.list.d/docker.list
|
|
apt-get update
|
|
apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y
|
|
|
|
# where to store photos
|
|
read -p "Kde chcete mít fotky? [/mnt/fotky]"
|
|
PHOTOS=${REPLY:-/mnt/fotky}
|
|
echo $PHOTOS
|
|
|
|
# serve at what domain
|
|
read -p "Na jaké doméně budou stránky? "
|
|
DOMAIN=${REPLY?Musíte mít doménu}
|
|
echo $DOMAIN
|
|
|
|
# make config files
|
|
home=/home/ubuntu
|
|
sudo -u ubuntu mkdir -p $home/etc/caddy
|
|
sed -e "s:__DOMAIN__:$DOMAIN:" Caddyfile | sudo -u ubuntu tee $home/etc/caddy/Caddyfile
|
|
sed -e "s:__PHOTO__:$PHOTOS:" docker-compose.yml | sudo -u ubuntu tee $home/etc/docker-compose.yml
|
|
|
|
# install
|
|
cd $HOME/etc
|
|
docker compose up -d
|
|
|
|
# SSH
|
|
# #TODO
|