From dd64f0699b6c733c597d93fa5da0057bdee822c9 Mon Sep 17 00:00:00 2001 From: AmnaZahid16 Date: Tue, 11 Jun 2024 17:36:15 +0500 Subject: [PATCH 1/8] adding appspec.yaml --- appspec.yml | 19 +++++++++++++++++++ scripts/after_install.sh | 4 ++++ scripts/install_dependencies.sh | 5 +++++ scripts/start_server.sh | 4 ++++ 4 files changed, 32 insertions(+) create mode 100644 appspec.yml create mode 100644 scripts/after_install.sh create mode 100644 scripts/install_dependencies.sh create mode 100644 scripts/start_server.sh diff --git a/appspec.yml b/appspec.yml new file mode 100644 index 0000000..6b5c7d4 --- /dev/null +++ b/appspec.yml @@ -0,0 +1,19 @@ +version: 0.0 +os: ubuntu +files: + - source: / + destination: /var/www/ +hooks: + BeforeInstall: + - location: scripts/install_dependencies.sh + timeout: 300 + runas: root + AfterInstall: + - location: scripts/after_install.sh + timeout: 300 + runas: root + ApplicationStart: + - location: scripts/start_server.sh + timeout: 300 + runas: root + \ No newline at end of file diff --git a/scripts/after_install.sh b/scripts/after_install.sh new file mode 100644 index 0000000..e919302 --- /dev/null +++ b/scripts/after_install.sh @@ -0,0 +1,4 @@ +#!/bin/bash +cd /var/www +sudo apt install npm +echo 'TEST_ENV_VARIABLE="amnazahid"' > .env \ No newline at end of file diff --git a/scripts/install_dependencies.sh b/scripts/install_dependencies.sh new file mode 100644 index 0000000..aa9e1ae --- /dev/null +++ b/scripts/install_dependencies.sh @@ -0,0 +1,5 @@ +#!/bin/bash +cd /var/www +sudo apt update +sudo apt install nodejs +sudo apt install npm \ No newline at end of file diff --git a/scripts/start_server.sh b/scripts/start_server.sh new file mode 100644 index 0000000..de4dfb2 --- /dev/null +++ b/scripts/start_server.sh @@ -0,0 +1,4 @@ +#!/bin/bash +cd /var/www + +npm start \ No newline at end of file From efb4372dec4ea7a9d86154d246c73977d9d8ce51 Mon Sep 17 00:00:00 2001 From: AmnaZahid16 Date: Tue, 11 Jun 2024 18:20:21 +0500 Subject: [PATCH 2/8] adding appspec.yaml --- scripts/after_install.sh | 2 +- scripts/install_dependencies.sh | 3 +-- scripts/start_server.sh | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/scripts/after_install.sh b/scripts/after_install.sh index e919302..6b35909 100644 --- a/scripts/after_install.sh +++ b/scripts/after_install.sh @@ -1,4 +1,4 @@ #!/bin/bash -cd /var/www +cd /home/ubuntu sudo apt install npm echo 'TEST_ENV_VARIABLE="amnazahid"' > .env \ No newline at end of file diff --git a/scripts/install_dependencies.sh b/scripts/install_dependencies.sh index aa9e1ae..2c235ce 100644 --- a/scripts/install_dependencies.sh +++ b/scripts/install_dependencies.sh @@ -1,5 +1,4 @@ #!/bin/bash -cd /var/www +cd /home/ubuntu sudo apt update sudo apt install nodejs -sudo apt install npm \ No newline at end of file diff --git a/scripts/start_server.sh b/scripts/start_server.sh index de4dfb2..a3482d9 100644 --- a/scripts/start_server.sh +++ b/scripts/start_server.sh @@ -1,4 +1,4 @@ #!/bin/bash -cd /var/www +cd /home/ubuntu npm start \ No newline at end of file From 6dbbff2d929916288ec508a767691acae9535b3e Mon Sep 17 00:00:00 2001 From: AmnaZahid16 Date: Tue, 11 Jun 2024 18:27:31 +0500 Subject: [PATCH 3/8] adding appspec.yaml --- appspec.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/appspec.yml b/appspec.yml index 6b5c7d4..b903a04 100644 --- a/appspec.yml +++ b/appspec.yml @@ -1,8 +1,8 @@ version: 0.0 -os: ubuntu +os: linux files: - source: / - destination: /var/www/ + destination: /home/ubuntu hooks: BeforeInstall: - location: scripts/install_dependencies.sh From e5c0cdb37ed40a562532bce0486fef97ebf81694 Mon Sep 17 00:00:00 2001 From: AmnaZahid16 Date: Tue, 11 Jun 2024 18:47:54 +0500 Subject: [PATCH 4/8] adding appspec.yaml --- scripts/after_install.sh | 1 + scripts/install_dependencies.sh | 6 +++++- scripts/start_server.sh | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/after_install.sh b/scripts/after_install.sh index 6b35909..9a4a663 100644 --- a/scripts/after_install.sh +++ b/scripts/after_install.sh @@ -1,4 +1,5 @@ #!/bin/bash + cd /home/ubuntu sudo apt install npm echo 'TEST_ENV_VARIABLE="amnazahid"' > .env \ No newline at end of file diff --git a/scripts/install_dependencies.sh b/scripts/install_dependencies.sh index 2c235ce..8b7f9c7 100644 --- a/scripts/install_dependencies.sh +++ b/scripts/install_dependencies.sh @@ -1,4 +1,8 @@ #!/bin/bash + cd /home/ubuntu sudo apt update -sudo apt install nodejs +sudo apt install -y curl software-properties-common +curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash - +sudo apt install -y nodejs + diff --git a/scripts/start_server.sh b/scripts/start_server.sh index a3482d9..8dc4d1c 100644 --- a/scripts/start_server.sh +++ b/scripts/start_server.sh @@ -1,4 +1,5 @@ #!/bin/bash + cd /home/ubuntu npm start \ No newline at end of file From 95d00e1f519d91571770bb943cc64e7af55c641d Mon Sep 17 00:00:00 2001 From: AmnaZahid16 Date: Tue, 11 Jun 2024 18:58:38 +0500 Subject: [PATCH 5/8] adding appspec.yaml --- scripts/after_install.sh | 2 +- scripts/install_dependencies.sh | 3 ++- scripts/start_server.sh | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/after_install.sh b/scripts/after_install.sh index 9a4a663..4a6c326 100644 --- a/scripts/after_install.sh +++ b/scripts/after_install.sh @@ -1,5 +1,5 @@ #!/bin/bash -cd /home/ubuntu +cd /home/ubuntu/test sudo apt install npm echo 'TEST_ENV_VARIABLE="amnazahid"' > .env \ No newline at end of file diff --git a/scripts/install_dependencies.sh b/scripts/install_dependencies.sh index 8b7f9c7..03e294a 100644 --- a/scripts/install_dependencies.sh +++ b/scripts/install_dependencies.sh @@ -1,6 +1,7 @@ #!/bin/bash - cd /home/ubuntu +mkdir test +cd test sudo apt update sudo apt install -y curl software-properties-common curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash - diff --git a/scripts/start_server.sh b/scripts/start_server.sh index 8dc4d1c..a20582e 100644 --- a/scripts/start_server.sh +++ b/scripts/start_server.sh @@ -1,5 +1,5 @@ #!/bin/bash -cd /home/ubuntu +cd /home/ubuntu/test npm start \ No newline at end of file From 41556a88fd4d5c4a8c53ac856bf63f7b4297d415 Mon Sep 17 00:00:00 2001 From: AmnaZahid16 Date: Tue, 11 Jun 2024 19:09:06 +0500 Subject: [PATCH 6/8] adding appspec.yaml --- scripts/after_install.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/after_install.sh b/scripts/after_install.sh index 4a6c326..33f8411 100644 --- a/scripts/after_install.sh +++ b/scripts/after_install.sh @@ -2,4 +2,5 @@ cd /home/ubuntu/test sudo apt install npm +sudo npm install -g typescript echo 'TEST_ENV_VARIABLE="amnazahid"' > .env \ No newline at end of file From 17a8e0b26c4d88997479e051775104d1742bf6ee Mon Sep 17 00:00:00 2001 From: AmnaZahid16 Date: Tue, 11 Jun 2024 19:18:43 +0500 Subject: [PATCH 7/8] adding appspec.yaml --- scripts/after_install.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/after_install.sh b/scripts/after_install.sh index 33f8411..d14d46e 100644 --- a/scripts/after_install.sh +++ b/scripts/after_install.sh @@ -3,4 +3,6 @@ cd /home/ubuntu/test sudo apt install npm sudo npm install -g typescript +npm install ws +sudo apt install npm echo 'TEST_ENV_VARIABLE="amnazahid"' > .env \ No newline at end of file From e6ceb8f372a6503bdc3096de0123142c37d0da29 Mon Sep 17 00:00:00 2001 From: AmnaZahid16 Date: Tue, 11 Jun 2024 19:29:27 +0500 Subject: [PATCH 8/8] adding appspec.yaml --- appspec.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/appspec.yml b/appspec.yml index b903a04..4928883 100644 --- a/appspec.yml +++ b/appspec.yml @@ -14,6 +14,5 @@ hooks: runas: root ApplicationStart: - location: scripts/start_server.sh - timeout: 300 runas: root \ No newline at end of file