From 9669311987c98f0090d83141094f52c45354b0a0 Mon Sep 17 00:00:00 2001 From: andrewlalis Date: Mon, 30 Dec 2024 11:55:30 -0500 Subject: [PATCH] Added individual deploy scripts. --- build-api.sh | 10 ++++++++++ build-app.sh | 10 ++++++++++ deploy-api.sh | 8 ++++++++ deploy-app.sh | 6 ++++++ deploy.sh | 24 ++++-------------------- 5 files changed, 38 insertions(+), 20 deletions(-) create mode 100755 build-api.sh create mode 100755 build-app.sh create mode 100755 deploy-api.sh create mode 100755 deploy-app.sh diff --git a/build-api.sh b/build-api.sh new file mode 100755 index 0000000..25c6d8f --- /dev/null +++ b/build-api.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +set -e +set -o pipefail + +echo "Building API" +cd api +dub clean +dub build --build=release --compiler=/opt/ldc2/ldc2-1.36.0-linux-x86_64/bin/ldc2 +cd .. diff --git a/build-app.sh b/build-app.sh new file mode 100755 index 0000000..7ea468c --- /dev/null +++ b/build-app.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +set -e +set -o pipefail + +echo "Building app" +cd app +rm -rf dist +npm run build +cd .. diff --git a/deploy-api.sh b/deploy-api.sh new file mode 100755 index 0000000..7e5ee3a --- /dev/null +++ b/deploy-api.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +set -e +set -o pipefail + +ssh -f root@andrewlalis.com 'systemctl stop teacher-tools-api.service' +scp api/teacher-tools-api root@andrewlalis.com:/opt/teacher-tools/ +ssh -f root@andrewlalis.com 'systemctl start teacher-tools-api.service' diff --git a/deploy-app.sh b/deploy-app.sh new file mode 100755 index 0000000..621e33b --- /dev/null +++ b/deploy-app.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +set -e +set -o pipefail + +rsync -rav -e ssh --delete app/dist/* root@andrewlalis.com:/opt/teacher-tools/app-content diff --git a/deploy.sh b/deploy.sh index a787e98..7018eb3 100755 --- a/deploy.sh +++ b/deploy.sh @@ -1,23 +1,7 @@ #!/usr/bin/env bash -set -e -set -o pipefail +./build-app.sh +./build-api.sh -# Script for deploying the application to teacher-tools.andrewlalis.com. - -echo "Building app" -cd app -rm -rf dist -npm run build -cd .. - -echo "Building API" -cd api -dub clean -dub build --build=release --compiler=/opt/ldc2/ldc2-1.36.0-linux-x86_64/bin/ldc2 -cd .. - -ssh -f root@andrewlalis.com 'systemctl stop teacher-tools-api.service' -scp api/teacher-tools-api root@andrewlalis.com:/opt/teacher-tools/ -rsync -rav -e ssh --delete app/dist/* root@andrewlalis.com:/opt/teacher-tools/app-content -ssh -f root@andrewlalis.com 'systemctl start teacher-tools-api.service' +./deploy-app.sh +./deploy-api.sh