|
|
|
@@ -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>" $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 ""
|
|
|
|
|