common/telemetry.py builds the Resource, TracerProvider, BatchSpanProcessor and OTLP/HTTP exporter by hand; sanctions calls setup_telemetry() at import instead of running under opentelemetry-instrument. No instrumentor is enabled yet, so sanctions emits no spans for now. service.version comes from OTEL_RESOURCE_ATTRIBUTES: deploy.sh exports DEPLOY_HASH (the server's HEAD after the pull) and compose falls back to "dev". deployment.environment.name=prod is dropped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
28 lines
1.1 KiB
Bash
Executable File
28 lines
1.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Redeploy Ledgerline on the server: pull the latest code and (re)start the
|
|
# stack behind Traefik. Run from your own machine:
|
|
#
|
|
# ./deploy.sh
|
|
#
|
|
# Override the target with env vars, e.g. DEPLOY_HOST=other ./deploy.sh
|
|
set -euo pipefail
|
|
|
|
DEPLOY_HOST="${DEPLOY_HOST:-czy}"
|
|
DEPLOY_DIR="${DEPLOY_DIR:-/opt/apps/LedgerLine}"
|
|
|
|
# Always both files: the base file alone would publish every service port.
|
|
COMPOSE="docker compose -f docker-compose.yml -f docker-compose.traefik.yml"
|
|
|
|
# The server pulls from the remote, so unpushed commits would not be deployed.
|
|
if [ -n "$(git log '@{u}..HEAD' --oneline 2>/dev/null)" ]; then
|
|
echo "warning: local commits are not pushed; the server will not see them" >&2
|
|
fi
|
|
|
|
# DEPLOY_HASH is the server's HEAD *after* the pull -- the code actually
|
|
# running -- and becomes service.version on every span (docker-compose.yml).
|
|
# Escaped so it is evaluated on the server, not here.
|
|
ssh "$DEPLOY_HOST" "cd '$DEPLOY_DIR' && git pull --ff-only \
|
|
&& export DEPLOY_HASH=\$(git rev-parse --short HEAD) \
|
|
&& echo \"deploying \$DEPLOY_HASH\" \
|
|
&& $COMPOSE up -d --build && $COMPOSE ps"
|