mirror of
https://github.com/thetechprepper/emcomm-tools-os-community.git
synced 2026-09-17 15:41:44 -04:00
Merge pull request #44 from thetechprepper/feature/et-api
Merge feature/et-api into et-aircraft
This commit is contained in:
+1
@@ -0,0 +1 @@
|
||||
../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
|
||||
Executable
+43
@@ -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
|
||||
Reference in New Issue
Block a user