check
Some checks failed
Build Org Backend / build (push) Failing after 15s

This commit is contained in:
2026-05-09 00:02:29 +01:00
parent 2f7d018c70
commit 340b33f5d0
4 changed files with 53 additions and 0 deletions

View File

@@ -4,12 +4,15 @@ set -euo pipefail
APP_HOME="${APP_HOME:-/home/zaine/master-folder/projects/java_projects/org_backend}"
SERVICE_NAME="${SERVICE_NAME:-org-backend.service}"
SYSTEMCTL_TIMEOUT="${SYSTEMCTL_TIMEOUT:-120}"
ENV_FILE="${ENV_FILE:-/etc/org-backend/org-backend.env}"
ENV_EXAMPLE_FILE="${ENV_EXAMPLE_FILE:-/etc/org-backend/org-backend.env.example}"
SOURCE_DIR="$(pwd)"
SOURCE_JAR="${SOURCE_DIR}/target/org-backend.jar"
APP_TARGET_DIR="${APP_HOME}/target"
APP_JAR="${APP_TARGET_DIR}/org-backend.jar"
SOURCE_SERVICE="${SOURCE_DIR}/misc/${SERVICE_NAME}"
SOURCE_ENV_EXAMPLE="${SOURCE_DIR}/misc/org-backend.env.example"
SYSTEMD_SERVICE="/etc/systemd/system/${SERVICE_NAME}"
run_sudo() {
@@ -30,6 +33,11 @@ if [[ ! -f "${SOURCE_SERVICE}" ]]; then
exit 1
fi
if [[ ! -f "${SOURCE_ENV_EXAMPLE}" ]]; then
echo "Missing env example file: ${SOURCE_ENV_EXAMPLE}" >&2
exit 1
fi
mkdir -p "${APP_TARGET_DIR}"
if [[ "$(realpath "${SOURCE_JAR}")" != "$(realpath -m "${APP_JAR}")" ]]; then
@@ -42,6 +50,16 @@ fi
echo "Checking sudo access"
run_sudo true
echo "Installing env example to ${ENV_EXAMPLE_FILE}"
run_sudo install -d -m 0755 "$(dirname "${ENV_FILE}")"
run_sudo install -m 0640 "${SOURCE_ENV_EXAMPLE}" "${ENV_EXAMPLE_FILE}"
echo "Checking runtime env file at ${ENV_FILE}"
if ! run_sudo test -f "${ENV_FILE}"; then
echo "Missing ${ENV_FILE}. Create it from ${ENV_EXAMPLE_FILE} and fill in the production values." >&2
exit 1
fi
echo "Installing systemd unit to ${SYSTEMD_SERVICE}"
run_sudo install -m 0644 "${SOURCE_SERVICE}" "${SYSTEMD_SERVICE}"