Skip to content

Commit cbc2ba1

Browse files
authored
tracktor: refactor envfile (#8711)
* tracktor: refactor enfile * tracktor: fix: update links * tracktor: add: mechanic to update envfile
1 parent ee02bc1 commit cbc2ba1

File tree

3 files changed

+39
-8
lines changed

3 files changed

+39
-8
lines changed

ct/tracktor.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,29 @@ function update_script() {
4040
sed -i 's|^EnvironmentFile=.*|EnvironmentFile=/opt/tracktor.env|' /etc/systemd/system/tracktor.service
4141
systemctl daemon-reload
4242
fi
43+
if [ ! -d "/opt/tracktor-data/uploads" ]; then
44+
mkdir -p /opt/tracktor-data/{uploads,logs}
45+
EXISTING_AUTH_PIN=$(grep '^AUTH_PIN=' /opt/tracktor.env 2>/dev/null | cut -d'=' -f2)
46+
AUTH_PIN=${EXISTING_AUTH_PIN:-123456}
47+
cat <<EOF >/opt/tracktor.env
48+
NODE_ENV=production
49+
DB_PATH=/opt/tracktor-data/tracktor.db
50+
UPLOADS_DIR="/opt/tracktor-data/uploads"
51+
LOG_DIR="/opt/tracktor-data/logs"
52+
# If server host is not set by default it will run on all interfaces - 0.0.0.0
53+
# SERVER_HOST=""
54+
SERVER_PORT=3000
55+
# Set this if you want to secure your endpoints otherwise default will be "*"
56+
CORS_ORIGINS="*"
57+
# Set this if you are using backend and frontend separately.
58+
# PUBLIC_API_BASE_URL=""
59+
LOG_REQUESTS=true
60+
LOG_LEVEL="info"
61+
AUTH_PIN=${AUTH_PIN}
62+
# PUBLIC_DEMO_MODE=false
63+
# FORCE_DATA_SEED=false
64+
EOF
65+
fi
4366
msg_ok "Corrected Services"
4467

4568
setup_nodejs

frontend/public/json/tracktor.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
"updateable": true,
1010
"privileged": false,
1111
"interface_port": 3000,
12-
"documentation": "https://tracktor.bytedge.in/introduction.html",
12+
"documentation": "https://github.com/javedh-dev/tracktor/tree/main/docs",
1313
"config_path": "/opt/tracktor.env",
14-
"website": "https://tracktor.bytedge.in/",
14+
"website": "https://github.com/javedh-dev/tracktor",
1515
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/tracktor.webp",
1616
"description": "Tracktor is an open-source web application for comprehensive vehicle management.\nEasily track fuel consumption, maintenance, insurance, and regulatory documents for all your vehicles in one place.",
1717
"install_methods": [

install/tracktor-install.sh

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,26 @@ msg_info "Configuring Tracktor"
2020
cd /opt/tracktor
2121
$STD npm install
2222
$STD npm run build
23-
mkdir /opt/tracktor-data
23+
mkdir -p /opt/tracktor-data/{uploads,logs}
2424
HOST_IP=$(hostname -I | awk '{print $1}')
2525
cat <<EOF >/opt/tracktor.env
2626
NODE_ENV=production
27-
PUBLIC_DEMO_MODE=false
2827
DB_PATH=/opt/tracktor-data/tracktor.db
29-
# Replace this URL if using behind reverse proxy for https traffic. Though it is optional and should work without changing
30-
PUBLIC_API_BASE_URL=http://$HOST_IP:3000
31-
# Here add the reverse proxy url as well to avoid cross errors from the app.
32-
CORS_ORIGINS=http://$HOST_IP:3000
28+
UPLOADS_DIR="/opt/tracktor-data/uploads"
29+
LOG_DIR="/opt/tracktor-data/logs"
30+
# If server host is not set by default it will run on all interfaces - 0.0.0.0
31+
# SERVER_HOST=""
32+
SERVER_PORT=3000
3333
PORT=3000
34+
# Set this if you want to secure your endpoints otherwise default will be "*"
35+
# CORS_ORIGINS="*"
36+
# Set this if you are using backend and frontend separately. For lxc installation this is not needed
37+
# PUBLIC_API_BASE_URL=""
38+
LOG_REQUESTS=true
39+
LOG_LEVEL="info"
3440
AUTH_PIN=123456
41+
# PUBLIC_DEMO_MODE=false
42+
# FORCE_DATA_SEED=false
3543
EOF
3644
msg_ok "Configured Tracktor"
3745

0 commit comments

Comments
 (0)