From 9f0d19c08f444ab8c36e9693d4e424d81dee3355 Mon Sep 17 00:00:00 2001 From: Movses Aslanyan Date: Fri, 9 Oct 2026 15:42:07 +0330 Subject: [PATCH] Add deploy.sh to redeploy the stack on the server Co-Authored-By: Claude Sonnet 5.5 --- deploy.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 deploy.sh diff --git a/deploy.sh b/deploy.sh new file mode 100755 index 0000000..1906a0f --- /dev/null +++ b/deploy.sh @@ -0,0 +1,21 @@ +#!/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 + +ssh "$DEPLOY_HOST" "cd '$DEPLOY_DIR' && git pull --ff-only && $COMPOSE up -d --build && $COMPOSE ps"