Add signoz.

This commit is contained in:
2026-03-25 15:43:21 +05:30
parent 2b48107b65
commit d00c00fc34
5 changed files with 464 additions and 0 deletions

53
signoz/domain-signoz.sh Normal file
View File

@@ -0,0 +1,53 @@
#!/bin/bash
APP_NAME="signoz"
APP_DIR="/var/excloud/apps"
SCRIPT_DIR="/var/excloud/scripts"
DOMAIN="${1}"
if [ -z "$DOMAIN" ]; then
echo "Error: URL argument is required. Example:" >&2
echo "domain-change.sh sub.example.com" >&2
exit 1
fi
URL="https://${DOMAIN}"
COMPOSE_FILE="${APP_DIR}/signoz/deploy/docker/docker-compose.yaml"
set_env() {
local key="$1"
local value="$2"
local service_path="$3"
local env_pair="${key}=${value}"
if yq "${service_path}" "$COMPOSE_FILE" | grep -q "${key}="; then
yq -yi "(${service_path}[] | select(type == \"string\" and test(\"^${key}=\"))) = \"${env_pair}\"" "$COMPOSE_FILE"
echo "Replaced: ${env_pair}"
else
yq -yi "${service_path} += [\"${env_pair}\"]" "$COMPOSE_FILE"
echo "Added: ${env_pair}"
fi
}
set_env "SIGNOZ_GLOBAL_EXTERNAL_URL" "${URL}" ".services.signoz.environment"
set_env "SIGNOZ_GLOBAL_INGESTION_URL" "${URL}" ".services.signoz.environment"
cat > /etc/caddy/Caddyfile << EOF
${URL} {
reverse_proxy localhost:8080
}
${URL}:4317 {
reverse_proxy h2c://localhost:44317
}
${URL}:4318 {
reverse_proxy localhost:44318
}
EOF
echo "Caddyfile updated"
docker compose -f $COMPOSE_FILE up -d --remove-orphans
systemctl reload caddy

46
signoz/install-signoz.sh Normal file
View File

@@ -0,0 +1,46 @@
#!/bin/bash
APP_NAME="signoz"
APP_DIR="/var/excloud/apps"
SCRIPT_DIR="/var/excloud/scripts"
DOMAIN="${1}"
if [ -z "$DOMAIN" ]; then
echo "Error: URL argument is required. Example:" >&2
echo "domain-change.sh sub.example.com" >&2
exit 1
fi
SIGNOZ_DIR="${APP_DIR}/signoz"
COMPOSE_FILE="${SIGNOZ_DIR}/deploy/docker/docker-compose.yaml"
OTEL_SERVICE_PATH='.services["otel-collector"].ports'
SIGNOZ_SERVICE_PATH=".services.signoz.ports"
mkdir -p "${APP_DIR}"
mkdir -p "${SCRIPT_DIR}"
apt-get install -y caddy yq
rm -rf ${SIGNOZ_DIR}
git clone -b main https://github.com/SigNoz/signoz.git ${SIGNOZ_DIR}
cd ${SIGNOZ_DIR}/deploy/docker
bash "${SCRIPT_DIR}/domain-signoz.sh" "${DOMAIN}"
set_port() {
local port_pair="$1"
local service_path="$2"
local port_num="${port_pair##*:}"
if yq "${service_path}[] | select(. == ${port_num} or (type == \"string\" and test(\"${port_num}:${port_num}\")))" "$COMPOSE_FILE" | grep -q .; then
yq -yi "(${service_path}[] | select(. == ${port_num} or (type == \"string\" and test(\"${port_num}:${port_num}\")))) = \"${port_pair}\"" "$COMPOSE_FILE"
echo "Replaced: ${port_pair}"
else
yq -yi "${service_path} += [\"${port_pair}\"]" "$COMPOSE_FILE"
echo "Added: ${port_pair}"
fi
}
set_port "127.0.0.1:44317:4317" "$OTEL_SERVICE_PATH"
set_port "127.0.0.1:44318:4318" "$OTEL_SERVICE_PATH"
set_port "127.0.0.1:8080:8080" "$SIGNOZ_SERVICE_PATH"
docker compose -f $COMPOSE_FILE up -d --remove-orphans