diff --git a/deploy.sh b/deploy.sh index b562297..924ad25 100644 --- a/deploy.sh +++ b/deploy.sh @@ -108,7 +108,35 @@ replace_in_sqlite_db() { #example usage: replace_in_sqlite_db "database.sqlite" "Europe/Amsterdam" "UTC" +get_country_from_timezone() { + local timezone="$1" + # Extract the region and city from the timezone (e.g., "America/New_York" -> "New_York") + local city=$(echo "$timezone" | cut -d'/' -f2) + + # Use a predefined mapping for common cities (fallback if no better method is found) + # This is a minimal mapping; you can expand it as needed. + local declare -A city_to_country=( + ["New_York"]="United States" + ["Toronto"]="Canada" + ["Amsterdam"]="Netherlands" + ["London"]="United Kingdom" + ["Tokyo"]="Japan" + ["Paris"]="France" + ["Berlin"]="Germany" + ["Sydney"]="Australia" + ["Melbourne"]="Australia" + ) + + # Check if the city exists in the mapping + if [ -n "${city_to_country[$city]}" ]; then + echo "${city_to_country[$city]}" + else + # Fallback: Try to extract country from the timezone file (less reliable) + # This is a placeholder; actual implementation would require parsing timezone files. + echo "Unknown" + fi +} # what this script needs to do: @@ -120,6 +148,17 @@ echo read -rp "Timezone (e.g. Europe/Amsterdam): " timezone < /dev/tty read -rp "Domain (e.g. example.com): " domain < /dev/tty +echo "--------------------------------------------------------" +echo "please double-check your DNS records to ensure they are set. the following dns records need to be set:" +echo "" +echo "|name |type |value " +echo "|@ |A |$publicip " +echo "|* |CNAME |@ " +echo "" +echo "once you've done this, press any key to continue" +read -n 1 -s -r -p "" + + # Public IP (tries multiple services) publicip="$(curl -fsS https://api.ipify.org || curl -fsS https://ifconfig.me || echo "UNKNOWN")" @@ -143,7 +182,7 @@ onlyofficeJWT="$(rand_hex)" # install docker echo "Updating apt and installing prerequisites..." apt update -apt install -y ca-certificates curl +apt install -y ca-certificates curl git openssl curl gawk coreutils grep jq sqlite3 iso-codes echo "Setting up Docker GPG key..." install -m 0755 -d /etc/apt/keyrings @@ -169,7 +208,7 @@ apt install -y \ docker-ce-cli \ containerd.io \ docker-buildx-plugin \ - docker-compose-plugin + docker-compose-plugin echo "Docker installation complete." docker --version @@ -218,7 +257,6 @@ replace_string_recursive "/opt/stacks" "?onlyofficeJWT?" $onlyofficeJWT # install mailcow to /opt/stacks/mailcow so it shows up in dockge -apt install -y git openssl curl gawk coreutils grep jq sqlite3 umask 0022 #cd /opt/stacks #git clone https://github.com/mailcow/mailcow-dockerized mailcow @@ -251,7 +289,7 @@ read -n 1 -s -r -p "" cd /opt/stacks/dozzle docker compose up -d -echo "dozzle has been launched from http://dozzle.$domain, verify it is online" +echo "dozzle has been launched from http://dozzle.$domain, verify it is online, do not worry if the UI gives a time-out error, this is due to docker being busy while this script runs." cd /opt/stacks/convertx docker compose up -d @@ -282,16 +320,47 @@ docker compose up -d echo "vaultwarden has been launched from http://vault.$domain, verify it is online" #bookstack +cd /opt/stacks/bookstack +docker compose up -d +echo "bookstack has been launched from http://docs.$domain, verify it is online (this may take a bit) and log in with email 'admin@admin.com' and password 'password', then reset this account to use $adminemail and your password" #browser +cd /opt/stacks/browser +docker compose up -d +echo "filebrowser has been launched from http://browser.$domain, head to dockge (http://docker.$domain), open the filebrowser stack and check the logs for the initial admin password. make sure to change this in filebrowser's config, then press any key to continue" +read -n 1 -s -r -p "" #jellyfin +cd /opt/stacks/jellyfin +docker compose up -d +metadatacountry=$(get_country_from_timezone "$timezone") + +sleep 15 +echo "running jellyfin configuration" +docker exec -it "jellyfin" \ + sh -c "JFCLI_URI='http://localhost:8096' jfcli wizard \ + --display-language 'EN_US' \ + --admin-username '$adminemail' \ + --admin-password '$adminpass' \ + --metadata-language 'EN' \ + --metadata-country '$metadatacountry' \ + --allow-remote \ + --disallow-upnp \ + --listen-addr '0.0.0.0/0' \ + --listen-port '8096'" + #uptimekuma +# todo: pre-create database, placeholder database, include database. for database preconfig: turn off auth so user can set password afterwards #owncloud +# todo: use OC config commands to install addons and configure onlyoffice #pihole +systemctl restart systemd-resolved +cd /opt/stacks/pihole +docker compose up -d +echo "pihole has been launched from http://dns.$domain, to use pihole as your DNS provider, set your DNS to $localip in your router for DHCP and on your device for any device with a static ip. Currently, the DNS is configured to use the joindns4.eu DNS, which *also* has built-in adblocking." #dashboard replace_in_sqlite_db "/opt/stacks/dashboard/www/app.sqlite" "" $domain @@ -299,6 +368,7 @@ cd /opt/stacks/dashboard docker compose up -d echo "dashboard has been launched from http://dash.$domain, verify it is online, check that its entries work and press any button to continue" read -n 1 -s -r -p "" +#doesnt work yet echo "" diff --git a/stacks/browser/compose.yml b/stacks/browser/compose.yml index 9e72569..29e9ace 100644 --- a/stacks/browser/compose.yml +++ b/stacks/browser/compose.yml @@ -8,6 +8,7 @@ services: - dockge_default volumes: - /opt/stacks:/srv/stacks + - /opt/stacks/jellyfin/media:/srv/media - ./filebrowser.db:/database.db restart: unless-stopped networks: diff --git a/stacks/dashboard/compose.yml b/stacks/dashboard/compose.yml index 20aa681..2116ae0 100644 --- a/stacks/dashboard/compose.yml +++ b/stacks/dashboard/compose.yml @@ -5,7 +5,7 @@ services: environment: - PUID=1000 - PGID=1000 - - TZ=$timezone + - TZ=?timezone? - ALLOW_INTERNAL_REQUESTS=false #optional - APP_NAME=Home volumes: diff --git a/stacks/dashboard/www/app (1).sqlite b/stacks/dashboard/www/app (1).sqlite new file mode 100644 index 0000000..3280677 Binary files /dev/null and b/stacks/dashboard/www/app (1).sqlite differ diff --git a/stacks/npm/data/nginx/proxy_host/13.conf b/stacks/npm/data/nginx/proxy_host/13.conf index 86d1c06..c1f0e37 100644 --- a/stacks/npm/data/nginx/proxy_host/13.conf +++ b/stacks/npm/data/nginx/proxy_host/13.conf @@ -17,7 +17,7 @@ server { listen [::]:80; - server_name www.sdgserver.online; + server_name www.?domain?; http2 off; diff --git a/stacks/pihole/compose.yml b/stacks/pihole/compose.yml index 3580d8b..e68bab0 100644 --- a/stacks/pihole/compose.yml +++ b/stacks/pihole/compose.yml @@ -3,13 +3,15 @@ services: container_name: pihole image: pihole/pihole:latest dns: - - 1.1.1.1 + - 86.54.11.13 ports: - 53:53/tcp - 53:53/udp environment: TZ: Europe/Amsterdam FTLCONF_WEBSERVER_API_PASSWORD: ?adminpass? + FTLCONF_DNS_UPSTREAMS: '86.54.11.13' + FTLCONF_DNS_LISTENINGMODE: all volumes: - ./config:/etc/pihole - ./dns:/etc/dnsmasq.d