From a8be512859ea2c53ab8c7ad5db31658d304085f1 Mon Sep 17 00:00:00 2001 From: Tobias <96661824+CrazyWolf13@users.noreply.github.com> Date: Wed, 29 Oct 2025 09:58:42 +0100 Subject: [PATCH 1/2] Refactor tracktor.sh to correct services setup Updated the script to correct services and set environment variables for the tracktor application. --- ct/tracktor.sh | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/ct/tracktor.sh b/ct/tracktor.sh index 44fc386c4..e39808c27 100644 --- a/ct/tracktor.sh +++ b/ct/tracktor.sh @@ -33,14 +33,34 @@ function update_script() { systemctl stop tracktor msg_ok "Stopped Service" - # msg_info "Correcting Services" - # if [ -f /opt/tracktor/app/backend/.env ]; then - #mv /opt/tracktor/app/backend/.env /opt/tracktor.env - # echo 'AUTH_PIN=123456' >> /opt/tracktor.env - # sed -i 's|^EnvironmentFile=.*|EnvironmentFile=/opt/tracktor.env|' /etc/systemd/system/tracktor.service - # systemctl daemon-reload - # fi - # msg_ok "Corrected Services" + msg_info "Correcting Services" + if [ -f /opt/tracktor/app/backend/.env ]; then + mv /opt/tracktor/app/backend/.env /opt/tracktor.env + echo 'AUTH_PIN=123456' >> /opt/tracktor.env + sed -i 's|^EnvironmentFile=.*|EnvironmentFile=/opt/tracktor.env|' /etc/systemd/system/tracktor.service + systemctl daemon-reload + fi + EXISTING_AUTH_PIN=$(grep '^AUTH_PIN=' /opt/tracktor.env 2>/dev/null | cut -d'=' -f2) + AUTH_PIN=${EXISTING_AUTH_PIN:-123456} + cat </opt/tracktor.env +NODE_ENV=production +DB_PATH=/opt/tracktor-data/tracktor.db +UPLOADS_DIR="/opt/tracktor-data/uploads" +LOG_DIR="/opt/tracktor-data/logs" +# If server host is not set by default it will run on all interfaces - 0.0.0.0 +# SERVER_HOST="" +SERVER_PORT=3000 +# Set this if you want to secure your endpoints otherwise default will be "*" +CORS_ORIGINS="*" +# Set this if you are using backend and frontend separately. +# PUBLIC_API_BASE_URL="" +LOG_REQUESTS=true +LOG_LEVEL="info" +AUTH_PIN=${AUTH_PIN} +# PUBLIC_DEMO_MODE=false +# FORCE_DATA_SEED=false +EOF + msg_ok "Corrected Services" setup_nodejs CLEAN_INSTALL=1 fetch_and_deploy_gh_release "tracktor" "javedh-dev/tracktor" "tarball" "latest" "/opt/tracktor" From ffce06ae2aca1a07d6c5fb5c88a5c0e2621ce996 Mon Sep 17 00:00:00 2001 From: Tobias <96661824+CrazyWolf13@users.noreply.github.com> Date: Wed, 29 Oct 2025 10:33:37 +0100 Subject: [PATCH 2/2] Set up environment variables for new directories Ensure environment variables are set when creating directories. --- ct/tracktor.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ct/tracktor.sh b/ct/tracktor.sh index e39808c27..53c37c1c1 100644 --- a/ct/tracktor.sh +++ b/ct/tracktor.sh @@ -40,9 +40,11 @@ function update_script() { sed -i 's|^EnvironmentFile=.*|EnvironmentFile=/opt/tracktor.env|' /etc/systemd/system/tracktor.service systemctl daemon-reload fi - EXISTING_AUTH_PIN=$(grep '^AUTH_PIN=' /opt/tracktor.env 2>/dev/null | cut -d'=' -f2) - AUTH_PIN=${EXISTING_AUTH_PIN:-123456} - cat </opt/tracktor.env + if [ ! -d "/opt/tracktor-data/uploads" ]; then + mkdir -p /opt/tracktor-data/{uploads,logs} + EXISTING_AUTH_PIN=$(grep '^AUTH_PIN=' /opt/tracktor.env 2>/dev/null | cut -d'=' -f2) + AUTH_PIN=${EXISTING_AUTH_PIN:-123456} + cat </opt/tracktor.env NODE_ENV=production DB_PATH=/opt/tracktor-data/tracktor.db UPLOADS_DIR="/opt/tracktor-data/uploads" @@ -60,6 +62,7 @@ AUTH_PIN=${AUTH_PIN} # PUBLIC_DEMO_MODE=false # FORCE_DATA_SEED=false EOF + fi msg_ok "Corrected Services" setup_nodejs