From 906438c3257e50b636e099498591ac53b15518ca Mon Sep 17 00:00:00 2001 From: Simon Larsen Date: Wed, 19 Jul 2023 14:21:39 +0100 Subject: [PATCH] refactor status check script --- install.sh | 60 ------------------------------------------------- package.json | 2 +- status-check.sh | 60 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 61 insertions(+), 61 deletions(-) create mode 100644 status-check.sh diff --git a/install.sh b/install.sh index a5a12cf7eb..27b806a139 100755 --- a/install.sh +++ b/install.sh @@ -21,63 +21,3 @@ export $(grep -v '^#' config.env | xargs) && docker compose pull # Start all containers. npm start -echo "We will need to wait ~5-10 minutes for things to settle down, migrations to finish, and TLS certs to be issued" -echo "" -echo "⏳ Waiting for OneUptime to boot (this will take a few minutes)" - -echo "Checking API Status..." -bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost/api/status)" != "200" ]]; do sleep 5; done' -echo "API is up ✔️" - -echo "Checking Dashboard Status..." -bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost/dashboard/status)" != "200" ]]; do sleep 5; done' -echo "Dashboard is up ✔️" - -echo "Checking File Server Status..." -bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost/file/status)" != "200" ]]; do sleep 5; done' -echo "File server is up ✔️" - -echo "Checking Status Page Server Status..." -bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost/status-page/status)" != "200" ]]; do sleep 5; done' -echo "Status Page Server is up ✔️" - -echo "Checking Home Server Status..." -bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost/status)" != "200" ]]; do sleep 5; done' -echo "Home Server is up ✔️" - -echo "Checking Accounts Server Status..." -bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost/accounts/status)" != "200" ]]; do sleep 5; done' -echo "Accounts Server is up ✔️" - -echo "Checking Notification Server Status..." -bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost/notification/status)" != "200" ]]; do sleep 5; done' -echo "Notification Server is up ✔️" - -echo "Checking Worker Server Status..." -bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost/workers/status)" != "200" ]]; do sleep 5; done' -echo "Worker Server is up ✔️" - -echo "Checking Identity Server Status..." -bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost/identity/status)" != "200" ]]; do sleep 5; done' -echo "Identity Server is up ✔️" - -echo "Checking Workflow Server Status..." -bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost/workflow/status)" != "200" ]]; do sleep 5; done' -echo "Workflow Server is up ✔️" - -echo "Checking API Docs Server Status..." -bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost/reference/status)" != "200" ]]; do sleep 5; done' -echo "API Docs Server is up ✔️" - -echo "Checking Link Shortner Status..." -bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost/l/status)" != "200" ]]; do sleep 5; done' -echo "Link Shortner Server is up ✔️" - -echo "⌛️ OneUptime is up!" -echo "" -echo "🎉🎉🎉 Done! 🎉🎉🎉" - -echo "We would like to hear your feedback to make this product better for you and for other users, please email us at hello@oneuptime.com." -echo " - If you notice a bug, we will fix it for you." -echo " - If you need a feature, we will add that to the roadmap and let you know the estimated time to ship." -echo "We would love to hear your feedback. Email: hello@oneuptime.com" \ No newline at end of file diff --git a/package.json b/package.json index cb34337b53..c57b002883 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ "lint": "ejslint **/*.ejs && eslint '**/*.ts*' -c .eslintrc.json --ignore-path .eslintignore ", "fix-lint": " node --max_old_space_size=18192 ./node_modules/.bin/eslint '**/*.ts*' -c .eslintrc.json --ignore-path .eslintignore --fix ", "fix": "npm run fix-lint", - "start": "export $(grep -v '^#' config.env | xargs) && docker compose up --remove-orphans -d $npm_config_services", + "start": "export $(grep -v '^#' config.env | xargs) && docker compose up --remove-orphans -d $npm_config_services && bash status-check.sh", "ps": "docker compose ps", "save-logs": "docker compose logs --tail=100000 $npm_config_services > logs.txt", "logs": "docker compose logs --tail=100 -f $npm_config_services", diff --git a/status-check.sh b/status-check.sh new file mode 100644 index 0000000000..a1b7ab5b48 --- /dev/null +++ b/status-check.sh @@ -0,0 +1,60 @@ +echo "We will need to wait ~5-10 minutes for things to settle down, migrations to finish, and TLS certs to be issued" +echo "" +echo "⏳ Waiting for OneUptime to boot (this will take a few minutes)" + +echo "Checking API Status..." +bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost/api/status)" != "200" ]]; do sleep 5; done' +echo "API is up ✔️" + +echo "Checking Dashboard Status..." +bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost/dashboard/status)" != "200" ]]; do sleep 5; done' +echo "Dashboard is up ✔️" + +echo "Checking File Server Status..." +bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost/file/status)" != "200" ]]; do sleep 5; done' +echo "File server is up ✔️" + +echo "Checking Status Page Server Status..." +bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost/status-page/status)" != "200" ]]; do sleep 5; done' +echo "Status Page Server is up ✔️" + +echo "Checking Home Server Status..." +bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost/status)" != "200" ]]; do sleep 5; done' +echo "Home Server is up ✔️" + +echo "Checking Accounts Server Status..." +bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost/accounts/status)" != "200" ]]; do sleep 5; done' +echo "Accounts Server is up ✔️" + +echo "Checking Notification Server Status..." +bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost/notification/status)" != "200" ]]; do sleep 5; done' +echo "Notification Server is up ✔️" + +echo "Checking Worker Server Status..." +bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost/workers/status)" != "200" ]]; do sleep 5; done' +echo "Worker Server is up ✔️" + +echo "Checking Identity Server Status..." +bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost/identity/status)" != "200" ]]; do sleep 5; done' +echo "Identity Server is up ✔️" + +echo "Checking Workflow Server Status..." +bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost/workflow/status)" != "200" ]]; do sleep 5; done' +echo "Workflow Server is up ✔️" + +echo "Checking API Docs Server Status..." +bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost/reference/status)" != "200" ]]; do sleep 5; done' +echo "API Docs Server is up ✔️" + +echo "Checking Link Shortner Status..." +bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost/l/status)" != "200" ]]; do sleep 5; done' +echo "Link Shortner Server is up ✔️" + +echo "⌛️ OneUptime is up!" +echo "" +echo "🎉🎉🎉 Done! 🎉🎉🎉" + +echo "We would like to hear your feedback to make this product better for you and for other users, please email us at hello@oneuptime.com." +echo " - If you notice a bug, we will fix it for you." +echo " - If you need a feature, we will add that to the roadmap and let you know the estimated time to ship." +echo "We would love to hear your feedback. Email: hello@oneuptime.com" \ No newline at end of file