diff --git a/Docs/Installation/Helm.md b/Docs/Installation/Helm.md index 9560e5d665..09f88b8b8a 100644 --- a/Docs/Installation/Helm.md +++ b/Docs/Installation/Helm.md @@ -23,8 +23,14 @@ helm lint ./HelmChart/public/oneuptime ``` -### Test Install +### Install in Staging ``` helm install oneuptime ./HelmChart/public/oneuptime -f ./HelmChart/public/oneuptime/values.yaml -f ./HelmChart/test.values.yaml +``` + +### Run tests + +``` +helm test oneuptime ``` \ No newline at end of file diff --git a/HelmChart/public/oneuptime/scripts/status-check.sh b/HelmChart/public/oneuptime/scripts/status-check.sh new file mode 100644 index 0000000000..f014ea3d28 --- /dev/null +++ b/HelmChart/public/oneuptime/scripts/status-check.sh @@ -0,0 +1,71 @@ +HOST_TO_CHECK="$1" + +if [ $# -eq 0 ]; then + HOST_TO_CHECK="localhost" +fi + + +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}'' $HOST_TO_CHECK/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}'' $HOST_TO_CHECK/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}'' $HOST_TO_CHECK/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}'' $HOST_TO_CHECK/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}'' $HOST_TO_CHECK/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}'' $HOST_TO_CHECK/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}'' $HOST_TO_CHECK/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}'' $HOST_TO_CHECK/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}'' $HOST_TO_CHECK/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}'' $HOST_TO_CHECK/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}'' $HOST_TO_CHECK/reference/status)" != "200" ]]; do sleep 5; done' +echo "API Docs Server is up ✔️" + +echo "Checking Link Shortener Status..." +bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' $HOST_TO_CHECK/l/status)" != "200" ]]; do sleep 5; done' +echo "Link Shortener Server is up ✔️" + +echo "Checking Admin Dashboard Server Status..." +bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' $HOST_TO_CHECK/admin/status)" != "200" ]]; do sleep 5; done' +echo "Admin Dashboard 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/HelmChart/public/oneuptime/templates/_helpers.tpl b/HelmChart/public/oneuptime/templates/_helpers.tpl index 92cb7162cf..fce6ec2958 100644 --- a/HelmChart/public/oneuptime/templates/_helpers.tpl +++ b/HelmChart/public/oneuptime/templates/_helpers.tpl @@ -114,11 +114,11 @@ value: {{ $.Values.secrets.encryption }} - name: CLICKHOUSE_USER - value: {{ $.Values.clickhouse.user }} + value: {{ $.Values.clickhouse.auth.user }} - name: CLICKHOUSE_PASSWORD - value: {{ $.Values.clickhouse.password }} + value: {{ $.Values.clickhouse.auth.password }} - name: CLICKHOUSE_HOST - value: {{ $.Values.clickhouse.host }} + value: {{ $.Release.Name }}-clickhouse.{{ $.Release.Namespace }}.svc.cluster.local - name: CLICKHOUSE_PORT value: {{ printf "8123" | squote}} - name: CLICKHOUSE_DATABASE @@ -190,6 +190,11 @@ spec: - port: {{ $.Port }} targetPort: {{ $.Port }} name: port + {{- if $.isHTTPSPortEnabled }} + - port: 443 + targetPort: 443 + name: https + {{- end }} selector: app: {{ printf "%s-%s" $.Release.Name $.ServiceName }} {{- if $.ServiceType }} @@ -253,14 +258,12 @@ spec: {{- if $.Port }} ports: - containerPort: {{ $.Port }} - hostPort: {{ $.Port }} protocol: TCP name: http {{- if $.isHTTPSPortEnabled }} - containerPort: 443 - hostPort: 443 protocol: TCP - name: https + name: http {{- end }} {{- end }} restartPolicy: {{ $.Values.image.restartPolicy }} diff --git a/HelmChart/public/oneuptime/templates/nginx.yaml b/HelmChart/public/oneuptime/templates/nginx.yaml index 4313609f51..8c7acfc08c 100644 --- a/HelmChart/public/oneuptime/templates/nginx.yaml +++ b/HelmChart/public/oneuptime/templates/nginx.yaml @@ -1,6 +1,6 @@ # OneUptime nginx Service {{- $nginxVolumes := dict "certs" (printf "%s-%s" $.Release.Name "certs") }} -{{- $nginxDeploymentArgs :=dict "IsServer" true "ServiceName" "nginx" "Port" $.Values.port.nginx "Release" $.Release "Values" $.Values "Volumes" $nginxVolumes -}} +{{- $nginxDeploymentArgs :=dict "isHTTPSPortEnabled" true "IsServer" true "ServiceName" "nginx" "Port" $.Values.port.nginx "Release" $.Release "Values" $.Values "Volumes" $nginxVolumes -}} {{- include "oneuptime.deployment" $nginxDeploymentArgs }} --- diff --git a/HelmChart/public/oneuptime/templates/tests/status-check.yaml b/HelmChart/public/oneuptime/templates/tests/status-check.yaml new file mode 100644 index 0000000000..6ce819c332 --- /dev/null +++ b/HelmChart/public/oneuptime/templates/tests/status-check.yaml @@ -0,0 +1,13 @@ +# apiVersion: v1 +# kind: Pod +# metadata: +# name: {{ printf "%s-%s" $.Release.Name "status-check" }} +# annotations: +# "helm.sh/hook": test +# spec: +# containers: +# - name: wget +# image: busybox +# command: ['/bin/sh'] +# args: ["-c", "scripts/status-check.sh", "{{ $.Release.Name }}-nginx.{{ $.Release.Namespace }}.svc.cluster.local"] +# restartPolicy: Never \ No newline at end of file diff --git a/HelmChart/public/oneuptime/values.yaml b/HelmChart/public/oneuptime/values.yaml index c457355bcb..e02d950d59 100644 --- a/HelmChart/public/oneuptime/values.yaml +++ b/HelmChart/public/oneuptime/values.yaml @@ -22,7 +22,7 @@ ingress: postgresql: auth: username: oneuptime - password: {{ randAlphaNum 16 | quote }} + password: please-change-this-to-random-value database: oneuptimedb architecture: standalone primary: @@ -41,12 +41,12 @@ clickhouse: size: 25Gi auth: username: oneuptime - password: {{ randAlphaNum 16 | quote }} + password: please-change-this-to-random-value redis: architecture: standalone auth: - password: {{ randAlphaNum 16 | quote }} + password: please-change-this-to-random-value master: persistence: size: 25Gi @@ -107,20 +107,20 @@ statusPage: cnameRecord: secrets: - oneuptime: {{ randAlphaNum 16 | quote }} - encryption: {{ randAlphaNum 16 | quote }} + oneuptime: please-change-this-to-random-value + encryption: please-change-this-to-random-value probes: one: name: "Probe 1" description: "Probe 1" - key: {{ randAlphaNum 16 | quote }} + key: please-change-this-to-random-value monitoringWorkers: 3 monitorFetchLimit: 10 two: name: "Probe 2" description: "Probe 2" - key: {{ randAlphaNum 16 | quote }} + key: please-change-this-to-random-value monitoringWorkers: 3 monitorFetchLimit: 10 diff --git a/package.json b/package.json index afad84090c..961266dfca 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 --cache", "fix": "npm run fix-lint", - "start": "export $(grep -v '^#' config.env | xargs) && docker compose up --remove-orphans -d $npm_config_services && bash status-check.sh", + "start": "export $(grep -v '^#' config.env | xargs) && docker compose up --remove-orphans -d $npm_config_services && bash ./HelmChart/public/oneuptime/scriptsstatus-check.sh", "ps": "docker compose ps", "save-logs": "export $(grep -v '^#' config.env | xargs) && docker compose logs --tail=100000 $npm_config_services > logs.txt", "logs": "export $(grep -v '^#' config.env | xargs) && docker compose logs --tail=100 -f $npm_config_services", diff --git a/status-check.sh b/status-check.sh deleted file mode 100644 index e135a5cca2..0000000000 --- a/status-check.sh +++ /dev/null @@ -1,64 +0,0 @@ -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 Shortener Status..." -bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost/l/status)" != "200" ]]; do sleep 5; done' -echo "Link Shortener Server is up ✔️" - -echo "Checking Admin Dashboard Server Status..." -bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost/admin/status)" != "200" ]]; do sleep 5; done' -echo "Admin Dashboard 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