apt-get update -y apt-get install curl apt-transport-https gnupg2 wget build-essential unzip nano -y
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash - &&
sudo apt-get install -y nodejs
node -v npm version
change diractory to /var or another place
cd /var
and clone from git
git clone https://github.com/whossein/nodejs-telegram-bot-v2ray.git
and change diractory to project
cd ./nodejs-telegram-bot-v2ray/
and change config with your confuration
nano config/constant.ts
and install dependency with npm
npm install
and build project
npm run build
and for test project
npm run dev
nano /lib/systemd/system/app.service
and write like this:
Description=Node.js Application
After=syslog.target network.target
[Service]
Type=simple
User=root
WorkingDirectory=/root
Environment=NODE_ENV=production
ExecStart=/usr/bin/node /var/nodejs-telegram-bot-v2ray/index.js
Restart=always
[Install]
WantedBy=multi-user.target
and save it!
systemctl daemon-reload systemctl start app systemctl enable app systemctl status app