Refactor tracktor.sh to correct services setup
Updated the script to correct services and set environment variables for the tracktor application.
This commit is contained in:
parent
3e9d3b38de
commit
a8be512859
@ -33,14 +33,34 @@ function update_script() {
|
|||||||
systemctl stop tracktor
|
systemctl stop tracktor
|
||||||
msg_ok "Stopped Service"
|
msg_ok "Stopped Service"
|
||||||
|
|
||||||
# msg_info "Correcting Services"
|
msg_info "Correcting Services"
|
||||||
# if [ -f /opt/tracktor/app/backend/.env ]; then
|
if [ -f /opt/tracktor/app/backend/.env ]; then
|
||||||
#mv /opt/tracktor/app/backend/.env /opt/tracktor.env
|
mv /opt/tracktor/app/backend/.env /opt/tracktor.env
|
||||||
# echo 'AUTH_PIN=123456' >> /opt/tracktor.env
|
echo 'AUTH_PIN=123456' >> /opt/tracktor.env
|
||||||
# sed -i 's|^EnvironmentFile=.*|EnvironmentFile=/opt/tracktor.env|' /etc/systemd/system/tracktor.service
|
sed -i 's|^EnvironmentFile=.*|EnvironmentFile=/opt/tracktor.env|' /etc/systemd/system/tracktor.service
|
||||||
# systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
# fi
|
fi
|
||||||
# msg_ok "Corrected Services"
|
EXISTING_AUTH_PIN=$(grep '^AUTH_PIN=' /opt/tracktor.env 2>/dev/null | cut -d'=' -f2)
|
||||||
|
AUTH_PIN=${EXISTING_AUTH_PIN:-123456}
|
||||||
|
cat <<EOF >/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
|
setup_nodejs
|
||||||
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "tracktor" "javedh-dev/tracktor" "tarball" "latest" "/opt/tracktor"
|
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "tracktor" "javedh-dev/tracktor" "tarball" "latest" "/opt/tracktor"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user