#!/usr/bin/env bash
set -euo pipefail

LOG="/var/log/deploy/mkdeploy.log"
exec >>"$LOG" 2>&1

REPO_DIR="/opt/mkcontrol-app"
SERVICE_NAME="mkcontrol-app.service"

echo "=== $(date) ==="
id

cd "$REPO_DIR"

echo "Pulling repository..."
/usr/bin/git pull origin main

echo "Restarting service..."
sudo /bin/systemctl restart "$SERVICE_NAME"

echo "mkcontrol-app Deployment successful"