From c271eb82af83a89c7290152d7c38afd5907c66f9 Mon Sep 17 00:00:00 2001 From: thetechprepper Date: Wed, 13 Aug 2025 05:10:10 -0700 Subject: [PATCH 1/2] et-api - Initial EmComm Tools API installation script --- scripts/install-et-api.sh | 43 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100755 scripts/install-et-api.sh diff --git a/scripts/install-et-api.sh b/scripts/install-et-api.sh new file mode 100755 index 0000000..29d517d --- /dev/null +++ b/scripts/install-et-api.sh @@ -0,0 +1,43 @@ +#!/bin/bash +# Author : Gaston Gonzalez +# Date : 13 August 2025 +# Purpose : Install EmComm Tools API +set -e +trap 'last_command=$current_command; current_command=$BASH_COMMAND' DEBUG +trap 'et-log "\"${last_command}\" command failed with exit code $?."' ERR + +. ./env.sh + +APP=et-api +VERSION=1.0.0 +ET_API_JAR="emcomm-tools-api-${VERSION}-SNAPSHOT.jar" +BASE_URL="https://github.com/thetechprepper/et-api-java/releases/download/${VERSION}" + +INSTALL_DIR="/opt/emcomm-tools-api" +BIN_DIR="${INSTALL_DIR}/bin" +DATA_DIR="${INSTALL_DIR}/data" +INDEX_DIR="${INSTALL_DIR}/index" + +et-log "Installing ${APP} ${VERSION}..." + +mkdir -v -p "${BIN_DIR}" "${DATA_DIR}" "${INDEX_DIR}" + +# Download and install et-api uber JAR +URL="${BASE_URL}/${ET_API_JAR}" +et-log "Downloading ${APP}: ${URL}" +curl -s -L -o "${BIN_DIR}/${APP}" --fail ${URL} +chmod 755 "${BIN_DIR}/${APP}" + +# Download pre-built data sets +FILES=("faa.csv" "license.csv" "zip2geo.csv" "zip2geo-elevation.csv") +for file in "${FILES[@]}"; do + URL="${BASE_URL}/${file}" + + et-log "Downloading data set: ${URL}" + curl -s -L -o "${DATA_DIR}/${file}" --fail ${URL} +done + +et-log "Applying permissions..." +chgrp -v -R ${ET_GROUP} ${DATA_DIR} ${INDEX_DIR} +chmod -v 775 ${DATA_DIR} ${INDEX_DIR} +chmod -v 664 ${DATA_DIR}/*.csv From 5a9734d627717b1e2bbb3c42c1395c82d8b9dae4 Mon Sep 17 00:00:00 2001 From: thetechprepper Date: Wed, 13 Aug 2025 05:22:58 -0700 Subject: [PATCH 2/2] et-api - Added initial systemd service for et-api --- .../et-service-et-api.service | 1 + .../systemd/user/et-service-et-api.service | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 120000 overlay/etc/skel/.config/systemd/user/default.target.wants/et-service-et-api.service create mode 100644 overlay/etc/skel/.config/systemd/user/et-service-et-api.service diff --git a/overlay/etc/skel/.config/systemd/user/default.target.wants/et-service-et-api.service b/overlay/etc/skel/.config/systemd/user/default.target.wants/et-service-et-api.service new file mode 120000 index 0000000..f342cf2 --- /dev/null +++ b/overlay/etc/skel/.config/systemd/user/default.target.wants/et-service-et-api.service @@ -0,0 +1 @@ +../et-service-et-api.service \ No newline at end of file diff --git a/overlay/etc/skel/.config/systemd/user/et-service-et-api.service b/overlay/etc/skel/.config/systemd/user/et-service-et-api.service new file mode 100644 index 0000000..320b4c1 --- /dev/null +++ b/overlay/etc/skel/.config/systemd/user/et-service-et-api.service @@ -0,0 +1,19 @@ +# Author : Gaston Gonzalez +# Date : 13 August 2025 +# Purpose : User systemd unit file for EmComm Tools API +# +# Usage: +# Check status : systemctl --user status et-service-et-api +# Start service : systemctl --user start et-service-et-api +# Stop service : systemctl --user stop et-service-et-api +# Reload this config : systemctl --user daemon-reload + +[Unit] +Description=EmComm Tools API + +[Service] +ExecStart=/opt/emcomm-tools-api/bin/et-api +Restart=always + +[Install] +WantedBy=default.target