Questions on Upgrade from Zip

Hello, i have a problem and i don’t know what i am doing wrong . i will ask 4 questions to figure out the problem.

in 4 stage you say: recopy your backup back to bot folder

but in stage 2 you say: “Remove your sogeBot directory”

so, remove is cut and copy (move) of the whole old app’s folder, right?

do we have to stop the database / backup ( mysqldump command) it before move the old app’s folder or it is not necessary?

if we put the new folder on the same place, we are doing< npm ci> again before recopy the old files or after?

when we recopy the old files and folders, back to app’s folder we choose to not overwrite the new files and folders, right?

Sorry for the 4 questions but i followed the instructions on sogebot - Free Twitch Bot built on Node.js and it failed 2 times and i don’t know why it fails to start the app after upgrade !

you have to copy/move your sogebot.db (if sqlite is used) and your .env file
:open_file_folder:sogeBot
┣📁 bat
┣📁 bin
┣📁 dest
┣📁 docs
┣📁 locales
┣📁 logs
┣📁 node_modules
┣📁 public
┣📁 tools
┣📄 .env ← THIS FILE
┣📄 .env.mysql
┣📄 .env.postgres
┣📄 .env.sqlite
┣📄 .npmrc
┣📄 AUTHORS
┣📄 fonts.json
┣📄 LICENCE
┣📄 package.json
┣📄 package-lock.json
┗📄 sogebot.db ← THIS FILE if you use sqlite (default)

to somewhere else (out of that directory)
then delete EVERYTHING in there
then extract your new zip version in there
then copy back the files you saved in a previous step
run npm ci
run npm start

greetings you updated your bot

btw im currently working on something that does that automaticly
i have an :warning: EXPERIMENTAL :warning: build currently on Github
for your case create an folder put the file you downloaded there linux binary or exe file
run it
then stop it after its done and a clean install starts
overwrite the 2 files in the bot folder
run my file again it should check for for any new release and update the bot if nececary

if not write me an issue report on my project :heart: :kissing_heart:

1 Like

hello Liadala and thank you for the reply.

I think i know now what i did wrong.

i have pm2 installed to help autorun the npm run the sogeBot after restart of the vm and i stopped it to before do what you said.

when i run the npm ci command it gave me this error:

Local package.json exists, but node_modules missing, did you mean to install?

gyp ERR! node -v v14.15.4
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! better-sqlite3@7.1.4 build-release: `node-gyp rebuild --release`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the better-sqlite3@7.1.4 build-release script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?

i searched it and the suggestions were to simple continue and type: npm start

and voila, it started the migration and the bot is upgraded now and running

so, i did wrong to press pm2 stop before upgrade, right ?

i don’t know nodejs and sorry for my ignorance but i think many people will have problem in the future since pm2 is the only way the no nodejs devs autorun npm apps after restart of the machine.

So, in conclusion for the future reader these are the steps and the commands i followed including the pm2 with id=main from dest/main.js:

pm2 stop main
[upgrade procedure how Liadala said in the post above]
[from inside the sogeBot folder]
npm ci
[it gives error]
npm start
pm2 start dest/main.js
pm2 startup

[done, happy restarts :smiley:]

dont worry i had to learn many things the hard way too

and no pm2 is not the only way you can have an systemd for that

ubuntu@sogeBot:~$ sudo nano /etc/systemd/system/sogeBot.service

[Unit]
Description=Node.js sogeBot
[Service]
ExecStart=/usr/bin/npm start
# Required on some systems
WorkingDirectory=/home/ubuntu/sogebot
Restart=always
# Restart service after 10 seconds if node service crashes
RestartSec=10
# Output to syslog
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=sogeBot
User=ubuntu
Group=ubuntu
TimeoutSec=900
#Environment=THREAD=0
[Install]
WantedBy=multi-user.target

ubuntu@sogeBot:~$ sudo systemctl daemon-reload
ubuntu@sogeBot:~$ sudo systemctl enable sogeBot.service
ubuntu@sogeBot:~$ sudo systemctl start sogeBot.service

now you can use “systemctl” or “system” to start stop bot on linux :stuck_out_tongue:

1 Like

thank you liadala

/pinned :stuck_out_tongue:

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.