feat: add domain and install scripts for apps

This commit is contained in:
lolwierd
2026-03-27 19:32:47 +05:30
parent 442ae83280
commit 9b93d6898b
26 changed files with 900 additions and 13 deletions

28
open-webui/domain.sh Normal file
View File

@@ -0,0 +1,28 @@
#!/bin/bash
APP_NAME="open-webui"
APP_DIR="/var/excloud/apps"
APP_UPSTREAM_PORT="${EXC_APP_UPSTREAM_PORT:-3000}"
DOMAIN="${1}"
if [ -z "${DOMAIN}" ]; then
echo "Error: URL argument is required. Example:" >&2
echo "domain.sh sub.example.com" >&2
exit 1
fi
URL="https://${DOMAIN}"
COMPOSE_FILE="${APP_DIR}/${APP_NAME}/docker-compose.yml"
cat > /etc/caddy/Caddyfile <<EOF
${URL} {
reverse_proxy 127.0.0.1:${APP_UPSTREAM_PORT}
}
EOF
echo "Caddyfile updated"
systemctl enable caddy
docker compose -f "${COMPOSE_FILE}" up -d --remove-orphans
systemctl reload caddy

42
open-webui/install.sh Normal file
View File

@@ -0,0 +1,42 @@
#!/bin/bash
APP_NAME="open-webui"
APP_DIR="/var/excloud/apps"
SCRIPT_DIR="/var/excloud/scripts"
APP_UPSTREAM_PORT="${EXC_APP_UPSTREAM_PORT:-3000}"
mkdir -p "${APP_DIR}"
mkdir -p "${SCRIPT_DIR}"
DOMAIN="${1}"
if [ -z "${DOMAIN}" ]; then
echo "Error: URL argument is required. Example:" >&2
echo "install.sh sub.example.com" >&2
exit 1
fi
OPEN_WEBUI_DIR="${APP_DIR}/${APP_NAME}"
COMPOSE_FILE="${OPEN_WEBUI_DIR}/docker-compose.yml"
apt-get install -y caddy openssl
mkdir -p "${OPEN_WEBUI_DIR}"
WEBUI_SECRET_KEY="$(openssl rand -hex 32)"
cat > "${COMPOSE_FILE}" <<EOF
services:
open-webui:
image: ghcr.io/open-webui/open-webui:v0.8.6
restart: always
ports:
- "127.0.0.1:${APP_UPSTREAM_PORT}:8080"
environment:
WEBUI_SECRET_KEY: "${WEBUI_SECRET_KEY}"
volumes:
- open-webui:/app/backend/data
volumes:
open-webui:
EOF
bash "${SCRIPT_DIR}/domain.sh" "${DOMAIN}"