Merge branch 'main' of github.com:cgzirim/song-recognition

This commit is contained in:
Chigozirim Igweamaka 2024-05-18 08:01:59 +01:00
commit 41e10f71ca
6 changed files with 27 additions and 28 deletions

View file

@ -5,8 +5,14 @@ files:
destination: /home/ubuntu/song-recognition
hooks:
BeforeInstall:
- location: scripts/BeforeInstall.sh
AfterInstall:
- location: scripts/AfterInstall.sh
- location: scripts/ApplicationStart.sh
- location: scripts/before_install.sh
runas: ubuntu
AfterInstall:
- location: scripts/after_install.sh
runas: ubuntu
ApplicationStart:
- location: scripts/start_server.sh
runas: ubuntu
ApplicationStop:
- location: scripts/stop_server.sh
runas: ubuntu

View file

@ -1,24 +0,0 @@
#!/usr/bin/env bash
start_backend() {
cd /home/ubuntu/song-recognition
touch back.txt
go build -tags netgo -ldflags '-s -w' -o app
nohup ./app > backend.log 2>&1 &
}
start_client() {
cd /home/ubuntu/song-recognition/client
touch client.txt
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
nvm install 16
nvm use 16
npm install
npm run build
nohup serve -s build > client.log 2>&1 &
}
start_backend && start_client

16
scripts/start_server.sh Normal file
View file

@ -0,0 +1,16 @@
#!/usr/bin/env bash
start_server() {
cd /home/ubuntu/song-recognition
go build -tags netgo -ldflags '-s -w' -o app
nohup ./app > backend.log 2>&1 &
}
start_client() {
cd /home/ubuntu/song-recognition/client
npm install
npm run build
nohup serve -s build > client.log 2>&1 &
}
start_server

1
scripts/stop_server.sh Normal file
View file

@ -0,0 +1 @@
sudo kill -9 $(sudo lsof -t -i:5000)