Update tracktor-install.sh

This commit is contained in:
Tobias 2025-08-07 08:46:20 +02:00 committed by Push From Github
parent e825dbea43
commit da516abeb3

View File

@ -13,58 +13,41 @@ setting_up_container
network_check network_check
update_os update_os
msg_info "Installing Dependencies" setup_nodejs
$STD apt-get install -y \ fetch_and_deploy_gh_release "tracktor" "javedh-dev/tracktor"
sqlite3 \
yq
msg_ok "Installed Dependencies"
NODE_VERSION="20" setup_nodejs
fetch_and_deploy_gh_release "tududi" "chrisvel/tududi"
msg_info "Configuring Tududi" msg_info "Configuring Tracktor"
cd /opt/tududi cd /opt/tracktor
$STD npm install $STD npm install
export NODE_ENV=production $STD npm run build
$STD npm run frontend:build mkdir /opt/tracktor-data
mv ./dist ./backend cat <<EOF >/opt/tracktor.env
mv ./public/locales ./backend/dist NODE_ENV=production
mv ./public/favicon.* ./backend/dist PUBLIC_DEMO_MODE=false
msg_ok "Configured Tududi" PUBLIC_API_BASE_URL=/
DB_PATH=/opt/tracktor-data/vehicles.db
msg_info "Creating env and database" EOF
DB_LOCATION="/opt/tududi-db"
UPLOAD_DIR="/opt/tududi-uploads" msg_ok "Configured Tracktor"
mkdir -p {"$DB_LOCATION","$UPLOAD_DIR"}
SECRET="$(openssl rand -hex 64)"
sed -e 's/^GOOGLE/# &/' \
-e '/TUDUDI_SESSION/s/^# //' \
-e '/NODE_ENV/s/^# //' \
-e "s/your_session_secret_here/$SECRET/" \
-e 's/development/production/' \
-e "\$a\DB_FILE=$DB_LOCATION/production.sqlite3" \
-e "\$a\TUDUDI_UPLOAD_PATH=$UPLOAD_DIR" \
/opt/tududi/backend/.env.example >/opt/tududi/backend/.env
export DB_FILE="$DB_LOCATION/production.sqlite3"
$STD npm run db:init
msg_ok "Created env and database"
msg_info "Creating service" msg_info "Creating service"
cat <<EOF >/etc/systemd/system/tududi.service cat <<EOF >/etc/systemd/system/tracktor.service
[Unit] [Unit]
Description=Tududi Service Description=Tracktor Service
After=network.target After=network.target
[Service] [Service]
Type=simple Type=simple
WorkingDirectory=/opt/tududi WorkingDirectory=/opt/tracktor
EnvironmentFile=/opt/tududi/backend/.env EnvironmentFile=/opt/tracktor.env
ExecStart=/usr/bin/npm run start ExecStart=/usr/bin/npm run start
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
EOF EOF
systemctl enable -q --now tududi systemctl enable -q --now tracktor
msg_ok "Created service" msg_ok "Created service"
motd_ssh motd_ssh