make install script

This commit is contained in:
2023-06-23 10:33:01 +02:00
parent 0d18a85afa
commit c5f26ac69b
3 changed files with 41 additions and 2 deletions

View File

@@ -8,7 +8,7 @@
# this machine's public IP, then replace ":80" below with your # this machine's public IP, then replace ":80" below with your
# domain name. # domain name.
https://fotky.h21.fun { https://__DOMAIN__ {
reverse_proxy photo:80 reverse_proxy photo:80
} }
# Refer to the Caddy docs for more information: # Refer to the Caddy docs for more information:

View File

@@ -34,7 +34,7 @@ services:
# If the photos are located at `/home/user/photos`, then change this value # If the photos are located at `/home/user/photos`, then change this value
# to the following: `/home/user/photos:/photos:ro`. # to the following: `/home/user/photos:/photos:ro`.
# You can mount multiple paths, if your photos are spread across multiple directories. # You can mount multiple paths, if your photos are spread across multiple directories.
- /mnt/fotky:/photos:ro - __PHOTO__:/photos:ro
caddy: caddy:
image: caddy:latest image: caddy:latest
restart: unless-stopped restart: unless-stopped

39
setup.sh Executable file
View File

@@ -0,0 +1,39 @@
#!/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
mkdir -p $HOME/etc/caddy
sed -e "s/__DOMAIN__/$DOMAIN/" Caddyfile > $HOME/etc/caddy/caddyfile
sed -e "s/__PHOTO__/$PHOTOS/" docker-compose.yml > $HOME/etc
# install
cd $HOME/etc
docker compose up -d