From 49092b14d8346f0b86731ec995384bd213a443ab Mon Sep 17 00:00:00 2001 From: Chigozirim Igweamaka Date: Fri, 17 May 2024 10:52:18 +0100 Subject: [PATCH 01/30] Create install_dependencies.sh --- scripts/install_dependencies.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 scripts/install_dependencies.sh diff --git a/scripts/install_dependencies.sh b/scripts/install_dependencies.sh new file mode 100644 index 0000000..a45b5ba --- /dev/null +++ b/scripts/install_dependencies.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +# clear codedeploy-agent files for a fresh install +sudo rm -rf /home/ubuntu/install + +# install CodeDeploy agent +sudo apt-get -y update +sudo apt-get -y install ruby +sudo apt-get -y install wget +cd /home/ubuntu +wget https://aws-codedeploy-eu-north-1.s3.amazonaws.com/latest/install +sudo chmod +x ./install +sudo ./install auto + +# install golang +sudo apt-get -y install golang-go + +# install nodeJS and nvm +sudo apt install nodejs +sudo apt install npm +wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash From 4765dd0239d2723b233d6c1dc0d5ba840f6ae514 Mon Sep 17 00:00:00 2001 From: Chigozirim Igweamaka Date: Fri, 17 May 2024 10:55:15 +0100 Subject: [PATCH 02/30] Update install_dependencies.sh --- scripts/install_dependencies.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/install_dependencies.sh b/scripts/install_dependencies.sh index a45b5ba..a873e74 100644 --- a/scripts/install_dependencies.sh +++ b/scripts/install_dependencies.sh @@ -16,6 +16,9 @@ sudo ./install auto sudo apt-get -y install golang-go # install nodeJS and nvm -sudo apt install nodejs -sudo apt install npm +sudo apt -y install nodejs +sudo apt -u install npm wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash + +# install MongoDB +sudo apt -y install mongodb From 67aa4b08b3cba925f96d9cb2180d9329736b3b61 Mon Sep 17 00:00:00 2001 From: Chigozirim Igweamaka Date: Fri, 17 May 2024 11:26:21 +0100 Subject: [PATCH 03/30] Rename install_dependencies.sh to beforeInstall.sh --- scripts/{install_dependencies.sh => beforeInstall.sh} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename scripts/{install_dependencies.sh => beforeInstall.sh} (100%) diff --git a/scripts/install_dependencies.sh b/scripts/beforeInstall.sh similarity index 100% rename from scripts/install_dependencies.sh rename to scripts/beforeInstall.sh From 116bbb5757ba71262d0e37e687d6eabc139a3981 Mon Sep 17 00:00:00 2001 From: Chigozirim Igweamaka Date: Fri, 17 May 2024 11:28:11 +0100 Subject: [PATCH 04/30] Create afterInstall.sh --- scripts/afterInstall.sh | 1 + 1 file changed, 1 insertion(+) create mode 100644 scripts/afterInstall.sh diff --git a/scripts/afterInstall.sh b/scripts/afterInstall.sh new file mode 100644 index 0000000..1657547 --- /dev/null +++ b/scripts/afterInstall.sh @@ -0,0 +1 @@ +sudo chown -R ubuntu:ubuntu /home/ubuntu/aws_cicd From 27ba102eb6c049ef1459bdf16311e4637b29e761 Mon Sep 17 00:00:00 2001 From: Chigozirim Igweamaka Date: Fri, 17 May 2024 11:29:23 +0100 Subject: [PATCH 05/30] Update afterInstall.sh --- scripts/afterInstall.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/afterInstall.sh b/scripts/afterInstall.sh index 1657547..513446e 100644 --- a/scripts/afterInstall.sh +++ b/scripts/afterInstall.sh @@ -1 +1 @@ -sudo chown -R ubuntu:ubuntu /home/ubuntu/aws_cicd +sudo chown -R ubuntu:ubuntu /home/ubuntu/song-recognition From f9dac6247a5f5c8d47c2dce68b0dc9c6ada45277 Mon Sep 17 00:00:00 2001 From: Chigozirim Igweamaka Date: Fri, 17 May 2024 11:55:53 +0100 Subject: [PATCH 06/30] Create applicationStart.sh --- scripts/applicationStart.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 scripts/applicationStart.sh diff --git a/scripts/applicationStart.sh b/scripts/applicationStart.sh new file mode 100644 index 0000000..ce320ce --- /dev/null +++ b/scripts/applicationStart.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +start_backend() { + go build -tags netgo -ldflags '-s -w' -o app + nohup ./app > backend.log 2>&1 & + echo "Backend started successfully." +} + +start_client() { + cd /client + nvm use 16 + npm run build + nohup serve -s build > client.log 2>&1 & + echo "Client started successfully." +} + +start_backend && start_client From 9d0aabd880de1f17b0d1bbf223c30d3b44b53bb2 Mon Sep 17 00:00:00 2001 From: Chigozirim Igweamaka Date: Fri, 17 May 2024 11:59:45 +0100 Subject: [PATCH 07/30] Create appspec.yml --- appspec.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 appspec.yml diff --git a/appspec.yml b/appspec.yml new file mode 100644 index 0000000..9312b60 --- /dev/null +++ b/appspec.yml @@ -0,0 +1,12 @@ +version: 0.0 +os: linux +files: + - source: / + destination: /home/ubuntu/song-recognition +hooks: + BeforeInstall: + - location: scripts/BeforeInstall.sh + AfterInstall: + - location: scripts/AfterInstall.sh + ApplicationStart: + - location: scripts/ApplicationStart.sh From a5af1f64f39c6186da095f6b4191a9380924390b Mon Sep 17 00:00:00 2001 From: Chigozirim Igweamaka Date: Fri, 17 May 2024 12:00:15 +0100 Subject: [PATCH 08/30] Rename afterInstall.sh to AfterInstall.sh --- scripts/{afterInstall.sh => AfterInstall.sh} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename scripts/{afterInstall.sh => AfterInstall.sh} (100%) diff --git a/scripts/afterInstall.sh b/scripts/AfterInstall.sh similarity index 100% rename from scripts/afterInstall.sh rename to scripts/AfterInstall.sh From 4230a61c2b6d1bbaa4d4dcfbc676047ecd8edd9d Mon Sep 17 00:00:00 2001 From: Chigozirim Igweamaka Date: Fri, 17 May 2024 12:01:01 +0100 Subject: [PATCH 09/30] Rename applicationStart.sh to ApplicationStart.sh --- scripts/{applicationStart.sh => ApplicationStart.sh} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename scripts/{applicationStart.sh => ApplicationStart.sh} (100%) diff --git a/scripts/applicationStart.sh b/scripts/ApplicationStart.sh similarity index 100% rename from scripts/applicationStart.sh rename to scripts/ApplicationStart.sh From edd6d3e2cd37b33a617361b28598a1e6c5ac8e0b Mon Sep 17 00:00:00 2001 From: Chigozirim Igweamaka Date: Fri, 17 May 2024 12:01:23 +0100 Subject: [PATCH 10/30] Rename beforeInstall.sh to BeforeInstall.sh --- scripts/{beforeInstall.sh => BeforeInstall.sh} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename scripts/{beforeInstall.sh => BeforeInstall.sh} (100%) diff --git a/scripts/beforeInstall.sh b/scripts/BeforeInstall.sh similarity index 100% rename from scripts/beforeInstall.sh rename to scripts/BeforeInstall.sh From 6f6a9ca80d0e5e729f052e34e35be613b2bdb213 Mon Sep 17 00:00:00 2001 From: Chigozirim Igweamaka Date: Fri, 17 May 2024 12:29:38 +0100 Subject: [PATCH 11/30] Update BeforeInstall.sh --- scripts/BeforeInstall.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/BeforeInstall.sh b/scripts/BeforeInstall.sh index a873e74..17e3805 100644 --- a/scripts/BeforeInstall.sh +++ b/scripts/BeforeInstall.sh @@ -1,7 +1,9 @@ #!/usr/bin/env bash # clear codedeploy-agent files for a fresh install -sudo rm -rf /home/ubuntu/install +# sudo rm -rf /home/ubuntu/install + +touch /home/ubuntu/hello.txt # install CodeDeploy agent sudo apt-get -y update From b036ec0c3d79414940cd23f1f254915e61662712 Mon Sep 17 00:00:00 2001 From: Chigozirim Igweamaka Date: Fri, 17 May 2024 12:42:08 +0100 Subject: [PATCH 12/30] Update BeforeInstall.sh --- scripts/BeforeInstall.sh | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/scripts/BeforeInstall.sh b/scripts/BeforeInstall.sh index 17e3805..94248d9 100644 --- a/scripts/BeforeInstall.sh +++ b/scripts/BeforeInstall.sh @@ -3,24 +3,35 @@ # clear codedeploy-agent files for a fresh install # sudo rm -rf /home/ubuntu/install -touch /home/ubuntu/hello.txt - -# install CodeDeploy agent +touch /home/ubuntu/status.txt sudo apt-get -y update -sudo apt-get -y install ruby -sudo apt-get -y install wget -cd /home/ubuntu -wget https://aws-codedeploy-eu-north-1.s3.amazonaws.com/latest/install -sudo chmod +x ./install -sudo ./install auto + +if [ ! -d "/home/ubuntu/install" ]; then + # install CodeDeploy agent + sudo apt-get -y install ruby + sudo apt-get -y install wget + cd /home/ubuntu + wget https://aws-codedeploy-eu-north-1.s3.amazonaws.com/latest/install + sudo chmod +x ./install + sudo ./install auto +else + echo "CodeDeploy agent already installed." +fi + +echo "A" >> /home/ubuntu/status.txt # install golang sudo apt-get -y install golang-go +echo "Installed Golang" >> /home/ubuntu/status.txt # install nodeJS and nvm sudo apt -y install nodejs +echo "nodeJS installed successfully" >> /home/ubuntu/status.txt sudo apt -u install npm +echo "npm installed successfully" >> /home/ubuntu/status.txt wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash +echo "nvm installed successfully" >> /home/ubuntu/status.txt # install MongoDB sudo apt -y install mongodb +echo "mongodb installed successfully" >> /home/ubuntu/status.txt From a6a9bfbe3aa94b65f88a5e75674c35ad52f1fe6c Mon Sep 17 00:00:00 2001 From: Chigozirim Igweamaka Date: Fri, 17 May 2024 12:54:41 +0100 Subject: [PATCH 13/30] Update BeforeInstall.sh --- scripts/BeforeInstall.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/scripts/BeforeInstall.sh b/scripts/BeforeInstall.sh index 94248d9..9a540e8 100644 --- a/scripts/BeforeInstall.sh +++ b/scripts/BeforeInstall.sh @@ -33,5 +33,14 @@ wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash echo "nvm installed successfully" >> /home/ubuntu/status.txt # install MongoDB -sudo apt -y install mongodb +sudo apt-get install gnupg curl +curl -fsSL https://www.mongodb.org/static/pgp/server-7.0.asc | \ + sudo gpg -o /usr/share/keyrings/mongodb-server-7.0.gpg \ + --dearmor +echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-7.0.gpg ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/7.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-7.0.list +sudo apt-get update +sudo apt-get install -y mongodb-org +sudo apt-get install -y mongod +sudo apt-get install -y mongosh + echo "mongodb installed successfully" >> /home/ubuntu/status.txt From 795f66123a6a37380d208b58db8a16740cb95acf Mon Sep 17 00:00:00 2001 From: Chigozirim Igweamaka Date: Fri, 17 May 2024 12:54:55 +0100 Subject: [PATCH 14/30] Update AfterInstall.sh --- scripts/AfterInstall.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/AfterInstall.sh b/scripts/AfterInstall.sh index 513446e..4ca69b3 100644 --- a/scripts/AfterInstall.sh +++ b/scripts/AfterInstall.sh @@ -1 +1,3 @@ sudo chown -R ubuntu:ubuntu /home/ubuntu/song-recognition + +sudo systemctl start mongod From 8a5fa3de982643511ad6a721b82239574cd8601b Mon Sep 17 00:00:00 2001 From: Chigozirim Igweamaka Date: Fri, 17 May 2024 13:09:50 +0100 Subject: [PATCH 15/30] Update BeforeInstall.sh --- scripts/BeforeInstall.sh | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/scripts/BeforeInstall.sh b/scripts/BeforeInstall.sh index 9a540e8..5991097 100644 --- a/scripts/BeforeInstall.sh +++ b/scripts/BeforeInstall.sh @@ -6,7 +6,7 @@ touch /home/ubuntu/status.txt sudo apt-get -y update -if [ ! -d "/home/ubuntu/install" ]; then +if [ ! -f "/home/ubuntu/install" ]; then # install CodeDeploy agent sudo apt-get -y install ruby sudo apt-get -y install wget @@ -18,19 +18,14 @@ else echo "CodeDeploy agent already installed." fi -echo "A" >> /home/ubuntu/status.txt - # install golang sudo apt-get -y install golang-go echo "Installed Golang" >> /home/ubuntu/status.txt -# install nodeJS and nvm +# install nodeJS, npm, and nvm sudo apt -y install nodejs -echo "nodeJS installed successfully" >> /home/ubuntu/status.txt -sudo apt -u install npm -echo "npm installed successfully" >> /home/ubuntu/status.txt +sudo apt -y install npm wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash -echo "nvm installed successfully" >> /home/ubuntu/status.txt # install MongoDB sudo apt-get install gnupg curl @@ -42,5 +37,3 @@ sudo apt-get update sudo apt-get install -y mongodb-org sudo apt-get install -y mongod sudo apt-get install -y mongosh - -echo "mongodb installed successfully" >> /home/ubuntu/status.txt From 61636917f4ad305334d6c22475206135374a3d47 Mon Sep 17 00:00:00 2001 From: Chigozirim Igweamaka Date: Fri, 17 May 2024 13:12:10 +0100 Subject: [PATCH 16/30] Update ApplicationStart.sh --- scripts/ApplicationStart.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/ApplicationStart.sh b/scripts/ApplicationStart.sh index ce320ce..86170d0 100644 --- a/scripts/ApplicationStart.sh +++ b/scripts/ApplicationStart.sh @@ -1,13 +1,14 @@ #!/usr/bin/env bash start_backend() { + cd /home/ubuntu/song-recognition go build -tags netgo -ldflags '-s -w' -o app nohup ./app > backend.log 2>&1 & echo "Backend started successfully." } start_client() { - cd /client + cd /home/ubuntu/song-recognition/client nvm use 16 npm run build nohup serve -s build > client.log 2>&1 & From 8ec6b7b075af24210684023b414b3616c913723d Mon Sep 17 00:00:00 2001 From: Chigozirim Igweamaka Date: Fri, 17 May 2024 13:12:47 +0100 Subject: [PATCH 17/30] Update ApplicationStart.sh --- scripts/ApplicationStart.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/ApplicationStart.sh b/scripts/ApplicationStart.sh index 86170d0..2b3781c 100644 --- a/scripts/ApplicationStart.sh +++ b/scripts/ApplicationStart.sh @@ -9,6 +9,7 @@ start_backend() { start_client() { cd /home/ubuntu/song-recognition/client + nvm install 16 nvm use 16 npm run build nohup serve -s build > client.log 2>&1 & From 8134a77db8fad53df1370aff922ca6cf9ec9dbf9 Mon Sep 17 00:00:00 2001 From: Chigozirim Igweamaka Date: Fri, 17 May 2024 13:18:06 +0100 Subject: [PATCH 18/30] Update BeforeInstall.sh --- scripts/BeforeInstall.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/scripts/BeforeInstall.sh b/scripts/BeforeInstall.sh index 5991097..1e62fbc 100644 --- a/scripts/BeforeInstall.sh +++ b/scripts/BeforeInstall.sh @@ -3,7 +3,6 @@ # clear codedeploy-agent files for a fresh install # sudo rm -rf /home/ubuntu/install -touch /home/ubuntu/status.txt sudo apt-get -y update if [ ! -f "/home/ubuntu/install" ]; then @@ -20,7 +19,6 @@ fi # install golang sudo apt-get -y install golang-go -echo "Installed Golang" >> /home/ubuntu/status.txt # install nodeJS, npm, and nvm sudo apt -y install nodejs From a7c77632d3e8343fd3a1722d2b03a7c93f53828e Mon Sep 17 00:00:00 2001 From: Chigozirim Igweamaka Date: Fri, 17 May 2024 13:30:52 +0100 Subject: [PATCH 19/30] Update BeforeInstall.sh --- scripts/BeforeInstall.sh | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/scripts/BeforeInstall.sh b/scripts/BeforeInstall.sh index 1e62fbc..09b9c39 100644 --- a/scripts/BeforeInstall.sh +++ b/scripts/BeforeInstall.sh @@ -25,13 +25,14 @@ sudo apt -y install nodejs sudo apt -y install npm wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash -# install MongoDB -sudo apt-get install gnupg curl -curl -fsSL https://www.mongodb.org/static/pgp/server-7.0.asc | \ - sudo gpg -o /usr/share/keyrings/mongodb-server-7.0.gpg \ - --dearmor -echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-7.0.gpg ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/7.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-7.0.list -sudo apt-get update -sudo apt-get install -y mongodb-org -sudo apt-get install -y mongod -sudo apt-get install -y mongosh +# Install MongoDB only if not already present +if [ ! -d "/usr/bin/mongod" ]; then + sudo apt-get install gnupg curl + curl -fsSL https://www.mongodb.org/static/pgp/server-7.0.asc | \ + sudo gpg -o /usr/share/keyrings/mongodb-server-7.0.gpg \ + --dearmor + echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-7.0.gpg ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/7.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-7.0.list + sudo apt-get update + sudo apt-get install -y mongodb-org + sudo apt-get install -y mongosh +fi From 85cbd619f7a7aa262a6fb1eb103222ccdff0a1bf Mon Sep 17 00:00:00 2001 From: Chigozirim Igweamaka Date: Fri, 17 May 2024 13:35:00 +0100 Subject: [PATCH 20/30] Update ApplicationStart.sh --- scripts/ApplicationStart.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/ApplicationStart.sh b/scripts/ApplicationStart.sh index 2b3781c..b48b99c 100644 --- a/scripts/ApplicationStart.sh +++ b/scripts/ApplicationStart.sh @@ -1,6 +1,7 @@ #!/usr/bin/env bash start_backend() { + touch back.txt cd /home/ubuntu/song-recognition go build -tags netgo -ldflags '-s -w' -o app nohup ./app > backend.log 2>&1 & @@ -8,6 +9,7 @@ start_backend() { } start_client() { + touch client.txt cd /home/ubuntu/song-recognition/client nvm install 16 nvm use 16 From 54d1b4d504c35d37b1a24af6b9f7fb1365699ae4 Mon Sep 17 00:00:00 2001 From: Chigozirim Igweamaka Date: Fri, 17 May 2024 13:42:01 +0100 Subject: [PATCH 21/30] Update BeforeInstall.sh --- scripts/BeforeInstall.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/scripts/BeforeInstall.sh b/scripts/BeforeInstall.sh index 09b9c39..89be188 100644 --- a/scripts/BeforeInstall.sh +++ b/scripts/BeforeInstall.sh @@ -13,8 +13,6 @@ if [ ! -f "/home/ubuntu/install" ]; then wget https://aws-codedeploy-eu-north-1.s3.amazonaws.com/latest/install sudo chmod +x ./install sudo ./install auto -else - echo "CodeDeploy agent already installed." fi # install golang @@ -26,7 +24,7 @@ sudo apt -y install npm wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash # Install MongoDB only if not already present -if [ ! -d "/usr/bin/mongod" ]; then +if [ ! -f "/usr/bin/mongod" ]; then sudo apt-get install gnupg curl curl -fsSL https://www.mongodb.org/static/pgp/server-7.0.asc | \ sudo gpg -o /usr/share/keyrings/mongodb-server-7.0.gpg \ From c270f7889ba073b41b7ad5367de81f2dfc44d0dc Mon Sep 17 00:00:00 2001 From: Chigozirim Igweamaka Date: Fri, 17 May 2024 13:49:13 +0100 Subject: [PATCH 22/30] Update appspec.yml --- appspec.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/appspec.yml b/appspec.yml index 9312b60..00efc1b 100644 --- a/appspec.yml +++ b/appspec.yml @@ -5,8 +5,11 @@ files: destination: /home/ubuntu/song-recognition hooks: BeforeInstall: - - location: scripts/BeforeInstall.sh + - location: scripts/BeforeInstall.sh + runas: ubuntu AfterInstall: - - location: scripts/AfterInstall.sh + - location: scripts/AfterInstall.sh + runas: ubuntu ApplicationStart: - location: scripts/ApplicationStart.sh + runas: ubuntu From 685601bbe44f9c1e0a6175e908eff4c592d4e30f Mon Sep 17 00:00:00 2001 From: Chigozirim Igweamaka Date: Fri, 17 May 2024 13:54:02 +0100 Subject: [PATCH 23/30] Update appspec.yml --- appspec.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/appspec.yml b/appspec.yml index 00efc1b..e7d440f 100644 --- a/appspec.yml +++ b/appspec.yml @@ -6,7 +6,6 @@ files: hooks: BeforeInstall: - location: scripts/BeforeInstall.sh - runas: ubuntu AfterInstall: - location: scripts/AfterInstall.sh runas: ubuntu From 9c872282dc0159b16d20b5d939503242eabd6155 Mon Sep 17 00:00:00 2001 From: Chigozirim Igweamaka Date: Fri, 17 May 2024 13:59:46 +0100 Subject: [PATCH 24/30] Update appspec.yml --- appspec.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/appspec.yml b/appspec.yml index e7d440f..d907570 100644 --- a/appspec.yml +++ b/appspec.yml @@ -8,7 +8,4 @@ hooks: - location: scripts/BeforeInstall.sh AfterInstall: - location: scripts/AfterInstall.sh - runas: ubuntu - ApplicationStart: - location: scripts/ApplicationStart.sh - runas: ubuntu From e4b34486548659a29730d33b842e20adf8eebaee Mon Sep 17 00:00:00 2001 From: Chigozirim Igweamaka Date: Fri, 17 May 2024 14:05:23 +0100 Subject: [PATCH 25/30] Update appspec.yml --- appspec.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/appspec.yml b/appspec.yml index d907570..bc0edf4 100644 --- a/appspec.yml +++ b/appspec.yml @@ -9,3 +9,4 @@ hooks: AfterInstall: - location: scripts/AfterInstall.sh - location: scripts/ApplicationStart.sh + runas: ubuntu From df2e09d14ef3edeeffce63b838be26fad682f2bd Mon Sep 17 00:00:00 2001 From: Chigozirim Igweamaka Date: Fri, 17 May 2024 14:20:12 +0100 Subject: [PATCH 26/30] Update appspec.yml --- appspec.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/appspec.yml b/appspec.yml index bc0edf4..0063f49 100644 --- a/appspec.yml +++ b/appspec.yml @@ -8,5 +8,6 @@ hooks: - location: scripts/BeforeInstall.sh AfterInstall: - location: scripts/AfterInstall.sh + ApplicationStart: - location: scripts/ApplicationStart.sh runas: ubuntu From 9c2d3168d68a333c2632cbd806cbd8dd51e14e9c Mon Sep 17 00:00:00 2001 From: Chigozirim Igweamaka Date: Fri, 17 May 2024 14:21:28 +0100 Subject: [PATCH 27/30] Update ApplicationStart.sh --- scripts/ApplicationStart.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/scripts/ApplicationStart.sh b/scripts/ApplicationStart.sh index b48b99c..278f2c4 100644 --- a/scripts/ApplicationStart.sh +++ b/scripts/ApplicationStart.sh @@ -1,21 +1,19 @@ #!/usr/bin/env bash start_backend() { - touch back.txt cd /home/ubuntu/song-recognition + touch back.txt go build -tags netgo -ldflags '-s -w' -o app nohup ./app > backend.log 2>&1 & - echo "Backend started successfully." } start_client() { - touch client.txt cd /home/ubuntu/song-recognition/client + touch client.txt nvm install 16 nvm use 16 npm run build nohup serve -s build > client.log 2>&1 & - echo "Client started successfully." } start_backend && start_client From 2c142466ed984abebff073f0784211f2e33d690d Mon Sep 17 00:00:00 2001 From: Chigozirim Igweamaka Date: Fri, 17 May 2024 14:37:08 +0100 Subject: [PATCH 28/30] Update BeforeInstall.sh --- scripts/BeforeInstall.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/scripts/BeforeInstall.sh b/scripts/BeforeInstall.sh index 89be188..2cedb2d 100644 --- a/scripts/BeforeInstall.sh +++ b/scripts/BeforeInstall.sh @@ -1,8 +1,5 @@ #!/usr/bin/env bash -# clear codedeploy-agent files for a fresh install -# sudo rm -rf /home/ubuntu/install - sudo apt-get -y update if [ ! -f "/home/ubuntu/install" ]; then From 4a6b3496ec3b8c760e7f96767c99aa749da41605 Mon Sep 17 00:00:00 2001 From: Chigozirim Igweamaka Date: Fri, 17 May 2024 14:44:41 +0100 Subject: [PATCH 29/30] Update appspec.yml --- appspec.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/appspec.yml b/appspec.yml index 0063f49..bc0edf4 100644 --- a/appspec.yml +++ b/appspec.yml @@ -8,6 +8,5 @@ hooks: - location: scripts/BeforeInstall.sh AfterInstall: - location: scripts/AfterInstall.sh - ApplicationStart: - location: scripts/ApplicationStart.sh runas: ubuntu From 6852cd03caec617c341f4648d56d9d1df00ca46d Mon Sep 17 00:00:00 2001 From: Chigozirim Igweamaka Date: Fri, 17 May 2024 15:34:18 +0100 Subject: [PATCH 30/30] Update ApplicationStart.sh --- scripts/ApplicationStart.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/ApplicationStart.sh b/scripts/ApplicationStart.sh index 278f2c4..6584c4b 100644 --- a/scripts/ApplicationStart.sh +++ b/scripts/ApplicationStart.sh @@ -10,8 +10,13 @@ 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 & }