diff --git a/Caddyfile b/Caddyfile index 4aa161f..8907ebb 100644 --- a/Caddyfile +++ b/Caddyfile @@ -8,7 +8,7 @@ # this machine's public IP, then replace ":80" below with your # domain name. -https://fotky.h21.fun { +https://__DOMAIN__ { reverse_proxy photo:80 } # Refer to the Caddy docs for more information: diff --git a/docker-compose.yml b/docker-compose.yml index ed3e72d..119539f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -34,7 +34,7 @@ services: # If the photos are located at `/home/user/photos`, then change this value # to the following: `/home/user/photos:/photos:ro`. # You can mount multiple paths, if your photos are spread across multiple directories. - - /mnt/fotky:/photos:ro + - __PHOTO__:/photos:ro caddy: image: caddy:latest restart: unless-stopped diff --git a/setup.sh b/setup.sh new file mode 100755 index 0000000..1440be4 --- /dev/null +++ b/setup.sh @@ -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