diff --git a/ct/headers/tracktor b/ct/headers/tracktor new file mode 100644 index 000000000..d4802c5aa --- /dev/null +++ b/ct/headers/tracktor @@ -0,0 +1,6 @@ + __ __ __ + / /__________ ______/ /__/ /_____ _____ + / __/ ___/ __ `/ ___/ //_/ __/ __ \/ ___/ +/ /_/ / / /_/ / /__/ ,< / /_/ /_/ / / +\__/_/ \__,_/\___/_/|_|\__/\____/_/ + diff --git a/ct/tracktor.sh b/ct/tracktor.sh new file mode 100644 index 000000000..7a76fa6e5 --- /dev/null +++ b/ct/tracktor.sh @@ -0,0 +1,72 @@ +#!/usr/bin/env bash +source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) +# Copyright (c) 2021-2025 community-scripts ORG +# Author: CrazyWolf13 +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://tracktor.bytedge.in/ + +APP="tracktor" +var_tags="${var_tags:-car;monitoring}" +var_cpu="${var_cpu:-2}" +var_ram="${var_ram:-4096}" +var_disk="${var_disk:-6}" +var_os="${var_os:-debian}" +var_version="${var_version:-12}" +var_unprivileged="${var_unprivileged:-1}" + +header_info "$APP" +variables +color +catch_errors + +function update_script() { + header_info + check_container_storage + check_container_resources + if [[ ! -d /opt/tracktor ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + + RELEASE=$(curl -fsSL https://api.github.com/repos/javedh-dev/tracktor/releases/latest | jq -r '.tag_name' | sed 's/^v//') + if [[ "${RELEASE}" != "$(cat ~/.tracktor 2>/dev/null)" ]] || [[ ! -f ~/.tracktor ]]; then + msg_info "Stopping Service" + systemctl stop tracktor + msg_ok "Stopped Service" + + msg_info "Creating Backup" + cp /opt/tracktor/app/backend/.env /opt/tracktor.env + msg_ok "Created Backup" + + setup_nodejs + fetch_and_deploy_gh_release "tracktor" "javedh-dev/tracktor" "tarball" "latest" "/opt/tracktor" + + msg_info "Updating ${APP}" + cd /opt/tracktor + $STD npm install + $STD npm run build + msg_ok "Updated $APP" + + msg_info "Restoring Backup" + cp /opt/tracktor.env /opt/tracktor/app/backend/.env + msg_ok "Restored Backup" + + msg_info "Starting Service" + systemctl start tracktor + msg_ok "Started Service" + + msg_ok "Updated Successfully" + else + msg_ok "Already up to date" + fi + exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}" +echo -e "${INFO}${YW} Access it using the following URL:${CL}" +echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:3000${CL}" diff --git a/frontend/public/json/tracktor.json b/frontend/public/json/tracktor.json new file mode 100644 index 000000000..cbe6f0b00 --- /dev/null +++ b/frontend/public/json/tracktor.json @@ -0,0 +1,40 @@ +{ + "name": "Tracktor", + "slug": "tracktor", + "categories": [ + 9 + ], + "date_created": "2025-08-06", + "type": "ct", + "updateable": true, + "privileged": false, + "interface_port": 3000, + "documentation": "https://tracktor.bytedge.in/introduction.html", + "config_path": "/opt/tracktor/app/server/.env", + "website": "https://tracktor.bytedge.in/", + "logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/tracktor.webp", + "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.", + "install_methods": [ + { + "type": "default", + "script": "ct/tracktor.sh", + "resources": { + "cpu": 1, + "ram": 1024, + "hdd": 6, + "os": "Debian", + "version": "12" + } + } + ], + "default_credentials": { + "username": null, + "password": null + }, + "notes": [ + { + "text": "Please check and update the '/opt/tracktor/app/backend/.env' file if using behind reverse proxy.", + "type": "info" + } + ] +} diff --git a/install/tracktor-install.sh b/install/tracktor-install.sh new file mode 100644 index 000000000..d0d432d9c --- /dev/null +++ b/install/tracktor-install.sh @@ -0,0 +1,61 @@ +#!/usr/bin/env bash + +# Copyright (c) 2025 Community Scripts ORG +# Author: CrazyWolf13 +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://tracktor.bytedge.in + +source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +setup_nodejs +fetch_and_deploy_gh_release "tracktor" "javedh-dev/tracktor" "tarball" "latest" "/opt/tracktor" + +msg_info "Configuring Tracktor" +cd /opt/tracktor +$STD npm install +$STD npm run build +mkdir /opt/tracktor-data +HOST_IP=$(hostname -I | awk '{print $1}') +cat </opt/tracktor/app/backend/.env +NODE_ENV=production +PUBLIC_DEMO_MODE=false +DB_PATH=/opt/tracktor-data/tracktor.db +# Replace this URL if using behind reverse proxy for https traffic. Though it is optional and should work without changing +PUBLIC_API_BASE_URL=http://$HOST_IP:3000 +# Here add the reverse proxy url as well to avoid cross errors from the app. +CORS_ORIGINS=http://$HOST_IP:3000 +PORT=3000 +EOF +msg_ok "Configured Tracktor" + +msg_info "Creating service" +cat </etc/systemd/system/tracktor.service +[Unit] +Description=Tracktor Service +After=network.target + +[Service] +Type=simple +WorkingDirectory=/opt/tracktor +EnvironmentFile=/opt/tracktor/app/backend/.env +ExecStart=/usr/bin/npm start + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now tracktor +msg_ok "Created service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned"