From e1a64ede4b533bc17771578d79a9b792755ee487 Mon Sep 17 00:00:00 2001 From: Chigozirim Igweamaka Date: Sat, 18 May 2024 07:14:55 +0100 Subject: [PATCH 1/6] Update ApplicationStart.sh --- scripts/ApplicationStart.sh | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/scripts/ApplicationStart.sh b/scripts/ApplicationStart.sh index 6584c4b..fd12b64 100644 --- a/scripts/ApplicationStart.sh +++ b/scripts/ApplicationStart.sh @@ -9,16 +9,9 @@ start_backend() { 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 +start_backend From 6685aea30f9a91fe3091087d729fbdd36e01a8a8 Mon Sep 17 00:00:00 2001 From: Chigozirim Igweamaka Date: Sat, 18 May 2024 07:26:26 +0100 Subject: [PATCH 2/6] Create stop_server.sh --- scripts/stop_server.sh | 1 + 1 file changed, 1 insertion(+) create mode 100644 scripts/stop_server.sh diff --git a/scripts/stop_server.sh b/scripts/stop_server.sh new file mode 100644 index 0000000..8054b30 --- /dev/null +++ b/scripts/stop_server.sh @@ -0,0 +1 @@ +sudo kill -9 $(sudo lsof -t -i:5000) From 8c48d86a3c89e4c331dfe58f574b12779ffaeaca Mon Sep 17 00:00:00 2001 From: Chigozirim Igweamaka Date: Sat, 18 May 2024 07:27:53 +0100 Subject: [PATCH 3/6] Update and rename ApplicationStart.sh to start_server.sh --- scripts/{ApplicationStart.sh => start_server.sh} | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) rename scripts/{ApplicationStart.sh => start_server.sh} (85%) diff --git a/scripts/ApplicationStart.sh b/scripts/start_server.sh similarity index 85% rename from scripts/ApplicationStart.sh rename to scripts/start_server.sh index fd12b64..fef510a 100644 --- a/scripts/ApplicationStart.sh +++ b/scripts/start_server.sh @@ -1,8 +1,7 @@ #!/usr/bin/env bash -start_backend() { +start_server() { cd /home/ubuntu/song-recognition - touch back.txt go build -tags netgo -ldflags '-s -w' -o app nohup ./app > backend.log 2>&1 & } @@ -14,4 +13,4 @@ start_client() { nohup serve -s build > client.log 2>&1 & } -start_backend +start_server From 0d6f3969110b4745f2f71375675566e0af29f8ea Mon Sep 17 00:00:00 2001 From: Chigozirim Igweamaka Date: Sat, 18 May 2024 07:28:59 +0100 Subject: [PATCH 4/6] Rename BeforeInstall.sh to before_install.sh --- scripts/{BeforeInstall.sh => before_install.sh} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename scripts/{BeforeInstall.sh => before_install.sh} (100%) diff --git a/scripts/BeforeInstall.sh b/scripts/before_install.sh similarity index 100% rename from scripts/BeforeInstall.sh rename to scripts/before_install.sh From 6380ddfffdc8da41b262b7a5e400676d5e162771 Mon Sep 17 00:00:00 2001 From: Chigozirim Igweamaka Date: Sat, 18 May 2024 07:29:47 +0100 Subject: [PATCH 5/6] Rename AfterInstall.sh to after_install.sh --- scripts/{AfterInstall.sh => after_install.sh} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename scripts/{AfterInstall.sh => after_install.sh} (100%) diff --git a/scripts/AfterInstall.sh b/scripts/after_install.sh similarity index 100% rename from scripts/AfterInstall.sh rename to scripts/after_install.sh From 6eb5482f278ac0a6866781f88b384bcb454c0db8 Mon Sep 17 00:00:00 2001 From: Chigozirim Igweamaka Date: Sat, 18 May 2024 07:33:03 +0100 Subject: [PATCH 6/6] Update appspec.yml --- appspec.yml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/appspec.yml b/appspec.yml index bc0edf4..0b5554e 100644 --- a/appspec.yml +++ b/appspec.yml @@ -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