mirror of
https://github.com/tteck/Proxmox.git
synced 2024-11-22 08:13:11 +01:00
Update tianji-install.sh
switch from `pm2` process management to `systemd` fixes https://github.com/tteck/Proxmox/issues/3876
This commit is contained in:
parent
b7fe85cd5b
commit
4c83a790ac
@ -38,7 +38,6 @@ echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.co
|
||||
$STD apt-get update
|
||||
$STD apt-get install -y nodejs
|
||||
$STD npm install -g pnpm@9.7.1
|
||||
$STD npm install -g pm2
|
||||
export NODE_OPTIONS="--max_old_space_size=4096"
|
||||
msg_ok "Installed Node.js, pnpm & pm2"
|
||||
|
||||
@ -77,15 +76,30 @@ cat <<EOF >/opt/tianji/src/server/.env
|
||||
DATABASE_URL="postgresql://$DB_USER:$DB_PASS@localhost:5432/$DB_NAME?schema=public"
|
||||
JWT_SECRET="$TIANJI_SECRET"
|
||||
EOF
|
||||
cd /opt/tianji
|
||||
$STD npm install pm2 -g
|
||||
$STD pm2 install pm2-logrotate
|
||||
cd src/server
|
||||
cd /opt/tianji/src/server
|
||||
$STD pnpm db:migrate:apply
|
||||
$STD pm2 start /opt/tianji/src/server/dist/src/server/main.js --name tianji
|
||||
$STD pm2 save
|
||||
msg_ok "Installed Tianji"
|
||||
|
||||
msg_info "Creating Service"
|
||||
cat <<EOF >/etc/systemd/system/tianji.service
|
||||
[Unit]
|
||||
Description=Tianji Server
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/bin/node /opt/tianji/src/server/dist/src/server/main.js
|
||||
WorkingDirectory=/opt/tianji/src/server
|
||||
Restart=always
|
||||
RestartSec=10
|
||||
|
||||
Environment=NODE_ENV=production
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
systemctl enable -q --now tianji.service
|
||||
msg_ok "Created Service"
|
||||
|
||||
motd_ssh
|
||||
customize
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user