mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-04-06 08:42:13 +02:00
Compare commits
299 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
20f46177cb | ||
|
|
0453d995ba | ||
|
|
8ab7fbc95d | ||
|
|
2d99850596 | ||
|
|
c77b8e2d57 | ||
|
|
e12f73cebf | ||
|
|
0351480152 | ||
|
|
62e81bee06 | ||
|
|
11b500058e | ||
|
|
0b94b0ff70 | ||
|
|
9bd8275321 | ||
|
|
a25a1ed0b9 | ||
|
|
accffbe443 | ||
|
|
414bfdfec1 | ||
|
|
cc7037b549 | ||
|
|
725f41ef1b | ||
|
|
e7682c826d | ||
|
|
5347bc29ea | ||
|
|
aa975633dd | ||
|
|
199ef2b009 | ||
|
|
f0f690f24a | ||
|
|
ef43088692 | ||
|
|
8f36524583 | ||
|
|
d738d1378c | ||
|
|
b402450eac | ||
|
|
130d7b1af3 | ||
|
|
070fd415ae | ||
|
|
d8b6cf98fe | ||
|
|
3a8451aea3 | ||
|
|
0de056c4e9 | ||
|
|
8e02cf56ef | ||
|
|
1296707e0d | ||
|
|
80b848f757 | ||
|
|
4b2a9c74c0 | ||
|
|
62ed9583fc | ||
|
|
8a2f9f9913 | ||
|
|
1a1be22b16 | ||
|
|
7e48cb2451 | ||
|
|
8fc2f93e94 | ||
|
|
1892d06cec | ||
|
|
32960b90f8 | ||
|
|
7bd5efee1c | ||
|
|
f1b4214379 | ||
|
|
ff0314ae9b | ||
|
|
591c89a320 | ||
|
|
60b1f3bcc5 | ||
|
|
7e796dff42 | ||
|
|
34817a1066 | ||
|
|
45bdadde87 | ||
|
|
753e017efd | ||
|
|
6b80d76fda | ||
|
|
7daa955528 | ||
|
|
ff9117ab05 | ||
|
|
4405c5fe10 | ||
|
|
98a1ae95b8 | ||
|
|
bcc06324c3 | ||
|
|
d7f2432a0c | ||
|
|
e75c16b6f8 | ||
|
|
c13291c33c | ||
|
|
824fb68395 | ||
|
|
e0795f24fc | ||
|
|
0d178843e4 | ||
|
|
b6f8dbabc5 | ||
|
|
78e97b815d | ||
|
|
9ff18d6df5 | ||
|
|
9fec234b07 | ||
|
|
5fa633959f | ||
|
|
0b4373edcc | ||
|
|
be09a9354d | ||
|
|
d6549cd861 | ||
|
|
3ab1758f17 | ||
|
|
138a42326f | ||
|
|
c6689d2a36 | ||
|
|
3376c2cb96 | ||
|
|
d6e7b5840b | ||
|
|
0319e43a21 | ||
|
|
d9be0a76e3 | ||
|
|
75748274c1 | ||
|
|
08893110bb | ||
|
|
1140eb7270 | ||
|
|
b526306780 | ||
|
|
dc235464f4 | ||
|
|
f0413ac917 | ||
|
|
b00ce0e894 | ||
|
|
2c90d8c0be | ||
|
|
7ccb5fca6f | ||
|
|
b65d452632 | ||
|
|
c040d60da9 | ||
|
|
6fe40bc630 | ||
|
|
c85d9b8372 | ||
|
|
58cfe477c2 | ||
|
|
6d5cb57813 | ||
|
|
4761c747a4 | ||
|
|
7ca8d20c4d | ||
|
|
59a77c6c15 | ||
|
|
099af1f5fe | ||
|
|
d06c657a16 | ||
|
|
1d9abe8af0 | ||
|
|
9bf46fbcf1 | ||
|
|
91adc172bd | ||
|
|
2d4bb56ffa | ||
|
|
01b677ec77 | ||
|
|
ed7708ba7c | ||
|
|
1d7980f3ba | ||
|
|
43069791da | ||
|
|
ccedb52acd | ||
|
|
f0d69b8ca0 | ||
|
|
4359e8fa30 | ||
|
|
b1162446db | ||
|
|
cf80324382 | ||
|
|
f4e372cfce | ||
|
|
b47e95f836 | ||
|
|
e4af38dfa9 | ||
|
|
e51ed0edc0 | ||
|
|
746b396e4f | ||
|
|
1d08ffb130 | ||
|
|
231493b335 | ||
|
|
1cbd9d2d26 | ||
|
|
661e1b8b4d | ||
|
|
4a0ff353e6 | ||
|
|
36cbc22327 | ||
|
|
bbd57c917e | ||
|
|
f72d5550cf | ||
|
|
5920b97c6c | ||
|
|
2c8019bfc6 | ||
|
|
d3e3b7d918 | ||
|
|
f2d02c4a5a | ||
|
|
209ac74643 | ||
|
|
2a6cb19405 | ||
|
|
62db38520f | ||
|
|
31a41fed60 | ||
|
|
55fd9a87b9 | ||
|
|
91ed99f256 | ||
|
|
6f4963cdb0 | ||
|
|
9b6667e6c7 | ||
|
|
b42b93844b | ||
|
|
ca63e6fbfb | ||
|
|
515b8ba94c | ||
|
|
e9bdf80f84 | ||
|
|
31bcfc7531 | ||
|
|
4046da0523 | ||
|
|
e728501ddb | ||
|
|
c06c0f8b38 | ||
|
|
433e776d05 | ||
|
|
8e9a5a1077 | ||
|
|
8a892e643f | ||
|
|
7ea9f48089 | ||
|
|
6fd882afd4 | ||
|
|
917fb112d4 | ||
|
|
a02d5d420a | ||
|
|
35916a5836 | ||
|
|
df68a5e76a | ||
|
|
54462d4975 | ||
|
|
1441f3a345 | ||
|
|
41c6898d30 | ||
|
|
0d09047454 | ||
|
|
8a3b893521 | ||
|
|
0c13463c0d | ||
|
|
36860e6ee9 | ||
|
|
53efbaf7a0 | ||
|
|
8863c6a209 | ||
|
|
c069ae47a0 | ||
|
|
4c1e4ad1b2 | ||
|
|
82a1c3c93b | ||
|
|
52e4a1247f | ||
|
|
deec3cb6f4 | ||
|
|
2a6afd155f | ||
|
|
7bd6c14313 | ||
|
|
374a7e8267 | ||
|
|
4a1b6ce89e | ||
|
|
8a22320532 | ||
|
|
5634b7b586 | ||
|
|
a399648093 | ||
|
|
f927433fb7 | ||
|
|
55ca86efbd | ||
|
|
1be4e59319 | ||
|
|
c62b3568cd | ||
|
|
de3333f0e8 | ||
|
|
4c9e4cbb14 | ||
|
|
0d142a51a9 | ||
|
|
ef4a630c1b | ||
|
|
475da718b9 | ||
|
|
2d52cca8c3 | ||
|
|
0bb9ba47b8 | ||
|
|
2cf1b2f54b | ||
|
|
1e0444ee41 | ||
|
|
26aaee83b8 | ||
|
|
06a76ecc2b | ||
|
|
9867ef4824 | ||
|
|
c8a4ff73f3 | ||
|
|
623acf9212 | ||
|
|
4a9ef40d8f | ||
|
|
961034dd3f | ||
|
|
b7263ae132 | ||
|
|
0b3e45b8d9 | ||
|
|
5cf93f7173 | ||
|
|
e89db96254 | ||
|
|
663eb5ec6d | ||
|
|
b9a0c0297e | ||
|
|
264fcce55c | ||
|
|
32ed2f3183 | ||
|
|
4547fbe872 | ||
|
|
bb809874fd | ||
|
|
8e71d86651 | ||
|
|
85840ddeb4 | ||
|
|
799beb5303 | ||
|
|
9cfe6f49e0 | ||
|
|
f7cf41cab4 | ||
|
|
493e898647 | ||
|
|
f2f0e10ffe | ||
|
|
12c555dfe7 | ||
|
|
83bbd26eef | ||
|
|
55f8a32352 | ||
|
|
d7081c1bae | ||
|
|
6cd897c134 | ||
|
|
36cfc317a4 | ||
|
|
44f2b3ce13 | ||
|
|
f0dd4ec980 | ||
|
|
e4604b69e4 | ||
|
|
22bc05b32d | ||
|
|
9fe70fc864 | ||
|
|
24b9d301c8 | ||
|
|
5ad45237f5 | ||
|
|
b05cecc6b4 | ||
|
|
ab6ca0e52f | ||
|
|
3c15f2dc53 | ||
|
|
d96e00789c | ||
|
|
47ade5164c | ||
|
|
7f386e4c71 | ||
|
|
9ee710a16c | ||
|
|
3714c2c91a | ||
|
|
074c02729b | ||
|
|
1dc5584821 | ||
|
|
cf10f0df52 | ||
|
|
9893a7b8ad | ||
|
|
bbcdf93699 | ||
|
|
a001766d15 | ||
|
|
3576e86532 | ||
|
|
588ab1e925 | ||
|
|
f09260b374 | ||
|
|
43e75c342a | ||
|
|
08411211ab | ||
|
|
f510fdae5c | ||
|
|
0301f5ff42 | ||
|
|
013a49bd3a | ||
|
|
b4f2e738ea | ||
|
|
ac0bc23e1a | ||
|
|
666de177c8 | ||
|
|
99579677a1 | ||
|
|
8b25a006a9 | ||
|
|
5e82b0f158 | ||
|
|
b05294b386 | ||
|
|
984a77c9e7 | ||
|
|
864d0b3c00 | ||
|
|
14d22e5f12 | ||
|
|
614ba797b6 | ||
|
|
fcbe7fc5f0 | ||
|
|
9ce81a2704 | ||
|
|
88a997afaa | ||
|
|
7c5dc7b35c | ||
|
|
3dd150692a | ||
|
|
f09e129fd1 | ||
|
|
c9b15dcfc7 | ||
|
|
b039a5a045 | ||
|
|
3040b21484 | ||
|
|
af15c6f5f5 | ||
|
|
4c82c922e2 | ||
|
|
08f48ad082 | ||
|
|
34a8ea806d | ||
|
|
a70e98f802 | ||
|
|
ee1ec87781 | ||
|
|
f21de699dd | ||
|
|
b30f9a472a | ||
|
|
e7c54b369d | ||
|
|
53bf92fac0 | ||
|
|
6da56df5b1 | ||
|
|
931cccf86a | ||
|
|
027966cae3 | ||
|
|
f568473588 | ||
|
|
ada26e3cce | ||
|
|
15e2c9cef2 | ||
|
|
a091cd4faa | ||
|
|
1fa5604cdd | ||
|
|
d9ed5f579e | ||
|
|
0138e98506 | ||
|
|
2feb024032 | ||
|
|
55bf11bfd1 | ||
|
|
05d6dd2182 | ||
|
|
3595f5bf6f | ||
|
|
398c08854a | ||
|
|
af8d85f6d2 | ||
|
|
296dfd15d5 | ||
|
|
efc446edf1 | ||
|
|
8453d32a4f | ||
|
|
41a8ddb09a | ||
|
|
9f5fa3542a | ||
|
|
b801aba506 | ||
|
|
c6e5d642b5 | ||
|
|
e20229ca9d |
@@ -6,6 +6,7 @@ node_modules
|
||||
# dependencies
|
||||
/node_modules
|
||||
node_modules
|
||||
**/node_modules
|
||||
|
||||
.idea
|
||||
# testing
|
||||
|
||||
@@ -87,10 +87,11 @@
|
||||
],
|
||||
// https://www.npmjs.com/package/eslint-plugin-unused-imports
|
||||
"no-unused-vars": "off",
|
||||
"@typescript-eslint/no-unused-vars": "off",
|
||||
"@typescript-eslint/no-unused-vars": ["error", {"argsIgnorePattern": "^_"}],
|
||||
"@typescript-eslint/no-extra-non-null-assertion": "error",
|
||||
"@typescript-eslint/no-floating-promises":"error",
|
||||
"@typescript-eslint/await-thenable":"error",
|
||||
"@typescript-eslint/no-non-null-asserted-optional-chain": "error",
|
||||
"unused-imports/no-unused-imports": "error",
|
||||
"unused-imports/no-unused-vars": [
|
||||
"error",
|
||||
|
||||
20
.github/workflows/code-analysis.yml
vendored
20
.github/workflows/code-analysis.yml
vendored
@@ -1,20 +0,0 @@
|
||||
name: Code Analysis
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
types: [opened, synchronize, reopened]
|
||||
jobs:
|
||||
sonarcloud:
|
||||
name: SonarCloud
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
|
||||
- name: SonarCloud Scan
|
||||
uses: SonarSource/sonarcloud-github-action@master
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
|
||||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
||||
2
.github/workflows/codeql-analysis.yml
vendored
2
.github/workflows/codeql-analysis.yml
vendored
@@ -40,7 +40,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
|
||||
16
.github/workflows/common-jobs.yaml
vendored
16
.github/workflows/common-jobs.yaml
vendored
@@ -8,7 +8,21 @@ on:
|
||||
- 'release'
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
helm-lint:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
CI_PIPELINE_ID: ${{github.run_number}}
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v2
|
||||
- name: Install Helm
|
||||
run: |
|
||||
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
|
||||
- name: Lint Helm Chart
|
||||
run: |
|
||||
helm lint ./HelmChart/Public/oneuptime
|
||||
|
||||
js-lint:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
CI_PIPELINE_ID: ${{github.run_number}}
|
||||
|
||||
32
.github/workflows/compile.yml
vendored
32
.github/workflows/compile.yml
vendored
@@ -151,20 +151,6 @@ jobs:
|
||||
- run: cd CommonServer && npm install
|
||||
- run: cd File && npm install && npm run compile
|
||||
|
||||
compile-helm-chart:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
CI_PIPELINE_ID: ${{github.run_number}}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 18.3.0
|
||||
- run: cd Common && npm install
|
||||
- run: cd Model && npm install
|
||||
- run: cd CommonServer && npm install
|
||||
- run: cd HelmChart && npm install && npm run compile
|
||||
|
||||
compile-home:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
@@ -207,20 +193,6 @@ jobs:
|
||||
- run: cd CommonServer && npm install
|
||||
- run: cd Integration && npm install && npm run compile
|
||||
|
||||
compile-licensing:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
CI_PIPELINE_ID: ${{github.run_number}}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 18.3.0
|
||||
- run: cd Common && npm install
|
||||
- run: cd Model && npm install
|
||||
- run: cd CommonServer && npm install
|
||||
- run: cd Licensing && npm install && npm run compile
|
||||
|
||||
compile-notification:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
@@ -262,7 +234,7 @@ jobs:
|
||||
- run: cd CommonServer && npm install
|
||||
- run: cd Probe && npm install && npm run compile
|
||||
|
||||
compile-probe-api:
|
||||
compile-ingestor:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
CI_PIPELINE_ID: ${{github.run_number}}
|
||||
@@ -274,7 +246,7 @@ jobs:
|
||||
- run: cd Common && npm install
|
||||
- run: cd Model && npm install
|
||||
- run: cd CommonServer && npm install
|
||||
- run: cd ProbeAPI && npm install && npm run compile
|
||||
- run: cd Ingestor && npm install && npm run compile
|
||||
|
||||
|
||||
compile-realtime:
|
||||
|
||||
49
.github/workflows/docker-build.yml
vendored
49
.github/workflows/docker-build.yml
vendored
@@ -40,6 +40,21 @@ jobs:
|
||||
- name: build docker image
|
||||
run: sudo docker build -f ./LinkShortener/Dockerfile .
|
||||
|
||||
docker-build-otel-collector:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
CI_PIPELINE_ID: ${{github.run_number}}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Preinstall
|
||||
run: npm run prerun
|
||||
|
||||
# build image for accounts service
|
||||
- name: build docker image
|
||||
run: sudo docker build -f ./OTelCollector/Dockerfile .
|
||||
|
||||
docker-build-api-reference:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
@@ -131,20 +146,6 @@ jobs:
|
||||
- name: build docker image
|
||||
run: sudo docker build -f ./Haraka/Dockerfile .
|
||||
|
||||
docker-build-helm-chart:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
CI_PIPELINE_ID: ${{github.run_number}}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Preinstall
|
||||
run: npm run prerun
|
||||
|
||||
# build image for home
|
||||
- name: build docker image
|
||||
run: sudo docker build -f ./HelmChart/Dockerfile .
|
||||
|
||||
docker-build-home:
|
||||
runs-on: ubuntu-latest
|
||||
@@ -187,24 +188,10 @@ jobs:
|
||||
- name: Preinstall
|
||||
run: npm run prerun
|
||||
|
||||
# build image for licensing
|
||||
# build image for integrations
|
||||
- name: build docker image
|
||||
run: sudo docker build -f ./Integration/Dockerfile .
|
||||
|
||||
docker-build-licensing:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
CI_PIPELINE_ID: ${{github.run_number}}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Preinstall
|
||||
run: npm run prerun
|
||||
|
||||
# build image for licensing
|
||||
- name: build docker image
|
||||
run: sudo docker build -f ./Licensing/Dockerfile .
|
||||
|
||||
docker-build-notification:
|
||||
runs-on: ubuntu-latest
|
||||
@@ -237,7 +224,7 @@ jobs:
|
||||
- name: build docker image
|
||||
run: sudo docker build -f ./Probe/Dockerfile .
|
||||
|
||||
docker-build-probe-api:
|
||||
docker-build-ingestor:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
CI_PIPELINE_ID: ${{github.run_number}}
|
||||
@@ -250,7 +237,7 @@ jobs:
|
||||
|
||||
# build image probe api
|
||||
- name: build docker image
|
||||
run: sudo docker build -f ./ProbeAPI/Dockerfile .
|
||||
run: sudo docker build -f ./Ingestor/Dockerfile .
|
||||
|
||||
docker-build-realtime:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
2
.github/workflows/playwright.yml.skip
vendored
2
.github/workflows/playwright.yml.skip
vendored
@@ -11,7 +11,7 @@ jobs:
|
||||
env:
|
||||
BASE_URL: http://localhost
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 16
|
||||
|
||||
341
.github/workflows/release.yml
vendored
341
.github/workflows/release.yml
vendored
@@ -25,7 +25,7 @@ jobs:
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
- run: echo "${{needs.generate-build-number.outputs.build_number}}"
|
||||
@@ -39,6 +39,54 @@ jobs:
|
||||
body: |
|
||||
${{steps.build_changelog.outputs.changelog}}
|
||||
|
||||
|
||||
helm-chart-deploy:
|
||||
runs-on: ubuntu-latest
|
||||
needs: generate-build-number
|
||||
env:
|
||||
CI_COMMIT_AUTHOR: Continuous Integration
|
||||
steps:
|
||||
|
||||
- name: Install Helm
|
||||
run: curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
- name: Build and Package Helm chart
|
||||
run: |
|
||||
cd ..
|
||||
echo '${{ secrets.GPG_PRIVATE_KEY }}' > private.key
|
||||
gpg --import private.key || true
|
||||
rm private.key
|
||||
echo "GPG key imported successfully"
|
||||
gpg --export-secret-keys >~/.gnupg/secring.gpg
|
||||
echo "GPG key exported successfully"
|
||||
eval `ssh-agent -s`
|
||||
ssh-add - <<< '${{ secrets.HELM_CHART_GITHUB_REPO_DEPLOY_KEY }}'
|
||||
git clone git@github.com:OneUptime/helm-chart.git
|
||||
cd oneuptime/HelmChart/Public
|
||||
helm lint oneuptime
|
||||
helm package --sign --key 'key@oneuptime.com' --keyring ~/.gnupg/secring.gpg oneuptime --version 7.0.${{needs.generate-build-number.outputs.build_number}} --app-version 7.0.${{needs.generate-build-number.outputs.build_number}}
|
||||
echo "Helm Chart Package created successfully"
|
||||
cd ..
|
||||
ls
|
||||
echo "Copying the package to helm-chart repo"
|
||||
rm -r ../../helm-chart/oneuptime
|
||||
cp -r ./Public/* ../../helm-chart
|
||||
echo "Package copied successfully"
|
||||
cd .. && cd .. && cd helm-chart
|
||||
echo "Updating helm-chart repo"
|
||||
git config --global user.name "${{ env.CI_COMMIT_AUTHOR }}"
|
||||
git config --global user.email "hello@oneuptime.com"
|
||||
echo "Git config set successfully"
|
||||
echo "Adding the package to helm-chart repo"
|
||||
helm repo index .
|
||||
git add -A
|
||||
git commit -m "Helm Chart Release 7.0.${{needs.generate-build-number.outputs.build_number}}"
|
||||
git push origin master
|
||||
|
||||
nginx-docker-image-deploy:
|
||||
needs: generate-build-number
|
||||
runs-on: ubuntu-latest
|
||||
@@ -54,7 +102,7 @@ jobs:
|
||||
type=raw,value=release,enable=true
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}},pattern={{version}},enable=true
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
@@ -114,7 +162,7 @@ jobs:
|
||||
type=raw,value=release,enable=true
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}},pattern={{version}},enable=true
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
@@ -159,6 +207,68 @@ jobs:
|
||||
GIT_SHA=${{ github.sha }}
|
||||
APP_VERSION=7.0.${{needs.generate-build-number.outputs.build_number}}
|
||||
|
||||
otel-collector-docker-image-deploy:
|
||||
needs: generate-build-number
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Docker Meta
|
||||
id: meta
|
||||
uses: docker/metadata-action@v4
|
||||
with:
|
||||
images: |
|
||||
oneuptime/otel-collector
|
||||
ghcr.io/oneuptime/otel-collector
|
||||
tags: |
|
||||
type=raw,value=release,enable=true
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}},pattern={{version}},enable=true
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 18.3.0
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Generate Dockerfile from Dockerfile.tpl
|
||||
run: npm run prerun
|
||||
|
||||
# Build and deploy otel-collector.
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v2.2.0
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v2.2.0
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
file: ./OTelCollector/Dockerfile
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
build-args: |
|
||||
GIT_SHA=${{ github.sha }}
|
||||
APP_VERSION=7.0.${{needs.generate-build-number.outputs.build_number}}
|
||||
|
||||
|
||||
|
||||
workflow-docker-image-deploy:
|
||||
needs: generate-build-number
|
||||
runs-on: ubuntu-latest
|
||||
@@ -174,7 +284,7 @@ jobs:
|
||||
type=raw,value=release,enable=true
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}},pattern={{version}},enable=true
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
@@ -234,7 +344,7 @@ jobs:
|
||||
type=raw,value=release,enable=true
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}},pattern={{version}},enable=true
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
@@ -294,7 +404,7 @@ jobs:
|
||||
type=raw,value=release,enable=true
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}},pattern={{version}},enable=true
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
@@ -354,7 +464,7 @@ jobs:
|
||||
type=raw,value=release,enable=true
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}},pattern={{version}},enable=true
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
@@ -399,6 +509,66 @@ jobs:
|
||||
GIT_SHA=${{ github.sha }}
|
||||
APP_VERSION=7.0.${{needs.generate-build-number.outputs.build_number}}
|
||||
|
||||
test-docker-image-deploy:
|
||||
needs: generate-build-number
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Docker Meta
|
||||
id: meta
|
||||
uses: docker/metadata-action@v4
|
||||
with:
|
||||
images: |
|
||||
oneuptime/test
|
||||
ghcr.io/oneuptime/test
|
||||
tags: |
|
||||
type=raw,value=release,enable=true
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}},pattern={{version}},enable=true
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 18.3.0
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Generate Dockerfile from Dockerfile.tpl
|
||||
run: npm run prerun
|
||||
|
||||
# Build and deploy test.
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v2.2.0
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v2.2.0
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
file: ./Tests/Dockerfile
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
build-args: |
|
||||
GIT_SHA=${{ github.sha }}
|
||||
APP_VERSION=7.0.${{needs.generate-build-number.outputs.build_number}}
|
||||
|
||||
realtime-docker-image-deploy:
|
||||
needs: generate-build-number
|
||||
runs-on: ubuntu-latest
|
||||
@@ -414,7 +584,7 @@ jobs:
|
||||
type=raw,value=release,enable=true
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}},pattern={{version}},enable=true
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
@@ -459,7 +629,7 @@ jobs:
|
||||
GIT_SHA=${{ github.sha }}
|
||||
APP_VERSION=7.0.${{needs.generate-build-number.outputs.build_number}}
|
||||
|
||||
probe-api-docker-image-deploy:
|
||||
ingestor-docker-image-deploy:
|
||||
needs: generate-build-number
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
@@ -468,13 +638,13 @@ jobs:
|
||||
uses: docker/metadata-action@v4
|
||||
with:
|
||||
images: |
|
||||
oneuptime/probe-api
|
||||
ghcr.io/oneuptime/probe-api
|
||||
oneuptime/ingestor
|
||||
ghcr.io/oneuptime/ingestor
|
||||
tags: |
|
||||
type=raw,value=release,enable=true
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}},pattern={{version}},enable=true
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
@@ -491,7 +661,7 @@ jobs:
|
||||
- name: Generate Dockerfile from Dockerfile.tpl
|
||||
run: npm run prerun
|
||||
|
||||
# Build and deploy probe-api.
|
||||
# Build and deploy ingestor.
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v2.2.0
|
||||
@@ -509,7 +679,7 @@ jobs:
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
file: ./ProbeAPI/Dockerfile
|
||||
file: ./Ingestor/Dockerfile
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
@@ -534,7 +704,7 @@ jobs:
|
||||
type=raw,value=release,enable=true
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}},pattern={{version}},enable=true
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
@@ -579,66 +749,6 @@ jobs:
|
||||
GIT_SHA=${{ github.sha }}
|
||||
APP_VERSION=7.0.${{needs.generate-build-number.outputs.build_number}}
|
||||
|
||||
licensing-docker-image-deploy:
|
||||
needs: generate-build-number
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Docker Meta
|
||||
id: meta
|
||||
uses: docker/metadata-action@v4
|
||||
with:
|
||||
images: |
|
||||
oneuptime/licensing
|
||||
ghcr.io/oneuptime/licensing
|
||||
tags: |
|
||||
type=raw,value=release,enable=true
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}},pattern={{version}},enable=true
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 18.3.0
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Generate Dockerfile from Dockerfile.tpl
|
||||
run: npm run prerun
|
||||
|
||||
# Build and deploy licensing.
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v2.2.0
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v2.2.0
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
file: ./Licensing/Dockerfile
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
build-args: |
|
||||
GIT_SHA=${{ github.sha }}
|
||||
APP_VERSION=7.0.${{needs.generate-build-number.outputs.build_number}}
|
||||
|
||||
integrations-docker-image-deploy:
|
||||
needs: generate-build-number
|
||||
runs-on: ubuntu-latest
|
||||
@@ -654,7 +764,7 @@ jobs:
|
||||
type=raw,value=release,enable=true
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}},pattern={{version}},enable=true
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
@@ -714,7 +824,7 @@ jobs:
|
||||
type=raw,value=release,enable=true
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}},pattern={{version}},enable=true
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
@@ -774,7 +884,7 @@ jobs:
|
||||
type=raw,value=release,enable=true
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}},pattern={{version}},enable=true
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
@@ -834,7 +944,7 @@ jobs:
|
||||
type=raw,value=release,enable=true
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}},pattern={{version}},enable=true
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
@@ -879,65 +989,6 @@ jobs:
|
||||
GIT_SHA=${{ github.sha }}
|
||||
APP_VERSION=7.0.${{needs.generate-build-number.outputs.build_number}}
|
||||
|
||||
helm-chart-docker-image-deploy:
|
||||
needs: generate-build-number
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Docker Meta
|
||||
id: meta
|
||||
uses: docker/metadata-action@v4
|
||||
with:
|
||||
images: |
|
||||
oneuptime/helm-chart
|
||||
ghcr.io/oneuptime/helm-chart
|
||||
tags: |
|
||||
type=raw,value=release,enable=true
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}},pattern={{version}},enable=true
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 18.3.0
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Generate Dockerfile from Dockerfile.tpl
|
||||
run: npm run prerun
|
||||
|
||||
# Build and deploy helm-chart.
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v2.2.0
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v2.2.0
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
file: ./HelmChart/Dockerfile
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
build-args: |
|
||||
GIT_SHA=${{ github.sha }}
|
||||
APP_VERSION=7.0.${{needs.generate-build-number.outputs.build_number}}
|
||||
|
||||
haraka-docker-image-deploy:
|
||||
needs: generate-build-number
|
||||
@@ -954,7 +1005,7 @@ jobs:
|
||||
type=raw,value=release,enable=true
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}},pattern={{version}},enable=true
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
@@ -1014,7 +1065,7 @@ jobs:
|
||||
type=raw,value=release,enable=true
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}},pattern={{version}},enable=true
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
@@ -1075,7 +1126,7 @@ jobs:
|
||||
type=raw,value=release,enable=true
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}},pattern={{version}},enable=true
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
@@ -1136,7 +1187,7 @@ jobs:
|
||||
type=raw,value=release,enable=true
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}},pattern={{version}},enable=true
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
@@ -1196,7 +1247,7 @@ jobs:
|
||||
type=raw,value=release,enable=true
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}},pattern={{version}},enable=true
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
@@ -1256,7 +1307,7 @@ jobs:
|
||||
type=raw,value=release,enable=true
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}},pattern={{version}},enable=true
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
@@ -1316,7 +1367,7 @@ jobs:
|
||||
type=raw,value=release,enable=true
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}},pattern={{version}},enable=true
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
|
||||
297
.github/workflows/test-release.yaml
vendored
297
.github/workflows/test-release.yaml
vendored
@@ -35,7 +35,7 @@ jobs:
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}}-test,pattern={{version}},enable=true
|
||||
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
@@ -96,7 +96,7 @@ jobs:
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}}-test,pattern={{version}},enable=true
|
||||
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
@@ -157,7 +157,7 @@ jobs:
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}}-test,pattern={{version}},enable=true
|
||||
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
@@ -202,6 +202,69 @@ jobs:
|
||||
GIT_SHA=${{ github.sha }}
|
||||
APP_VERSION=7.0.${{needs.generate-build-number.outputs.build_number}}
|
||||
|
||||
|
||||
|
||||
otel-collector-docker-image-deploy:
|
||||
needs: generate-build-number
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Docker Meta
|
||||
id: meta
|
||||
uses: docker/metadata-action@v4
|
||||
with:
|
||||
images: |
|
||||
oneuptime/otel-collector
|
||||
ghcr.io/oneuptime/otel-collector
|
||||
tags: |
|
||||
type=raw,value=test,enable=true
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}}-test,pattern={{version}},enable=true
|
||||
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 18.3.0
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Generate Dockerfile from Dockerfile.tpl
|
||||
run: npm run prerun
|
||||
|
||||
# Build and deploy otel-collector.
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v2.2.0
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v2.2.0
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
file: ./OTelCollector/Dockerfile
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
build-args: |
|
||||
GIT_SHA=${{ github.sha }}
|
||||
APP_VERSION=7.0.${{needs.generate-build-number.outputs.build_number}}
|
||||
|
||||
link-shortener-docker-image-deploy:
|
||||
needs: generate-build-number
|
||||
runs-on: ubuntu-latest
|
||||
@@ -218,7 +281,7 @@ jobs:
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}}-test,pattern={{version}},enable=true
|
||||
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
@@ -279,7 +342,7 @@ jobs:
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}}-test,pattern={{version}},enable=true
|
||||
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
@@ -340,7 +403,7 @@ jobs:
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}}-test,pattern={{version}},enable=true
|
||||
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
@@ -385,6 +448,69 @@ jobs:
|
||||
GIT_SHA=${{ github.sha }}
|
||||
APP_VERSION=7.0.${{needs.generate-build-number.outputs.build_number}}
|
||||
|
||||
|
||||
|
||||
test-docker-image-deploy:
|
||||
needs: generate-build-number
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Docker Meta
|
||||
id: meta
|
||||
uses: docker/metadata-action@v4
|
||||
with:
|
||||
images: |
|
||||
oneuptime/test
|
||||
ghcr.io/oneuptime/test
|
||||
tags: |
|
||||
type=raw,value=test,enable=true
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}}-test,pattern={{version}},enable=true
|
||||
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 18.3.0
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Generate Dockerfile from Dockerfile.tpl
|
||||
run: npm run prerun
|
||||
|
||||
# Build and deploy test.
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v2.2.0
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v2.2.0
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
file: ./Tests/Dockerfile
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
build-args: |
|
||||
GIT_SHA=${{ github.sha }}
|
||||
APP_VERSION=7.0.${{needs.generate-build-number.outputs.build_number}}
|
||||
|
||||
realtime-docker-image-deploy:
|
||||
needs: generate-build-number
|
||||
runs-on: ubuntu-latest
|
||||
@@ -401,7 +527,7 @@ jobs:
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}}-test,pattern={{version}},enable=true
|
||||
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
@@ -446,7 +572,7 @@ jobs:
|
||||
GIT_SHA=${{ github.sha }}
|
||||
APP_VERSION=7.0.${{needs.generate-build-number.outputs.build_number}}
|
||||
|
||||
probe-api-docker-image-deploy:
|
||||
ingestor-docker-image-deploy:
|
||||
needs: generate-build-number
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
@@ -455,14 +581,14 @@ jobs:
|
||||
uses: docker/metadata-action@v4
|
||||
with:
|
||||
images: |
|
||||
oneuptime/probe-api
|
||||
ghcr.io/oneuptime/probe-api
|
||||
oneuptime/ingestor
|
||||
ghcr.io/oneuptime/ingestor
|
||||
tags: |
|
||||
type=raw,value=test,enable=true
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}}-test,pattern={{version}},enable=true
|
||||
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
@@ -479,7 +605,7 @@ jobs:
|
||||
- name: Generate Dockerfile from Dockerfile.tpl
|
||||
run: npm run prerun
|
||||
|
||||
# Build and deploy probe-api.
|
||||
# Build and deploy ingestor.
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v2.2.0
|
||||
@@ -497,7 +623,7 @@ jobs:
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
file: ./ProbeAPI/Dockerfile
|
||||
file: ./Ingestor/Dockerfile
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
@@ -523,7 +649,7 @@ jobs:
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}}-test,pattern={{version}},enable=true
|
||||
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
@@ -568,67 +694,6 @@ jobs:
|
||||
GIT_SHA=${{ github.sha }}
|
||||
APP_VERSION=7.0.${{needs.generate-build-number.outputs.build_number}}
|
||||
|
||||
licensing-docker-image-deploy:
|
||||
needs: generate-build-number
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Docker Meta
|
||||
id: meta
|
||||
uses: docker/metadata-action@v4
|
||||
with:
|
||||
images: |
|
||||
oneuptime/licensing
|
||||
ghcr.io/oneuptime/licensing
|
||||
tags: |
|
||||
type=raw,value=test,enable=true
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}}-test,pattern={{version}},enable=true
|
||||
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 18.3.0
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Generate Dockerfile from Dockerfile.tpl
|
||||
run: npm run prerun
|
||||
|
||||
# Build and deploy licensing.
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v2.2.0
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v2.2.0
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
file: ./Licensing/Dockerfile
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
build-args: |
|
||||
GIT_SHA=${{ github.sha }}
|
||||
APP_VERSION=7.0.${{needs.generate-build-number.outputs.build_number}}
|
||||
|
||||
integrations-docker-image-deploy:
|
||||
needs: generate-build-number
|
||||
runs-on: ubuntu-latest
|
||||
@@ -645,7 +710,7 @@ jobs:
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}}-test,pattern={{version}},enable=true
|
||||
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
@@ -706,7 +771,7 @@ jobs:
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}}-test,pattern={{version}},enable=true
|
||||
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
@@ -767,7 +832,7 @@ jobs:
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}}-test,pattern={{version}},enable=true
|
||||
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
@@ -828,7 +893,7 @@ jobs:
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}}-test,pattern={{version}},enable=true
|
||||
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
@@ -873,66 +938,6 @@ jobs:
|
||||
GIT_SHA=${{ github.sha }}
|
||||
APP_VERSION=7.0.${{needs.generate-build-number.outputs.build_number}}
|
||||
|
||||
helm-chart-docker-image-deploy:
|
||||
needs: generate-build-number
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Docker Meta
|
||||
id: meta
|
||||
uses: docker/metadata-action@v4
|
||||
with:
|
||||
images: |
|
||||
oneuptime/helm-chart
|
||||
ghcr.io/oneuptime/helm-chart
|
||||
tags: |
|
||||
type=raw,value=test,enable=true
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}}-test,pattern={{version}},enable=true
|
||||
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 18.3.0
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Generate Dockerfile from Dockerfile.tpl
|
||||
run: npm run prerun
|
||||
|
||||
# Build and deploy helm-chart.
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v2.2.0
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v2.2.0
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
file: ./HelmChart/Dockerfile
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
build-args: |
|
||||
GIT_SHA=${{ github.sha }}
|
||||
APP_VERSION=7.0.${{needs.generate-build-number.outputs.build_number}}
|
||||
|
||||
haraka-docker-image-deploy:
|
||||
needs: generate-build-number
|
||||
@@ -950,7 +955,7 @@ jobs:
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}}-test,pattern={{version}},enable=true
|
||||
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
@@ -1011,7 +1016,7 @@ jobs:
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}}-test,pattern={{version}},enable=true
|
||||
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
@@ -1072,7 +1077,7 @@ jobs:
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}}-test,pattern={{version}},enable=true
|
||||
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
@@ -1133,7 +1138,7 @@ jobs:
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}}-test,pattern={{version}},enable=true
|
||||
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
@@ -1194,7 +1199,7 @@ jobs:
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}}-test,pattern={{version}},enable=true
|
||||
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
@@ -1255,7 +1260,7 @@ jobs:
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}}-test,pattern={{version}},enable=true
|
||||
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
@@ -1316,7 +1321,7 @@ jobs:
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}}-test,pattern={{version}},enable=true
|
||||
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
|
||||
2
.github/workflows/test.probe-api.yaml
vendored
2
.github/workflows/test.probe-api.yaml
vendored
@@ -17,5 +17,5 @@ jobs:
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 18.3.0
|
||||
- run: cd ProbeAPI && npm install && npm run test
|
||||
- run: cd Ingestor && npm install && npm run test
|
||||
|
||||
|
||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -90,3 +90,5 @@ Haraka/dkim/keys/private_base64.txt
|
||||
Haraka/dkim/keys/public_base64.txt
|
||||
|
||||
.eslintcache
|
||||
|
||||
HelmChart/Values/*.values.yaml
|
||||
|
||||
20
.vscode/launch.json
vendored
20
.vscode/launch.json
vendored
@@ -99,8 +99,8 @@
|
||||
},
|
||||
{
|
||||
"address": "127.0.0.1",
|
||||
"localRoot": "${workspaceFolder}/ProbeAPI",
|
||||
"name": "Probe API: Debug with Docker",
|
||||
"localRoot": "${workspaceFolder}/Ingestor",
|
||||
"name": "Ingestor: Debug with Docker",
|
||||
"port": 9932,
|
||||
"remoteRoot": "/usr/src/app",
|
||||
"request": "attach",
|
||||
@@ -125,20 +125,6 @@
|
||||
"restart": true,
|
||||
"autoAttachChildProcesses": true
|
||||
},
|
||||
{
|
||||
"address": "127.0.0.1",
|
||||
"localRoot": "${workspaceFolder}/data-ingestor",
|
||||
"name": "Data Ingestor: Debug with Docker",
|
||||
"port": 9338,
|
||||
"remoteRoot": "/usr/src/app",
|
||||
"request": "attach",
|
||||
"skipFiles": [
|
||||
"<node_internals>/**"
|
||||
],
|
||||
"type": "node",
|
||||
"restart": true,
|
||||
"autoAttachChildProcesses": true
|
||||
},
|
||||
{
|
||||
"address": "127.0.0.1",
|
||||
"localRoot": "${workspaceFolder}/Notification",
|
||||
@@ -197,7 +183,7 @@
|
||||
},
|
||||
{
|
||||
"address": "127.0.0.1",
|
||||
"localRoot": "${workspaceFolder}/ProbeAPI",
|
||||
"localRoot": "${workspaceFolder}/Ingestor",
|
||||
"name": "Probe API: Debug with Docker",
|
||||
"port": 9251,
|
||||
"remoteRoot": "/usr/src/app",
|
||||
|
||||
@@ -3,12 +3,10 @@
|
||||
#
|
||||
|
||||
# Pull base image nodejs image.
|
||||
FROM node:current-alpine AS base
|
||||
FROM node:current-alpine
|
||||
USER root
|
||||
RUN mkdir /tmp/npm && chmod 2777 /tmp/npm && chown 1000:1000 /tmp/npm && npm config set cache /tmp/npm --global
|
||||
|
||||
RUN npm config set fetch-retry-maxtimeout 6000000
|
||||
RUN npm config set fetch-retry-mintimeout 1000000
|
||||
|
||||
ARG GIT_SHA
|
||||
ARG APP_VERSION
|
||||
@@ -26,9 +24,6 @@ SHELL ["/bin/bash", "-c"]
|
||||
|
||||
RUN mkdir /usr/src
|
||||
|
||||
# Install common
|
||||
|
||||
FROM base AS common
|
||||
WORKDIR /usr/src/Common
|
||||
COPY ./Common/package*.json /usr/src/Common/
|
||||
RUN npm install
|
||||
@@ -36,9 +31,6 @@ COPY ./Common /usr/src/Common
|
||||
|
||||
|
||||
|
||||
# Install Model
|
||||
|
||||
FROM base AS model
|
||||
WORKDIR /usr/src/Model
|
||||
COPY ./Model/package*.json /usr/src/Model/
|
||||
RUN npm install
|
||||
@@ -46,9 +38,6 @@ COPY ./Model /usr/src/Model
|
||||
|
||||
|
||||
|
||||
# Install CommonServer
|
||||
|
||||
FROM base AS commonserver
|
||||
WORKDIR /usr/src/CommonServer
|
||||
COPY ./CommonServer/package*.json /usr/src/CommonServer/
|
||||
RUN npm install
|
||||
@@ -59,7 +48,6 @@ COPY ./CommonServer /usr/src/CommonServer
|
||||
|
||||
# Install CommonUI
|
||||
|
||||
FROM base AS commonui
|
||||
WORKDIR /usr/src/CommonUI
|
||||
COPY ./CommonUI/package*.json /usr/src/CommonUI/
|
||||
RUN npm install --force
|
||||
@@ -67,22 +55,6 @@ COPY ./CommonUI /usr/src/CommonUI
|
||||
|
||||
|
||||
|
||||
#SET ENV Variables
|
||||
# Install app
|
||||
FROM base AS app
|
||||
|
||||
WORKDIR /usr/src/Common
|
||||
COPY --from=common /usr/src/Common .
|
||||
|
||||
WORKDIR /usr/src/Model
|
||||
COPY --from=model /usr/src/Model .
|
||||
|
||||
WORKDIR /usr/src/CommonServer
|
||||
COPY --from=commonserver /usr/src/CommonServer .
|
||||
|
||||
WORKDIR /usr/src/CommonUI
|
||||
COPY --from=commonui /usr/src/CommonUI .
|
||||
|
||||
|
||||
ENV PRODUCTION=true
|
||||
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
|
||||
|
||||
@@ -14,11 +14,14 @@ const init: () => Promise<void> = async (): Promise<void> => {
|
||||
} catch (err) {
|
||||
logger.error('App Init Failed:');
|
||||
logger.error(err);
|
||||
throw err;
|
||||
}
|
||||
};
|
||||
|
||||
init().catch((err: Error) => {
|
||||
logger.error(err);
|
||||
logger.info('Exiting node process');
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
export default app;
|
||||
|
||||
@@ -108,16 +108,7 @@
|
||||
<!-- End Google Tag Manager (noscript) -->
|
||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||
<div id="root"></div>
|
||||
<!--
|
||||
This HTML file is a template.
|
||||
If you open it directly in the browser, you will see an empty page.
|
||||
|
||||
You can add webfonts, meta tags, or analytics to this file.
|
||||
The build step will place the bundled scripts into the <body> tag.
|
||||
|
||||
To begin the development, run `npm start` or `yarn start`.
|
||||
To create a production bundle, use `npm run build` or `yarn build`.
|
||||
-->
|
||||
<script src="/accounts/dist/bundle.js"></script>
|
||||
<script>
|
||||
tailwind.config = {
|
||||
|
||||
@@ -107,7 +107,7 @@ const LoginPage: () => JSX.Element = () => {
|
||||
maxPrimaryButtonWidth={true}
|
||||
footer={
|
||||
<div className="actions pointer text-center mt-4 hover:underline fw-semibold">
|
||||
<p>
|
||||
<div>
|
||||
{!showSsoTip && (
|
||||
<div
|
||||
onClick={() => {
|
||||
@@ -128,13 +128,13 @@ const LoginPage: () => JSX.Element = () => {
|
||||
your project.
|
||||
</div>
|
||||
)}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
<div className="mt-10 text-center">
|
||||
<p className="text-muted mb-0 text-gray-500">
|
||||
<div className="text-muted mb-0 text-gray-500">
|
||||
Don't have an account?{' '}
|
||||
<Link
|
||||
to={new Route('/accounts/register')}
|
||||
@@ -142,7 +142,7 @@ const LoginPage: () => JSX.Element = () => {
|
||||
>
|
||||
Register.
|
||||
</Link>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -16,14 +16,15 @@ export default abstract class LoginUtil {
|
||||
User
|
||||
) as User;
|
||||
|
||||
const token: string = value['token'] as string;
|
||||
|
||||
UserUtil.setAccessToken(token);
|
||||
UserUtil.setEmail(user.email as Email);
|
||||
UserUtil.setUserId(user.id as ObjectID);
|
||||
UserUtil.setName(user.name as Name);
|
||||
UserUtil.setName(user.name || new Name(''));
|
||||
UserUtil.setIsMasterAdmin(user.isMasterAdmin as boolean);
|
||||
|
||||
if (user.profilePictureId) {
|
||||
UserUtil.setProfilePicId(user.profilePictureId);
|
||||
}
|
||||
|
||||
Analytics.userAuth(user.email!);
|
||||
|
||||
// go to dashboard, user should be logged in.
|
||||
|
||||
@@ -3,12 +3,10 @@
|
||||
#
|
||||
|
||||
# Pull base image nodejs image.
|
||||
FROM node:current-alpine AS base
|
||||
FROM node:current-alpine
|
||||
USER root
|
||||
RUN mkdir /tmp/npm && chmod 2777 /tmp/npm && chown 1000:1000 /tmp/npm && npm config set cache /tmp/npm --global
|
||||
|
||||
RUN npm config set fetch-retry-maxtimeout 6000000
|
||||
RUN npm config set fetch-retry-mintimeout 1000000
|
||||
|
||||
ARG GIT_SHA
|
||||
ARG APP_VERSION
|
||||
@@ -26,18 +24,12 @@ SHELL ["/bin/bash", "-c"]
|
||||
|
||||
RUN mkdir /usr/src
|
||||
|
||||
# Install common
|
||||
|
||||
FROM base AS common
|
||||
WORKDIR /usr/src/Common
|
||||
COPY ./Common/package*.json /usr/src/Common/
|
||||
RUN npm install
|
||||
COPY ./Common /usr/src/Common
|
||||
|
||||
|
||||
# Install Model
|
||||
|
||||
FROM base AS model
|
||||
WORKDIR /usr/src/Model
|
||||
COPY ./Model/package*.json /usr/src/Model/
|
||||
RUN npm install
|
||||
@@ -45,9 +37,6 @@ COPY ./Model /usr/src/Model
|
||||
|
||||
|
||||
|
||||
# Install CommonServer
|
||||
|
||||
FROM base AS commonserver
|
||||
WORKDIR /usr/src/CommonServer
|
||||
COPY ./CommonServer/package*.json /usr/src/CommonServer/
|
||||
RUN npm install
|
||||
@@ -58,29 +47,12 @@ COPY ./CommonServer /usr/src/CommonServer
|
||||
|
||||
# Install CommonUI
|
||||
|
||||
FROM base AS commonui
|
||||
WORKDIR /usr/src/CommonUI
|
||||
COPY ./CommonUI/package*.json /usr/src/CommonUI/
|
||||
RUN npm install --force
|
||||
COPY ./CommonUI /usr/src/CommonUI
|
||||
|
||||
|
||||
#SET ENV Variables
|
||||
# Install app
|
||||
FROM base AS app
|
||||
|
||||
WORKDIR /usr/src/Common
|
||||
COPY --from=common /usr/src/Common .
|
||||
|
||||
WORKDIR /usr/src/Model
|
||||
COPY --from=model /usr/src/Model .
|
||||
|
||||
WORKDIR /usr/src/CommonServer
|
||||
COPY --from=commonserver /usr/src/CommonServer .
|
||||
|
||||
WORKDIR /usr/src/CommonUI
|
||||
COPY --from=commonui /usr/src/CommonUI .
|
||||
|
||||
|
||||
ENV PRODUCTION=true
|
||||
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
|
||||
|
||||
@@ -13,11 +13,14 @@ const init: () => Promise<void> = async (): Promise<void> => {
|
||||
} catch (err) {
|
||||
logger.error('App Init Failed:');
|
||||
logger.error(err);
|
||||
throw err;
|
||||
}
|
||||
};
|
||||
|
||||
init().catch((err: Error) => {
|
||||
logger.error(err);
|
||||
logger.info('Exiting node process');
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
export default app;
|
||||
|
||||
34
AdminDashboard/package-lock.json
generated
34
AdminDashboard/package-lock.json
generated
@@ -66,7 +66,7 @@
|
||||
"moment-timezone": "^0.5.40",
|
||||
"nanoid": "^3.3.2",
|
||||
"nanoid-dictionary": "^4.3.0",
|
||||
"posthog-js": "^1.37.0",
|
||||
"posthog-js": "^1.77.0",
|
||||
"process": "^0.11.10",
|
||||
"reflect-metadata": "^0.1.13",
|
||||
"slugify": "^1.6.5",
|
||||
@@ -74,7 +74,7 @@
|
||||
"uuid": "^8.3.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@faker-js/faker": "^6.3.1",
|
||||
"@faker-js/faker": "^8.0.2",
|
||||
"@types/jest": "^27.5.2",
|
||||
"@types/node": "^17.0.22",
|
||||
"jest": "^27.5.1",
|
||||
@@ -86,6 +86,7 @@
|
||||
"version": "1.0.0",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@clickhouse/client": "^0.2.1",
|
||||
"@elastic/elasticsearch": "^8.1.0",
|
||||
"@opentelemetry/api": "^1.1.0",
|
||||
"@opentelemetry/auto-instrumentations-node": "^0.31.0",
|
||||
@@ -11913,9 +11914,9 @@
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/json5": {
|
||||
"version": "2.2.2",
|
||||
"resolved": "https://registry.npmjs.org/json5/-/json5-2.2.2.tgz",
|
||||
"integrity": "sha512-46Tk9JiOL2z7ytNQWFLpj99RZkVgeHf87yGQKsIkaPz1qSH9UczKH1rO7K3wgRselo0tYMUNfecYpm/p1vC7tQ==",
|
||||
"version": "2.2.3",
|
||||
"resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz",
|
||||
"integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==",
|
||||
"dev": true,
|
||||
"peer": true,
|
||||
"bin": {
|
||||
@@ -17137,9 +17138,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/tsconfig-paths/node_modules/json5": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz",
|
||||
"integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==",
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz",
|
||||
"integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==",
|
||||
"dev": true,
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
@@ -23463,7 +23464,7 @@
|
||||
"Common": {
|
||||
"version": "file:../Common",
|
||||
"requires": {
|
||||
"@faker-js/faker": "^6.3.1",
|
||||
"@faker-js/faker": "^8.0.2",
|
||||
"@types/crypto-js": "^4.1.1",
|
||||
"@types/jest": "^27.5.2",
|
||||
"@types/nanoid-dictionary": "^4.2.0",
|
||||
@@ -23477,7 +23478,7 @@
|
||||
"moment-timezone": "^0.5.40",
|
||||
"nanoid": "^3.3.2",
|
||||
"nanoid-dictionary": "^4.3.0",
|
||||
"posthog-js": "^1.37.0",
|
||||
"posthog-js": "^1.77.0",
|
||||
"process": "^0.11.10",
|
||||
"reflect-metadata": "^0.1.13",
|
||||
"slugify": "^1.6.5",
|
||||
@@ -23510,6 +23511,7 @@
|
||||
"CommonServer": {
|
||||
"version": "file:../CommonServer",
|
||||
"requires": {
|
||||
"@clickhouse/client": "^0.2.1",
|
||||
"@elastic/elasticsearch": "^8.1.0",
|
||||
"@faker-js/faker": "^6.3.1",
|
||||
"@opentelemetry/api": "^1.1.0",
|
||||
@@ -27674,9 +27676,9 @@
|
||||
"peer": true
|
||||
},
|
||||
"json5": {
|
||||
"version": "2.2.2",
|
||||
"resolved": "https://registry.npmjs.org/json5/-/json5-2.2.2.tgz",
|
||||
"integrity": "sha512-46Tk9JiOL2z7ytNQWFLpj99RZkVgeHf87yGQKsIkaPz1qSH9UczKH1rO7K3wgRselo0tYMUNfecYpm/p1vC7tQ==",
|
||||
"version": "2.2.3",
|
||||
"resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz",
|
||||
"integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==",
|
||||
"dev": true,
|
||||
"peer": true
|
||||
},
|
||||
@@ -31459,9 +31461,9 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"json5": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz",
|
||||
"integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==",
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz",
|
||||
"integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==",
|
||||
"dev": true,
|
||||
"peer": true,
|
||||
"requires": {
|
||||
|
||||
@@ -102,16 +102,7 @@
|
||||
<!-- End Google Tag Manager (noscript) -->
|
||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||
<div id="root"></div>
|
||||
<!--
|
||||
This HTML file is a template.
|
||||
If you open it directly in the browser, you will see an empty page.
|
||||
|
||||
You can add webfonts, meta tags, or analytics to this file.
|
||||
The build step will place the bundled scripts into the <body> tag.
|
||||
|
||||
To begin the development, run `npm start` or `yarn start`.
|
||||
To create a production bundle, use `npm run build` or `yarn build`.
|
||||
-->
|
||||
<script src="/admin/dist/bundle.js"></script>
|
||||
<script>
|
||||
tailwind.config = {
|
||||
|
||||
@@ -19,7 +19,6 @@ import Users from './Pages/Users/Index';
|
||||
import Logout from './Pages/Logout/Logout';
|
||||
|
||||
// Settings Pages.
|
||||
import SettingsHost from './Pages/Settings/Host/Index';
|
||||
import SettingsEmail from './Pages/Settings/SMTP/Index';
|
||||
import SettingsCallSMS from './Pages/Settings/CallSMS/Index';
|
||||
import SettingsProbes from './Pages/Settings/Probes/Index';
|
||||
@@ -73,12 +72,7 @@ const App: () => JSX.Element = () => {
|
||||
|
||||
<PageRoute
|
||||
path={RouteMap[PageMap.SETTINGS]?.toString() || ''}
|
||||
element={<SettingsHost />}
|
||||
/>
|
||||
|
||||
<PageRoute
|
||||
path={RouteMap[PageMap.SETTINGS_HOST]?.toString() || ''}
|
||||
element={<SettingsHost />}
|
||||
element={<SettingsAuthentication />}
|
||||
/>
|
||||
|
||||
<PageRoute
|
||||
|
||||
@@ -9,12 +9,21 @@ import UserUtil from 'CommonUI/src/Utils/User';
|
||||
import Navigation from 'CommonUI/src/Utils/Navigation';
|
||||
import { ACCOUNTS_URL } from 'CommonUI/src/Config';
|
||||
import UiAnalytics from 'CommonUI/src/Utils/Analytics';
|
||||
import ErrorMessage from 'CommonUI/src/Components/ErrorMessage/ErrorMessage';
|
||||
|
||||
const Logout: FunctionComponent = (): ReactElement => {
|
||||
useEffect(() => {
|
||||
const [error, setError] = React.useState<string | null>(null);
|
||||
|
||||
const logout: Function = async () => {
|
||||
UiAnalytics.logout();
|
||||
UserUtil.logout();
|
||||
await UserUtil.logout();
|
||||
Navigation.navigate(ACCOUNTS_URL);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
logout().catch((error: Error) => {
|
||||
setError(error.message || error.toString());
|
||||
});
|
||||
}, []);
|
||||
|
||||
return (
|
||||
@@ -35,7 +44,8 @@ const Logout: FunctionComponent = (): ReactElement => {
|
||||
},
|
||||
]}
|
||||
>
|
||||
<PageLoader isVisible={true} />
|
||||
{!error ? <PageLoader isVisible={true} /> : <></>}
|
||||
{error ? <ErrorMessage error={error} /> : <></>}
|
||||
</Page>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -1,83 +0,0 @@
|
||||
import Route from 'Common/Types/API/Route';
|
||||
import FormFieldSchemaType from 'CommonUI/src/Components/Forms/Types/FormFieldSchemaType';
|
||||
import CardModelDetail from 'CommonUI/src/Components/ModelDetail/CardModelDetail';
|
||||
import Page from 'CommonUI/src/Components/Page/Page';
|
||||
import React, { FunctionComponent, ReactElement } from 'react';
|
||||
import PageMap from '../../../Utils/PageMap';
|
||||
import RouteMap, { RouteUtil } from '../../../Utils/RouteMap';
|
||||
import DashboardSideMenu from '../SideMenu';
|
||||
import GlobalConfig from 'Model/Models/GlobalConfig';
|
||||
import ObjectID from 'Common/Types/ObjectID';
|
||||
import FieldType from 'CommonUI/src/Components/Types/FieldType';
|
||||
|
||||
const Settings: FunctionComponent = (): ReactElement => {
|
||||
return (
|
||||
<Page
|
||||
title={'Admin Settings'}
|
||||
breadcrumbLinks={[
|
||||
{
|
||||
title: 'Admin Dashboard',
|
||||
to: RouteUtil.populateRouteParams(
|
||||
RouteMap[PageMap.HOME] as Route
|
||||
),
|
||||
},
|
||||
{
|
||||
title: 'Settings',
|
||||
to: RouteUtil.populateRouteParams(
|
||||
RouteMap[PageMap.SETTINGS] as Route
|
||||
),
|
||||
},
|
||||
{
|
||||
title: 'Host',
|
||||
to: RouteUtil.populateRouteParams(
|
||||
RouteMap[PageMap.SETTINGS_HOST] as Route
|
||||
),
|
||||
},
|
||||
]}
|
||||
sideMenu={<DashboardSideMenu />}
|
||||
>
|
||||
{/* Project Settings View */}
|
||||
<CardModelDetail
|
||||
name="Host Settings"
|
||||
cardProps={{
|
||||
title: 'Host Settings',
|
||||
description:
|
||||
'Host Settings for this OneUptime Server instance.',
|
||||
}}
|
||||
isEditable={true}
|
||||
editButtonText="Edit Host"
|
||||
formFields={[
|
||||
{
|
||||
field: {
|
||||
useHttps: true,
|
||||
},
|
||||
title: 'Use HTTPs',
|
||||
fieldType: FormFieldSchemaType.Toggle,
|
||||
required: false,
|
||||
description:
|
||||
'Is this server hosted with a TLS / SSL cert?',
|
||||
},
|
||||
]}
|
||||
modelDetailProps={{
|
||||
modelType: GlobalConfig,
|
||||
id: 'model-detail-global-config',
|
||||
fields: [
|
||||
{
|
||||
field: {
|
||||
useHttps: true,
|
||||
},
|
||||
fieldType: FieldType.Boolean,
|
||||
title: 'Use HTTPS',
|
||||
placeholder: 'No',
|
||||
description:
|
||||
'Is this server hosted with a valid TLS / SSL cert?',
|
||||
},
|
||||
],
|
||||
modelId: ObjectID.getZeroObjectID(),
|
||||
}}
|
||||
/>
|
||||
</Page>
|
||||
);
|
||||
};
|
||||
|
||||
export default Settings;
|
||||
@@ -11,7 +11,7 @@ const DashboardSideMenu: () => JSX.Element = (): ReactElement => {
|
||||
return (
|
||||
<SideMenu>
|
||||
<SideMenuSection title="Basic">
|
||||
<SideMenuItem
|
||||
{/* <SideMenuItem
|
||||
link={{
|
||||
title: 'Host',
|
||||
to: RouteUtil.populateRouteParams(
|
||||
@@ -19,7 +19,7 @@ const DashboardSideMenu: () => JSX.Element = (): ReactElement => {
|
||||
),
|
||||
}}
|
||||
icon={IconProp.Globe}
|
||||
/>
|
||||
/> */}
|
||||
<SideMenuItem
|
||||
link={{
|
||||
title: 'Authentication',
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
# Pull base image nodejs image.
|
||||
FROM node:current-alpine AS base
|
||||
FROM node:current-alpine
|
||||
USER root
|
||||
RUN mkdir /tmp/npm && chmod 2777 /tmp/npm && chown 1000:1000 /tmp/npm && npm config set cache /tmp/npm --global
|
||||
|
||||
RUN npm config set fetch-retry-maxtimeout 6000000
|
||||
RUN npm config set fetch-retry-mintimeout 1000000
|
||||
|
||||
ARG GIT_SHA
|
||||
ARG APP_VERSION
|
||||
@@ -22,18 +20,12 @@ SHELL ["/bin/bash", "-c"]
|
||||
|
||||
RUN mkdir /usr/src
|
||||
|
||||
# Install common
|
||||
|
||||
FROM base AS common
|
||||
WORKDIR /usr/src/Common
|
||||
COPY ./Common/package*.json /usr/src/Common/
|
||||
RUN npm install
|
||||
COPY ./Common /usr/src/Common
|
||||
|
||||
|
||||
# Install Model
|
||||
|
||||
FROM base AS model
|
||||
WORKDIR /usr/src/Model
|
||||
COPY ./Model/package*.json /usr/src/Model/
|
||||
RUN npm install
|
||||
@@ -41,9 +33,6 @@ COPY ./Model /usr/src/Model
|
||||
|
||||
|
||||
|
||||
# Install CommonServer
|
||||
|
||||
FROM base AS commonserver
|
||||
WORKDIR /usr/src/CommonServer
|
||||
COPY ./CommonServer/package*.json /usr/src/CommonServer/
|
||||
RUN npm install
|
||||
@@ -52,16 +41,7 @@ COPY ./CommonServer /usr/src/CommonServer
|
||||
|
||||
|
||||
# Install app
|
||||
FROM base AS app
|
||||
|
||||
WORKDIR /usr/src/Common
|
||||
COPY --from=common /usr/src/Common .
|
||||
|
||||
WORKDIR /usr/src/Model
|
||||
COPY --from=model /usr/src/Model .
|
||||
|
||||
WORKDIR /usr/src/CommonServer
|
||||
COPY --from=commonserver /usr/src/CommonServer .
|
||||
|
||||
|
||||
ENV PRODUCTION=true
|
||||
|
||||
@@ -93,11 +93,14 @@ const init: () => Promise<void> = async (): Promise<void> => {
|
||||
} catch (err) {
|
||||
logger.error('App Init Failed:');
|
||||
logger.error(err);
|
||||
throw err;
|
||||
}
|
||||
};
|
||||
|
||||
init().catch((err: Error) => {
|
||||
logger.error(err);
|
||||
logger.info('Exiting node process');
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
export default app;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ColumnAccessControl } from 'Common/Types/Database/AccessControl/AccessControl';
|
||||
import { ColumnAccessControl } from 'Common/Types/BaseDatabase/AccessControl';
|
||||
import { getTableColumns } from 'Common/Types/Database/TableColumn';
|
||||
import Dictionary from 'Common/Types/Dictionary';
|
||||
import ObjectID from 'Common/Types/ObjectID';
|
||||
|
||||
25
Ci/README.md
25
Ci/README.md
@@ -1,25 +0,0 @@
|
||||
# Setup Production Server
|
||||
|
||||
### Run the production.yml file.
|
||||
|
||||
run the file specific to the project with their specific names.
|
||||
`kubectl create -f production.yml`
|
||||
|
||||
# Known Issues
|
||||
|
||||
### Issue 1
|
||||
|
||||
Sometimes you'll see this error
|
||||
|
||||
```
|
||||
$ kubectl create -f staging.yaml
|
||||
error: SchemaError(io.k8s.api.apps.v1beta2.DeploymentCondition): invalid object doesn't have additional properties
|
||||
```
|
||||
|
||||
**Solution:**
|
||||
|
||||
Run the kubectl command with validate false
|
||||
|
||||
```
|
||||
$ kubectl create -f staging.yaml --validate=false
|
||||
```
|
||||
@@ -1,27 +0,0 @@
|
||||
#########
|
||||
#Since Kubernetes jobs are immitable (you cannot update it with a new image).
|
||||
# To update these jobs, CI deletes the old jobs and recreates them using this file.
|
||||
#########
|
||||
|
||||
#########
|
||||
#UPDATE: Any update to this file should also be accompanied with ../test.yaml
|
||||
#########
|
||||
|
||||
########-InitScript-##########
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: InitScript
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
- name: InitScript
|
||||
image: localhost:32000/InitScript:test
|
||||
imagePullPolicy: Always
|
||||
env:
|
||||
- name: MONGO_URL
|
||||
value: 'mongodb://admin:372b60f4-704c-4205-8e5c-45cdbf44b1fc@mongo-0.mongo.default.svc.cluster.local:27017,mongo-1.mongo.default.svc.cluster.local:27017,mongo-2.mongo.default.svc.cluster.local:27017/oneuptimedb?replicaSet=rs0'
|
||||
restartPolicy: Never
|
||||
---
|
||||
###########################
|
||||
@@ -1,20 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
chmod +x ./ci/scripts/hashexist.sh
|
||||
|
||||
if [[ $CI_COMMIT_BRANCH != "master" ]] && [[ $CI_COMMIT_BRANCH != "release" ]]
|
||||
then
|
||||
next_stage="skip"
|
||||
|
||||
# the first argument is always the job name ($1)
|
||||
for ((i = 2; i <= $#; i++ ))
|
||||
do
|
||||
hash_found=`./ci/scripts/hashexist.sh $1 ${!i}`
|
||||
if [[ $hash_found == *"false"* ]]
|
||||
then
|
||||
next_stage="continue"
|
||||
fi
|
||||
done
|
||||
|
||||
echo $next_stage
|
||||
fi
|
||||
@@ -1,29 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
echo "
|
||||
This script npm install's the every project
|
||||
"
|
||||
function clean_install {
|
||||
echo "Installing $1"
|
||||
cd $1
|
||||
rm package-lock.json
|
||||
rm -rf node_modules
|
||||
npm install
|
||||
npm audit fix
|
||||
cd ..
|
||||
echo "Complete $1"
|
||||
echo ""
|
||||
}
|
||||
|
||||
clean_install dashboard
|
||||
clean_install accounts
|
||||
clean_install backend
|
||||
clean_install home
|
||||
clean_install StatusPage
|
||||
clean_install ApiReference
|
||||
clean_install probe
|
||||
clean_install AdminDashboard
|
||||
clean_install InitScript
|
||||
clean_install licensing
|
||||
clean_install HelmChart
|
||||
clean_install JavaScriptSDK
|
||||
clean_install .
|
||||
@@ -1,52 +0,0 @@
|
||||
#
|
||||
sudo dpkg --configure -a
|
||||
echo "Running Cleanup Script..."
|
||||
if [[ $(which helm) ]]
|
||||
then
|
||||
# Remove oneuptime if helm is installed
|
||||
echo "RUNNING COMMAND: sudo helm uninstall oneuptime || echo 'oneuptime not installed'"
|
||||
sudo helm uninstall oneuptime || echo 'oneuptime not installed'
|
||||
fi
|
||||
|
||||
if [[ $(which microk8s) ]]
|
||||
then
|
||||
# Stop microk8s VM
|
||||
echo "Stopping microk8s..."
|
||||
# Delete microk8s cluster so it can be fresh for next job.
|
||||
echo "Delete microk8s Cluster..."
|
||||
echo "RUNNING COMMAND: sudo usermod -a -G microk8s $USER"
|
||||
sudo usermod -a -G microk8s $USER || echo "microk8s group not found"
|
||||
echo "RUNNING COMMAND: microk8s.reset || 'microk8s cannot delete'"
|
||||
sudo microk8s.reset || 'microk8s cannot delete'
|
||||
echo "RUNNING COMMAND: microk8s.kubectl delete all --all || 'microk8s.kubectl cannot delete'"
|
||||
sudo microk8s.kubectl delete all --all || 'microk8s.kubectl cannot delete'
|
||||
echo "RUNNING COMMAND: microk8s.stop || 'microk8s cannot Stop'"
|
||||
sudo microk8s.stop || "microk8s cannot Stop"
|
||||
echo "RUNNING COMMAND: sudo snap remove microk8s || 'microk8s cannot be removed.'"
|
||||
sudo snap remove microk8s || 'microk8s cannot be removed.'
|
||||
fi
|
||||
|
||||
if [[ $(which docker) ]]
|
||||
then
|
||||
# Stop all docker containers
|
||||
echo "Stop and Delete all docker containers..."
|
||||
echo "RUNNING COMMAND: sudo docker stop \$(sudo docker ps -aq) || echo 'No docker containers'"
|
||||
sudo docker stop $(sudo docker ps -aq) || echo 'No docker containers'
|
||||
# Remove all docker containers.
|
||||
echo "RUNNING COMMAND: sudo docker rm \$(sudo docker ps -aq) || echo 'No docker containers'"
|
||||
sudo docker rm $(sudo docker ps -aq) || echo 'No docker containers'
|
||||
# Delete all locally built images. (Comment this out to reduce build times)
|
||||
# echo "RUNNING COMMAND: sudo docker rmi -f \$(sudo docker images -q) || echo 'No docker containers'"
|
||||
# sudo docker rmi -f $(sudo docker images -q) || echo 'No docker containers'
|
||||
|
||||
# Comment line below to reduce build times.
|
||||
# sudo docker system prune -a --volumes --force
|
||||
fi
|
||||
|
||||
# fix broken unmet dependencies
|
||||
sudo apt --fix-broken install -y -y
|
||||
|
||||
# remove any service holding port 80
|
||||
sudo apt remove apache2 nginx -y
|
||||
sudo apt purge apache2 nginx -y
|
||||
sudo apt autoremove -y
|
||||
@@ -1,5 +0,0 @@
|
||||
curl -X POST "https://api.cloudflare.com/client/v4/zones/${CF_ZONE}/purge_cache" \
|
||||
-H "X-Auth-Email: ${CF_EMAIL}" \
|
||||
-H "X-Auth-Key: ${CF_API_KEY}" \
|
||||
-H "Content-Type: application/json" \
|
||||
--data '{"purge_everything":true}'
|
||||
@@ -1,10 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
echo "Connect machine with to communicate with aws cluster"
|
||||
# This command will automatically switch to the oneuptime-production cluster
|
||||
|
||||
# AWS command.
|
||||
#sudo aws eks update-kubeconfig --region $AWS_DEFAULT_REGION --name fyipe-production
|
||||
|
||||
|
||||
doctl kubernetes cluster kubeconfig save 5c53f2a7-e462-48ab-9c02-3fbe281b2568
|
||||
@@ -1,40 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Install Kubectl
|
||||
curl -LO "https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl"
|
||||
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
|
||||
sudo kubectl version --client
|
||||
|
||||
# fix dpkg interruption
|
||||
sudo dpkg --configure -a
|
||||
|
||||
# fix broken unmet dependencies
|
||||
sudo apt --fix-broken install -y -y
|
||||
|
||||
# # Install and configure aws cli
|
||||
# sudo apt-get install -y unzip
|
||||
# curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" # download latest aws cli version
|
||||
# unzip awscliv2.zip
|
||||
# sudo ./aws/install
|
||||
# aws --version # confirm installation
|
||||
|
||||
# # Remove any already existing ~/.aws, /root/.kube or /root/.config directory
|
||||
# sudo rm -rf ~/.aws || echo "Directory already deleted"
|
||||
# sudo rm -rf /root/.config || echo "Directory already deleted"
|
||||
# sudo rm -rf /root/.kube || echo "Directory already deleted"
|
||||
|
||||
# # Configure aws cli
|
||||
# sudo aws configure set aws_access_key_id $AWS_ACCESS_KEY_ID
|
||||
# sudo aws configure set aws_secret_access_key $AWS_SECRET_ACCESS_KEY
|
||||
# sudo aws configure set default.region $AWS_DEFAULT_REGION
|
||||
# sudo aws configure set default.output json
|
||||
|
||||
|
||||
# Install doctl.
|
||||
wget https://github.com/digitalocean/doctl/releases/download/v1.71.0/doctl-1.71.0-linux-amd64.tar.gz
|
||||
tar xf doctl-1.71.0-linux-amd64.tar.gz
|
||||
sudo mv doctl /usr/local/bin
|
||||
|
||||
# Setup access token
|
||||
doctl auth init -t $DIGITAL_OCEAN_API_KEY
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
echo "Connect machine with to communicate with aws cluster"
|
||||
# This command will automatically switch to the oneuptime-staging cluster
|
||||
sudo aws eks update-kubeconfig --region $AWS_DEFAULT_REGION --name fyipe-staging
|
||||
@@ -1,54 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
echo "
|
||||
======== IMPORTANT! =========
|
||||
This script will take ~30+ mins to complete.
|
||||
- Builds a docker container
|
||||
- This script takes a long time to run when you run it for the first time
|
||||
- Next subsequent executions would be a lot faster.
|
||||
"
|
||||
|
||||
if [[ ! $(which docker) && ! $(docker --version) ]]
|
||||
then
|
||||
echo -e "\033[91mPlease install Docker. https://docs.docker.com/install"
|
||||
exit
|
||||
fi
|
||||
|
||||
if [[ ! $(which git) && ! $(docker --git) ]]
|
||||
then
|
||||
echo -e "\033[91mPlease install Git. https://git-scm.com/book/en/v2/Getting-Started-Installing-Git"
|
||||
exit
|
||||
fi
|
||||
|
||||
DIR=$PWD
|
||||
ONEUPTIME_DIR="$DIR/.."
|
||||
|
||||
chmod +x ./ci/scripts/docker-build-and-push.sh
|
||||
function build {
|
||||
./ci/scripts/docker-build-and-push.sh $1 $2
|
||||
}
|
||||
|
||||
# cd ..
|
||||
|
||||
build dashboard $1
|
||||
build accounts $1
|
||||
build backend $1
|
||||
build home $1
|
||||
build StatusPage $1
|
||||
build ApiReference $1
|
||||
build probe $1
|
||||
build AdminDashboard $1
|
||||
build InitScript $1
|
||||
build slack $1
|
||||
build licensing $1
|
||||
build HelmChart $1
|
||||
build LighthouseRunner $1
|
||||
build ScriptRunner $1
|
||||
build ContainerScanner $1
|
||||
build ApplicationScanner $1
|
||||
build data-ingestor $1
|
||||
build realtime $1
|
||||
build haraka $1
|
||||
build HttpTestServer $1
|
||||
|
||||
cd $DIR
|
||||
@@ -1,6 +0,0 @@
|
||||
cd $1
|
||||
echo "Building $1"
|
||||
sudo docker build -t oneuptime/$1:$2 .
|
||||
echo "Pushing $1"
|
||||
sudo docker push oneuptime/$1:$2
|
||||
cd ..
|
||||
@@ -1,19 +0,0 @@
|
||||
#Install Docker and setup registry and insecure access to it.
|
||||
#IF docker is already installed, do not install docker.
|
||||
if [[ ! $(which docker) ]]
|
||||
then
|
||||
echo "INSTALLING DOCKER"
|
||||
sudo apt-get update
|
||||
sudo apt-get install \
|
||||
apt-transport-https \
|
||||
ca-certificates \
|
||||
curl \
|
||||
gnupg \
|
||||
lsb-release
|
||||
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
|
||||
echo \
|
||||
"deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
|
||||
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
|
||||
sudo apt-get update
|
||||
sudo apt-get install docker-ce docker-ce-cli containerd.io
|
||||
fi
|
||||
@@ -1,25 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# install jq only when it does not exist
|
||||
|
||||
function hashExist {
|
||||
# $1 is the job name
|
||||
# $2 is the project
|
||||
if [[ ! $(which jq) ]]
|
||||
then
|
||||
sudo apt-get install -y jq
|
||||
fi
|
||||
PROJECT_HASH=`find $2 -type f ! -path "*node_modules*" ! -path "*build*" -print0 | sort -z | xargs -0 sha256sum | sha256sum`
|
||||
HASH_VALUE=`echo $PROJECT_HASH$1 | sha256sum | head -c 64`
|
||||
RESPONSE=`curl -H "Content-Type: application/json" -d "{\"structuredQuery\": {\"from\": {\"collectionId\": \"builds\"},\"where\": {\"compositeFilter\": {\"op\": \"AND\",\"filters\": [{\"fieldFilter\": {\"field\": {\"fieldPath\": \"project\"},\"op\": \"EQUAL\",\"value\": {\"stringValue\": '$2'}}},{\"fieldFilter\": {\"field\": {\"fieldPath\": \"hash\"},\"op\": \"EQUAL\",\"value\": {\"stringValue\": '$HASH_VALUE'}}}]}}}}" -X POST "https://firestore.googleapis.com/v1/projects/oneuptime-devops/databases/(default)/documents:runQuery"`
|
||||
# if response contains an array of object with document key, then the hash already exist in db
|
||||
document=`jq '.[0].document' <<< "$RESPONSE"`
|
||||
if [[ $document == null ]]
|
||||
then
|
||||
echo false
|
||||
else
|
||||
echo true
|
||||
fi
|
||||
}
|
||||
|
||||
hashExist $1 $2
|
||||
@@ -1,31 +0,0 @@
|
||||
sudo sed -i '/accounts/c\' /etc/hosts
|
||||
ACCOUNTS_IP=`sudo k describe svc oneuptime-accounts | grep Endpoints | cut -d ":" -f 2`
|
||||
echo $ACCOUNTS_IP' accounts.app.local' | sudo tee -a /etc/hosts
|
||||
|
||||
sudo sed -i '/AdminDashboard/c\' /etc/hosts
|
||||
ADMIN_DASHBOARD_IP=`sudo k describe svc oneuptime-admin | grep Endpoints | cut -d ":" -f 2`
|
||||
echo $ADMIN_DASHBOARD_IP' admin.app.local' | sudo tee -a /etc/hosts
|
||||
|
||||
sudo sed -i '/dashboard/c\' /etc/hosts
|
||||
DASHBOARD_IP=`sudo k describe svc oneuptime-dashboard | grep Endpoints | cut -d ":" -f 2`
|
||||
echo $DASHBOARD_IP' dashboard.app.local' | sudo tee -a /etc/hosts
|
||||
|
||||
sudo sed -i '/backend/c\' /etc/hosts
|
||||
BACKEND_IP=`sudo k describe svc oneuptime-backend | grep Endpoints | cut -d ":" -f 2`
|
||||
echo $BACKEND_IP' backend.app.local' | sudo tee -a /etc/hosts
|
||||
|
||||
sudo sed -i '/home/c\' /etc/hosts
|
||||
HOME_IP=`sudo k describe svc oneuptime-home | grep Endpoints | cut -d ":" -f 2`
|
||||
echo $HOME_IP' home.app.local' | sudo tee -a /etc/hosts
|
||||
|
||||
sudo sed -i '/StatusPage/c\' /etc/hosts
|
||||
STATUSPAGE_IP=`sudo k describe svc oneuptime-status | grep Endpoints | cut -d ":" -f 2`
|
||||
echo $STATUSPAGE_IP' status.app.local' | sudo tee -a /etc/hosts
|
||||
|
||||
sudo sed -i '/ApiReference/c\' /etc/hosts
|
||||
ApiReference_IP=`sudo k describe svc oneuptime-ApiReference | grep Endpoints | cut -d ":" -f 2`
|
||||
echo $ApiReference_IP' ApiReference.app.local' | sudo tee -a /etc/hosts
|
||||
|
||||
sudo sed -i '/licensing/c\' /etc/hosts
|
||||
LICENSING_IP=`sudo k describe svc oneuptime-licensing | grep Endpoints | cut -d ":" -f 2`
|
||||
echo $LICENSING_IP' licensing.app.local' | sudo tee -a /etc/hosts
|
||||
@@ -1,9 +0,0 @@
|
||||
echo "Installing helm..."
|
||||
|
||||
sudo https://baltocdn.com/helm/signing.asc | sudo apt-key add -
|
||||
sudo apt-get install apt-transport-https --yes
|
||||
sudo echo "deb https://baltocdn.com/helm/stable/debian/ all main" | sudo tee /etc/apt/sources.list.d/helm-stable-debian.list
|
||||
sudo apt-get update
|
||||
sudo apt-get install helm
|
||||
|
||||
echo "Install helm complete."
|
||||
@@ -1,2 +0,0 @@
|
||||
sudo apt-get install -y jq
|
||||
curl -s -S --header "PRIVATE-TOKEN: $PERSONAL_ACCESS_TOKEN" "https://gitlab.com/api/v4/projects/$CI_PROJECT_ID/pipelines/$CI_PIPELINE_ID/jobs?per_page=50" | jq -c ".[] | select(.name==\"$1\") | .status"
|
||||
@@ -1,53 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
echo "
|
||||
This script rollbacks every project if any of the deployment fails
|
||||
"
|
||||
|
||||
chmod +x ./ci/scripts/job-status.sh
|
||||
|
||||
function rollback {
|
||||
export status=`./ci/scripts/job-status.sh production_$1`
|
||||
if [[ $status == \"success\" ]]
|
||||
then
|
||||
echo "Rolling back $1"
|
||||
sudo kubectl rollout undo deployment/$1
|
||||
else
|
||||
echo "Rollback skipped $1"
|
||||
fi
|
||||
}
|
||||
|
||||
function check {
|
||||
export status=`./ci/scripts/job-status.sh production_$1`
|
||||
if [[ $status == \"failed\" ]]
|
||||
then
|
||||
echo "Deployment unsuccessful for $1, rolling back all new deployments"
|
||||
rollback dashboard
|
||||
rollback accounts
|
||||
rollback backend
|
||||
rollback home
|
||||
rollback StatusPage
|
||||
rollback ApiReference
|
||||
rollback probe
|
||||
rollback AdminDashboard
|
||||
rollback licensing
|
||||
rollback HelmChart
|
||||
rollback slack
|
||||
exit 1
|
||||
else
|
||||
echo "$1 Deployment successful"
|
||||
fi
|
||||
}
|
||||
|
||||
check dashboard
|
||||
check accounts
|
||||
check backend
|
||||
check home
|
||||
check StatusPage
|
||||
check ApiReference
|
||||
check probe-1
|
||||
check probe-2
|
||||
check AdminDashboard
|
||||
check licensing
|
||||
check InitScript
|
||||
check slack
|
||||
check HelmChart
|
||||
@@ -1,26 +0,0 @@
|
||||
# Wait for all the services to come online.
|
||||
echo "RUNNING COMMAND: echo 'Wait for 10 mins....'"
|
||||
echo 'Wait for 10 mins....'
|
||||
echo "RUNNING COMMAND: sleep 10m"
|
||||
sleep 10m
|
||||
# Get the status of all the kubernetes resources for debugging purposes.
|
||||
echo "RUNNING COMMAND: sudo k get pods"
|
||||
sudo k get pods
|
||||
echo "RUNNING COMMAND: sudo k get services"
|
||||
sudo k get services
|
||||
echo "RUNNING COMMAND: sudo k get rc"
|
||||
sudo k get rc
|
||||
echo "RUNNING COMMAND: sudo k get deployments"
|
||||
sudo k get deployments
|
||||
echo "RUNNING COMMAND: sudo k get statefulset"
|
||||
sudo k get statefulset
|
||||
echo "RUNNING COMMAND: sudo k get pv"
|
||||
sudo k get pv
|
||||
echo "RUNNING COMMAND: sudo k get pvc"
|
||||
sudo k get pvc
|
||||
echo "RUNNING COMMAND: sudo k get storageclass"
|
||||
sudo k get storageclass
|
||||
echo "RUNNING COMMAND: sudo k cluster-info"
|
||||
sudo k cluster-info
|
||||
echo "RUNNING COMMAND: sudo k get all --all-namespaces"
|
||||
sudo k get all --all-namespaces
|
||||
@@ -1,36 +0,0 @@
|
||||
# Cleanup
|
||||
echo "RUNNING COMMAND: chmod +x ./ci/cleanup.sh"
|
||||
chmod +x ./ci/scripts/cleanup.sh
|
||||
echo "RUNNING COMMAND: ./ci/cleanup.sh"
|
||||
./ci/scripts/cleanup.sh
|
||||
|
||||
#Install Docker and setup registry and insecure access to it.
|
||||
#IF docker is already installed, do not install docker.
|
||||
if [[ ! $(which docker) ]]
|
||||
then
|
||||
echo "RUNNING COMMAND: curl -sSL https://get.docker.com/ | sh"
|
||||
curl -sSL https://get.docker.com/ | sh
|
||||
echo "RUNNING COMMAND: sudo touch /etc/docker/daemon.json"
|
||||
sudo touch /etc/docker/daemon.json
|
||||
echo "RUNNING COMMAND: echo -e "{\n "insecure-registries": ["localhost:32000"]\n}" | sudo tee -a /etc/docker/daemon.json >> /dev/null"
|
||||
echo -e "{\n "insecure-registries": ["localhost:32000"]\n}" | sudo tee -a /etc/docker/daemon.json >> /dev/null
|
||||
echo "RUNNING COMMAND: sudo systemctl restart docker"
|
||||
sudo systemctl restart docker
|
||||
fi
|
||||
|
||||
# Install packages.
|
||||
echo "RUNNING COMMAND: sudo apt-get update -y && sudo apt-get install -y bash git sudo nodejs"
|
||||
sudo apt-get update -y && sudo apt-get install -y bash git sudo nodejs
|
||||
|
||||
# Install additional dependencies for puppeteer.
|
||||
echo "RUNNING COMMAND: sudo apt-get install -yq gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 \
|
||||
libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 \
|
||||
libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 \
|
||||
libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 \
|
||||
ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils
|
||||
"
|
||||
sudo apt-get install -yq gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 \
|
||||
libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 \
|
||||
libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 \
|
||||
libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 \
|
||||
ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget
|
||||
@@ -1,19 +0,0 @@
|
||||
##############
|
||||
# IMPORTANT:
|
||||
# This script sets the CI/CD machine up to run a build job. It's usually the first script that runs
|
||||
##############
|
||||
|
||||
# Cleanup
|
||||
echo "RUNNING COMMAND: chmod +x ./ci/cleanup.sh"
|
||||
chmod +x ./ci/scripts/cleanup.sh
|
||||
echo "RUNNING COMMAND: ./ci/cleanup.sh"
|
||||
./ci/scripts/cleanup.sh
|
||||
|
||||
# Setup Machine.
|
||||
echo "RUNNING COMMAND: chmod +x ./HelmChart/public/install.sh"
|
||||
chmod +x ./HelmChart/public/install.sh
|
||||
echo "RUNNING COMMAND: ./HelmChart/public/install.sh"
|
||||
./HelmChart/public/install.sh ci-install $1
|
||||
|
||||
# For dpkg interruption
|
||||
sudo dpkg --configure -a
|
||||
@@ -1,8 +0,0 @@
|
||||
# This will download, build and package docker containers.
|
||||
echo "RUNNING COMMAND: chmod +x ./ci/docker-build-all-and-push.sh"
|
||||
chmod +x ./ci/scripts/docker-build-all-and-push.sh
|
||||
./ci/scripts/docker-build-all-and-push.sh test
|
||||
# Setup Kubernetes Cluster
|
||||
chmod +x ./ci/scripts/setup-cluster.sh
|
||||
echo "RUNNING COMMAND: ./ci/setup-cluster.sh"
|
||||
./ci/scripts/setup-cluster.sh
|
||||
@@ -1,58 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
echo "
|
||||
This script rollbacks every project if any of the deployment fails
|
||||
"
|
||||
|
||||
chmod +x ./ci/scripts/job-status.sh
|
||||
|
||||
function rollback {
|
||||
export status=`./ci/scripts/job-status.sh staging_$1`
|
||||
if [[ $status == \"success\" ]]
|
||||
then
|
||||
echo "Rolling back $1"
|
||||
sudo kubectl rollout undo deployment/fi-$1
|
||||
if [[ $1 == \"probe\" ]]
|
||||
then
|
||||
echo "Rolling back probe1"
|
||||
sudo kubectl rollout undo deployment/fi-probe1
|
||||
sudo kubectl rollout undo deployment/fi-probe2
|
||||
fi
|
||||
else
|
||||
echo "Rollback skipped $1"
|
||||
fi
|
||||
}
|
||||
|
||||
function check {
|
||||
export status=`./ci/scripts/job-status.sh staging_$1`
|
||||
if [[ $status == \"failed\" ]]
|
||||
then
|
||||
echo "Deployment unsuccessful for $1, rolling back all new deployments"
|
||||
rollback dashboard
|
||||
rollback accounts
|
||||
rollback backend
|
||||
rollback home
|
||||
rollback StatusPage
|
||||
rollback ApiReference
|
||||
rollback probe
|
||||
rollback AdminDashboard
|
||||
rollback licensing
|
||||
rollback HelmChart
|
||||
rollback slack
|
||||
exit 1
|
||||
else
|
||||
echo "$1 Deployment successful"
|
||||
fi
|
||||
}
|
||||
|
||||
check dashboard
|
||||
check accounts
|
||||
check backend
|
||||
check home
|
||||
check StatusPage
|
||||
check ApiReference
|
||||
check probe-1
|
||||
check probe-2
|
||||
check AdminDashboard
|
||||
check licensing
|
||||
check slack
|
||||
check HelmChart
|
||||
@@ -1,23 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
chmod +x ./ci/scripts/hashexist.sh
|
||||
|
||||
function storeHash {
|
||||
# $1 -> Job Name; $2 -> Project
|
||||
PROJECT_HASH=`find $2 -type f ! -path "*node_modules*" ! -path "*build*" -print0 | sort -z | xargs -0 sha256sum | sha256sum`
|
||||
HASH_VALUE=`echo $PROJECT_HASH$1 | sha256sum | head -c 64`
|
||||
curl -H "Content-Type: application/json" -d "{\"fields\": {\"project\": {\"stringValue\": '$2'},\"hash\": {\"stringValue\": '$HASH_VALUE'}}}" -X POST "https://firestore.googleapis.com/v1/projects/oneuptime-devops/databases/(default)/documents/builds"
|
||||
}
|
||||
|
||||
if [[ $CI_COMMIT_BRANCH != "master" ]] && [[ $CI_COMMIT_BRANCH != "release" ]]
|
||||
then
|
||||
# the first argument is always the job name ($1)
|
||||
for ((i = 2; i <= $#; i++ ))
|
||||
do
|
||||
hash_exist=`./ci/scripts/hashexist.sh $1 ${!i}`
|
||||
if [[ $hash_exist == *"false"* ]]
|
||||
then
|
||||
storeHash $1 ${!i}
|
||||
fi
|
||||
done
|
||||
fi
|
||||
@@ -1,35 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
echo "
|
||||
This script changes version of every project
|
||||
"
|
||||
function version {
|
||||
cd $1
|
||||
npm version "6.0.$CI_PIPELINE_ID"
|
||||
cd ..
|
||||
}
|
||||
|
||||
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
|
||||
sudo apt-get install -y nodejs
|
||||
|
||||
version dashboard
|
||||
version accounts
|
||||
version backend
|
||||
version home
|
||||
version StatusPage
|
||||
version ApiReference
|
||||
version probe
|
||||
version AdminDashboard
|
||||
version InitScript
|
||||
version licensing
|
||||
version HelmChart
|
||||
version JavaScriptSDK
|
||||
version oneuptime-le-store
|
||||
version oneuptime-acme-http-01
|
||||
version LighthouseRunner
|
||||
version ScriptRunner
|
||||
version ContainerScanner
|
||||
version ApplicationScanner
|
||||
version data-ingestor
|
||||
version realtime
|
||||
version ProbeAPI
|
||||
version .
|
||||
356
Common/AnalyticsModels/BaseModel.ts
Normal file
356
Common/AnalyticsModels/BaseModel.ts
Normal file
@@ -0,0 +1,356 @@
|
||||
import TableColumnType from '../Types/BaseDatabase/TableColumnType';
|
||||
import AnalyticsTableColumn from '../Types/AnalyticsDatabase/TableColumn';
|
||||
import BadDataException from '../Types/Exception/BadDataException';
|
||||
import AnalyticsTableEngine from '../Types/AnalyticsDatabase/AnalyticsTableEngine';
|
||||
import { JSONObject, JSONValue } from '../Types/JSON';
|
||||
import ColumnBillingAccessControl from '../Types/BaseDatabase/ColumnBillingAccessControl';
|
||||
import TableBillingAccessControl from '../Types/BaseDatabase/TableBillingAccessControl';
|
||||
import { TableAccessControl } from '../Types/BaseDatabase/AccessControl';
|
||||
import EnableWorkflowOn from '../Types/BaseDatabase/EnableWorkflowOn';
|
||||
import ObjectID from '../Types/ObjectID';
|
||||
import OneUptimeDate from '../Types/Date';
|
||||
|
||||
export default class AnalyticsDataModel {
|
||||
private data: JSONObject = {};
|
||||
|
||||
public constructor(data: {
|
||||
tableName: string;
|
||||
singularName: string;
|
||||
pluralName: string;
|
||||
tableEngine?: AnalyticsTableEngine | undefined;
|
||||
tableColumns: Array<AnalyticsTableColumn>;
|
||||
allowAccessIfSubscriptionIsUnpaid?: boolean | undefined;
|
||||
tableBillingAccessControl?: TableBillingAccessControl | undefined;
|
||||
accessControl?: TableAccessControl | undefined;
|
||||
primaryKeys: Array<string>; // this should be the subset of tableColumns
|
||||
enableWorkflowOn?: EnableWorkflowOn | undefined;
|
||||
}) {
|
||||
const columns: Array<AnalyticsTableColumn> = [...data.tableColumns];
|
||||
|
||||
this.tableName = data.tableName;
|
||||
|
||||
if (data.tableEngine) {
|
||||
this.tableEngine = data.tableEngine;
|
||||
}
|
||||
|
||||
columns.push(
|
||||
new AnalyticsTableColumn({
|
||||
key: '_id',
|
||||
title: 'ID',
|
||||
description: 'ID of this object',
|
||||
required: true,
|
||||
type: TableColumnType.ObjectID,
|
||||
})
|
||||
);
|
||||
|
||||
columns.push(
|
||||
new AnalyticsTableColumn({
|
||||
key: 'createdAt',
|
||||
title: 'Created',
|
||||
description: 'Date and Time when the object was created.',
|
||||
required: true,
|
||||
type: TableColumnType.Date,
|
||||
})
|
||||
);
|
||||
|
||||
columns.push(
|
||||
new AnalyticsTableColumn({
|
||||
key: 'updatedAt',
|
||||
title: 'Updated',
|
||||
description: 'Date and Time when the object was updated.',
|
||||
required: true,
|
||||
type: TableColumnType.Date,
|
||||
})
|
||||
);
|
||||
|
||||
if (!data.primaryKeys || data.primaryKeys.length === 0) {
|
||||
throw new BadDataException('Primary keys are required');
|
||||
}
|
||||
|
||||
// check if primary keys are subset of tableColumns
|
||||
|
||||
data.primaryKeys.forEach((primaryKey: string) => {
|
||||
if (
|
||||
!columns.find((column: AnalyticsTableColumn) => {
|
||||
return column.key === primaryKey;
|
||||
})
|
||||
) {
|
||||
throw new BadDataException(
|
||||
'Primary key ' + primaryKey + ' is not part of tableColumns'
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
this.primaryKeys = data.primaryKeys;
|
||||
this.tableColumns = columns;
|
||||
this.singularName = data.singularName;
|
||||
this.pluralName = data.pluralName;
|
||||
this.tableBillingAccessControl = data.tableBillingAccessControl;
|
||||
this.allowAccessIfSubscriptionIsUnpaid =
|
||||
data.allowAccessIfSubscriptionIsUnpaid || false;
|
||||
this.accessControl = data.accessControl;
|
||||
this.enableWorkflowOn = data.enableWorkflowOn;
|
||||
}
|
||||
|
||||
private _enableWorkflowOn: EnableWorkflowOn | undefined;
|
||||
public get enableWorkflowOn(): EnableWorkflowOn | undefined {
|
||||
return this._enableWorkflowOn;
|
||||
}
|
||||
public set enableWorkflowOn(v: EnableWorkflowOn | undefined) {
|
||||
this._enableWorkflowOn = v;
|
||||
}
|
||||
|
||||
private _accessControl: TableAccessControl | undefined;
|
||||
public get accessControl(): TableAccessControl | undefined {
|
||||
return this._accessControl;
|
||||
}
|
||||
public set accessControl(v: TableAccessControl | undefined) {
|
||||
this._accessControl = v;
|
||||
}
|
||||
|
||||
private _tableColumns: Array<AnalyticsTableColumn> = [];
|
||||
public get tableColumns(): Array<AnalyticsTableColumn> {
|
||||
return this._tableColumns;
|
||||
}
|
||||
public set tableColumns(v: Array<AnalyticsTableColumn>) {
|
||||
this._tableColumns = v;
|
||||
}
|
||||
|
||||
private _tableName: string = '';
|
||||
public get tableName(): string {
|
||||
return this._tableName;
|
||||
}
|
||||
public set tableName(v: string) {
|
||||
this._tableName = v;
|
||||
}
|
||||
|
||||
private _tableEngine: AnalyticsTableEngine = AnalyticsTableEngine.MergeTree;
|
||||
public get tableEngine(): AnalyticsTableEngine {
|
||||
return this._tableEngine;
|
||||
}
|
||||
public set tableEngine(v: AnalyticsTableEngine) {
|
||||
this._tableEngine = v;
|
||||
}
|
||||
|
||||
private _primaryKeys: Array<string> = [];
|
||||
public get primaryKeys(): Array<string> {
|
||||
return this._primaryKeys;
|
||||
}
|
||||
public set primaryKeys(v: Array<string>) {
|
||||
this._primaryKeys = v;
|
||||
}
|
||||
|
||||
private _singularName: string = '';
|
||||
public get singularName(): string {
|
||||
return this._singularName;
|
||||
}
|
||||
public set singularName(v: string) {
|
||||
this._singularName = v;
|
||||
}
|
||||
|
||||
private _pluralName: string = '';
|
||||
public get pluralName(): string {
|
||||
return this._pluralName;
|
||||
}
|
||||
public set pluralName(v: string) {
|
||||
this._pluralName = v;
|
||||
}
|
||||
|
||||
private _tableBillingAccessControl: TableBillingAccessControl | undefined;
|
||||
public get tableBillingAccessControl():
|
||||
| TableBillingAccessControl
|
||||
| undefined {
|
||||
return this._tableBillingAccessControl;
|
||||
}
|
||||
public set tableBillingAccessControl(
|
||||
v: TableBillingAccessControl | undefined
|
||||
) {
|
||||
this._tableBillingAccessControl = v;
|
||||
}
|
||||
|
||||
private _allowAccessIfSubscriptionIsUnpaid: boolean = false;
|
||||
public get allowAccessIfSubscriptionIsUnpaid(): boolean {
|
||||
return this._allowAccessIfSubscriptionIsUnpaid;
|
||||
}
|
||||
public set allowAccessIfSubscriptionIsUnpaid(v: boolean) {
|
||||
this._allowAccessIfSubscriptionIsUnpaid = v;
|
||||
}
|
||||
|
||||
public setColumnValue(columnName: string, value: JSONValue): void {
|
||||
const column: AnalyticsTableColumn | null =
|
||||
this.getTableColumn(columnName);
|
||||
|
||||
if (column) {
|
||||
if (
|
||||
column.type === TableColumnType.ObjectID &&
|
||||
typeof value === 'string'
|
||||
) {
|
||||
value = new ObjectID(value);
|
||||
}
|
||||
|
||||
if (
|
||||
column.type === TableColumnType.Date &&
|
||||
typeof value === 'string'
|
||||
) {
|
||||
value = OneUptimeDate.fromString(value);
|
||||
}
|
||||
|
||||
if (
|
||||
column.type === TableColumnType.JSON &&
|
||||
typeof value === 'string'
|
||||
) {
|
||||
value = JSON.parse(value);
|
||||
}
|
||||
|
||||
return (this.data[columnName] = value as any);
|
||||
}
|
||||
throw new BadDataException('Column ' + columnName + ' does not exist');
|
||||
}
|
||||
|
||||
public getColumnValue<T extends JSONValue>(
|
||||
columnName: string
|
||||
): T | undefined {
|
||||
if (this.getTableColumn(columnName)) {
|
||||
return this.data[columnName] as T;
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
public getTableColumn(name: string): AnalyticsTableColumn | null {
|
||||
const column: AnalyticsTableColumn | undefined = this.tableColumns.find(
|
||||
(column: AnalyticsTableColumn) => {
|
||||
return column.key === name;
|
||||
}
|
||||
);
|
||||
|
||||
if (!column) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return column;
|
||||
}
|
||||
|
||||
public getTableColumns(): Array<AnalyticsTableColumn> {
|
||||
return this.tableColumns;
|
||||
}
|
||||
|
||||
public getTenantColumn(): AnalyticsTableColumn | null {
|
||||
const column: AnalyticsTableColumn | undefined = this.tableColumns.find(
|
||||
(column: AnalyticsTableColumn) => {
|
||||
return column.isTenantId;
|
||||
}
|
||||
);
|
||||
|
||||
if (!column) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return column;
|
||||
}
|
||||
|
||||
public getRequiredColumns(): Array<AnalyticsTableColumn> {
|
||||
return this.tableColumns.filter((column: AnalyticsTableColumn) => {
|
||||
return column.required;
|
||||
});
|
||||
}
|
||||
|
||||
public isDefaultValueColumn(columnName: string): boolean {
|
||||
const column: AnalyticsTableColumn | null =
|
||||
this.getTableColumn(columnName);
|
||||
|
||||
if (!column) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return column.isDefaultValueColumn;
|
||||
}
|
||||
|
||||
public getColumnBillingAccessControl(
|
||||
columnName: string
|
||||
): ColumnBillingAccessControl | null {
|
||||
const column: AnalyticsTableColumn | null =
|
||||
this.getTableColumn(columnName);
|
||||
|
||||
if (!column) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return column.billingAccessControl || null;
|
||||
}
|
||||
|
||||
public get id(): ObjectID | undefined {
|
||||
return this.getColumnValue('_id') as ObjectID | undefined;
|
||||
}
|
||||
public set id(v: ObjectID | undefined) {
|
||||
this.setColumnValue('_id', v);
|
||||
}
|
||||
|
||||
public get _id(): ObjectID | undefined {
|
||||
return this.getColumnValue('_id') as ObjectID | undefined;
|
||||
}
|
||||
public set _id(v: ObjectID | undefined) {
|
||||
this.setColumnValue('_id', v);
|
||||
}
|
||||
|
||||
public get createdAt(): Date | undefined {
|
||||
return this.getColumnValue('createdAt') as Date | undefined;
|
||||
}
|
||||
|
||||
public set createdAt(v: Date | undefined) {
|
||||
this.setColumnValue('createdAt', v);
|
||||
}
|
||||
|
||||
public get updatedAt(): Date | undefined {
|
||||
return this.getColumnValue('updatedAt') as Date | undefined;
|
||||
}
|
||||
|
||||
public set updatedAt(v: Date | undefined) {
|
||||
this.setColumnValue('updatedAt', v);
|
||||
}
|
||||
|
||||
public fromJSON(json: JSONObject): AnalyticsDataModel {
|
||||
for (const key in json) {
|
||||
this.setColumnValue(key, json[key]);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public toJSON(): JSONObject {
|
||||
const json: JSONObject = {};
|
||||
|
||||
this.tableColumns.forEach((column: AnalyticsTableColumn) => {
|
||||
json[column.key] = this.getColumnValue(column.key);
|
||||
});
|
||||
|
||||
return json;
|
||||
}
|
||||
|
||||
public static fromJSONArray<TBaseModel extends AnalyticsDataModel>(
|
||||
modelType: { new (): AnalyticsDataModel },
|
||||
jsonArray: Array<JSONObject>
|
||||
): Array<TBaseModel> {
|
||||
const models: Array<AnalyticsDataModel> = [];
|
||||
|
||||
jsonArray.forEach((json: JSONObject) => {
|
||||
const model: AnalyticsDataModel = new modelType();
|
||||
model.fromJSON(json);
|
||||
models.push(model);
|
||||
});
|
||||
|
||||
return models as Array<TBaseModel>;
|
||||
}
|
||||
|
||||
public static toJSONArray(
|
||||
models: Array<AnalyticsDataModel>
|
||||
): Array<JSONObject> {
|
||||
const json: Array<JSONObject> = [];
|
||||
|
||||
models.forEach((model: AnalyticsDataModel) => {
|
||||
json.push(model.toJSON());
|
||||
});
|
||||
|
||||
return json;
|
||||
}
|
||||
}
|
||||
@@ -1,104 +0,0 @@
|
||||
import TableColumnType from '../Types/BaseDatabase/TableColumnType';
|
||||
import AnalyticsTableColumn from '../Types/AnalyticsDatabase/TableColumn';
|
||||
import BadDataException from '../Types/Exception/BadDataException';
|
||||
import AnalyticsTableEngine from '../Types/AnalyticsDatabase/AnalyticsTableEngine';
|
||||
|
||||
export default class AnalyticsDataModel {
|
||||
private _tableColumns: Array<AnalyticsTableColumn> = [];
|
||||
public get tableColumns(): Array<AnalyticsTableColumn> {
|
||||
return this._tableColumns;
|
||||
}
|
||||
public set tableColumns(v: Array<AnalyticsTableColumn>) {
|
||||
this._tableColumns = v;
|
||||
}
|
||||
|
||||
private _tableName: string = '';
|
||||
public get tableName(): string {
|
||||
return this._tableName;
|
||||
}
|
||||
public set tableName(v: string) {
|
||||
this._tableName = v;
|
||||
}
|
||||
|
||||
private _tableEngine: AnalyticsTableEngine = AnalyticsTableEngine.MergeTree;
|
||||
public get tableEngine(): AnalyticsTableEngine {
|
||||
return this._tableEngine;
|
||||
}
|
||||
public set tableEngine(v: AnalyticsTableEngine) {
|
||||
this._tableEngine = v;
|
||||
}
|
||||
|
||||
private _primaryKeys: Array<string> = [];
|
||||
public get primaryKeys(): Array<string> {
|
||||
return this._primaryKeys;
|
||||
}
|
||||
public set primaryKeys(v: Array<string>) {
|
||||
this._primaryKeys = v;
|
||||
}
|
||||
|
||||
public constructor(data: {
|
||||
tableName: string;
|
||||
tableEngine?: AnalyticsTableEngine | undefined;
|
||||
tableColumns: Array<AnalyticsTableColumn>;
|
||||
primaryKeys: Array<string>; // this should be the subset of tableColumns
|
||||
}) {
|
||||
const columns: Array<AnalyticsTableColumn> = [...data.tableColumns];
|
||||
|
||||
this.tableName = data.tableName;
|
||||
|
||||
if (data.tableEngine) {
|
||||
this.tableEngine = data.tableEngine;
|
||||
}
|
||||
|
||||
columns.push(
|
||||
new AnalyticsTableColumn({
|
||||
key: '_id',
|
||||
title: 'ID',
|
||||
description: 'ID of this object',
|
||||
required: true,
|
||||
type: TableColumnType.ObjectID,
|
||||
})
|
||||
);
|
||||
|
||||
columns.push(
|
||||
new AnalyticsTableColumn({
|
||||
key: 'createdAt',
|
||||
title: 'Created',
|
||||
description: 'Date and Time when the object was created.',
|
||||
required: true,
|
||||
type: TableColumnType.Date,
|
||||
})
|
||||
);
|
||||
|
||||
columns.push(
|
||||
new AnalyticsTableColumn({
|
||||
key: 'updatedAt',
|
||||
title: 'Updated',
|
||||
description: 'Date and Time when the object was updated.',
|
||||
required: true,
|
||||
type: TableColumnType.Date,
|
||||
})
|
||||
);
|
||||
|
||||
if (!data.primaryKeys || data.primaryKeys.length === 0) {
|
||||
throw new BadDataException('Primary keys are required');
|
||||
}
|
||||
|
||||
// check if primary keys are subset of tableColumns
|
||||
|
||||
data.primaryKeys.forEach((primaryKey: string) => {
|
||||
if (
|
||||
!columns.find((column: AnalyticsTableColumn) => {
|
||||
return column.key === primaryKey;
|
||||
})
|
||||
) {
|
||||
throw new BadDataException(
|
||||
'Primary key ' + primaryKey + ' is not part of tableColumns'
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
this.primaryKeys = data.primaryKeys;
|
||||
this.tableColumns = columns;
|
||||
}
|
||||
}
|
||||
@@ -28,17 +28,15 @@ import Permission, {
|
||||
UserPermission,
|
||||
UserTenantAccessPermission,
|
||||
} from '../Types/Permission';
|
||||
import {
|
||||
ColumnAccessControl,
|
||||
ColumnBillingAccessControl,
|
||||
} from '../Types/Database/AccessControl/AccessControl';
|
||||
import { ColumnAccessControl } from '../Types/BaseDatabase/AccessControl';
|
||||
import { getColumnAccessControlForAllColumns } from '../Types/Database/AccessControl/ColumnAccessControl';
|
||||
import BadDataException from '../Types/Exception/BadDataException';
|
||||
import { PlanSelect } from '../Types/Billing/SubscriptionPlan';
|
||||
import { EnableWorkflowOn } from '../Types/Model/EnableWorkflow';
|
||||
import EnableWorkflowOn from '../Types/BaseDatabase/EnableWorkflowOn';
|
||||
import IconProp from '../Types/Icon/IconProp';
|
||||
import Text from '../Types/Text';
|
||||
import { getColumnBillingAccessControlForAllColumns } from '../Types/Database/AccessControl/ColumnBillingAccessControl';
|
||||
import ColumnBillingAccessControl from '../Types/BaseDatabase/ColumnBillingAccessControl';
|
||||
|
||||
export type DbTypes =
|
||||
| string
|
||||
@@ -255,6 +253,10 @@ export default class BaseModel extends BaseEntity {
|
||||
(this as any)[columnName] = value;
|
||||
}
|
||||
|
||||
public removeValue(columnName: string): void {
|
||||
(this as any)[columnName] = undefined;
|
||||
}
|
||||
|
||||
public doesPermissionHaveConditions(
|
||||
permission: Permission
|
||||
): JSONObject | null {
|
||||
|
||||
@@ -18,8 +18,6 @@ export const IntegrationRoute: Route = new Route('/integration');
|
||||
|
||||
export const NotificationRoute: Route = new Route('/notification');
|
||||
|
||||
export const HelmRoute: Route = new Route('/helm-chart');
|
||||
|
||||
export const AccountsRoute: Route = new Route('/accounts');
|
||||
|
||||
export const WorkflowRoute: Route = new Route('/workflow');
|
||||
@@ -28,4 +26,4 @@ export const ApiReferenceRoute: Route = new Route('/reference');
|
||||
|
||||
export const AdminDashboardRoute: Route = new Route('/admin');
|
||||
|
||||
export const ProbeApiRoute: Route = new Route('/probe-api');
|
||||
export const IngestorRoute: Route = new Route('/ingestor');
|
||||
|
||||
@@ -349,6 +349,10 @@ const httpMethodTests: Array<HTTPMethodType> = [
|
||||
name: 'delete',
|
||||
method: HTTPMethod.DELETE,
|
||||
},
|
||||
{
|
||||
name: 'head',
|
||||
method: HTTPMethod.HEAD,
|
||||
},
|
||||
];
|
||||
|
||||
describe.each(httpMethodTests)('$name', ({ name, method }: HTTPMethodType) => {
|
||||
|
||||
85
Common/Tests/Utils/Analytics.test.ts
Normal file
85
Common/Tests/Utils/Analytics.test.ts
Normal file
@@ -0,0 +1,85 @@
|
||||
import Analytics from '../../Utils/Analytics';
|
||||
import Email from '../../Types/Email';
|
||||
import { JSONObject } from '../../Types/JSON';
|
||||
import posthog from 'posthog-js';
|
||||
|
||||
jest.mock('posthog-js', () => {
|
||||
return {
|
||||
init: jest.fn(),
|
||||
identify: jest.fn(),
|
||||
reset: jest.fn(),
|
||||
capture: jest.fn(),
|
||||
};
|
||||
});
|
||||
|
||||
const apiHost: string = 'https://example.com';
|
||||
const apiKey: string = 'your-api-key';
|
||||
|
||||
describe('Analytics Class', () => {
|
||||
afterEach(() => {
|
||||
jest.clearAllMocks();
|
||||
});
|
||||
|
||||
it('should initialize the Analytics class', () => {
|
||||
const analytics: Analytics = new Analytics(apiHost, apiKey);
|
||||
|
||||
expect(posthog.init).toHaveBeenCalledWith(apiKey, {
|
||||
api_host: apiHost,
|
||||
autocapture: false,
|
||||
});
|
||||
expect(analytics.isInitialized).toBe(true);
|
||||
});
|
||||
|
||||
it('should not initialize if apiHost and apiKey are not provided', () => {
|
||||
const analytics: Analytics = new Analytics('', '');
|
||||
|
||||
expect(posthog.init).not.toHaveBeenCalled();
|
||||
expect(analytics.isInitialized).toBe(false);
|
||||
});
|
||||
|
||||
it('should authenticate a user', () => {
|
||||
const analytics: Analytics = new Analytics(apiHost, apiKey);
|
||||
const email: Email = new Email('test@example.com');
|
||||
|
||||
analytics.userAuth(email);
|
||||
expect(posthog.identify).toHaveBeenCalledWith(email.toString());
|
||||
});
|
||||
|
||||
it('should not authenticate a user if not initialized', () => {
|
||||
const analytics: Analytics = new Analytics('', '');
|
||||
const email: Email = new Email('test@example.com');
|
||||
|
||||
analytics.userAuth(email);
|
||||
expect(posthog.identify).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should reset the user session on logout', () => {
|
||||
const analytics: Analytics = new Analytics(apiHost, apiKey);
|
||||
|
||||
analytics.logout();
|
||||
expect(posthog.reset).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should not reset the user session if not initialized', () => {
|
||||
const analytics: Analytics = new Analytics('', '');
|
||||
|
||||
analytics.logout();
|
||||
expect(posthog.reset).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should capture an event with optional data', () => {
|
||||
const analytics: Analytics = new Analytics(apiHost, apiKey);
|
||||
const eventName: string = 'testEvent';
|
||||
const data: JSONObject = { key: 'value' };
|
||||
|
||||
analytics.capture(eventName, data);
|
||||
expect(posthog.capture).toHaveBeenCalledWith(eventName, data);
|
||||
});
|
||||
|
||||
it('should not capture an event if not initialized', () => {
|
||||
const analytics: Analytics = new Analytics('', '');
|
||||
|
||||
analytics.capture('testEvent');
|
||||
expect(posthog.capture).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
34
Common/Tests/Utils/CronTime.test.ts
Normal file
34
Common/Tests/Utils/CronTime.test.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import {
|
||||
EVERY_MINUTE,
|
||||
EVERY_DAY,
|
||||
EVERY_HOUR,
|
||||
EVERY_FIVE_MINUTE,
|
||||
EVERY_FIVE_SECONDS,
|
||||
EVERY_WEEK,
|
||||
} from '../../Utils/CronTime';
|
||||
|
||||
describe('CronTime', () => {
|
||||
test('should return every minute', () => {
|
||||
expect(EVERY_MINUTE).toEqual('* * * * *');
|
||||
});
|
||||
|
||||
test('should return every day', () => {
|
||||
expect(EVERY_DAY).toEqual('0 8 * * *');
|
||||
});
|
||||
|
||||
test('should return every hour', () => {
|
||||
expect(EVERY_HOUR).toEqual('1 * * * *');
|
||||
});
|
||||
|
||||
test('should return every five minute', () => {
|
||||
expect(EVERY_FIVE_MINUTE).toEqual('*/5 * * * *');
|
||||
});
|
||||
|
||||
test('should return every five seconds', () => {
|
||||
expect(EVERY_FIVE_SECONDS).toEqual('*/5 * * * * *');
|
||||
});
|
||||
|
||||
test('should return every week', () => {
|
||||
expect(EVERY_WEEK).toEqual('0 0 * * 0');
|
||||
});
|
||||
});
|
||||
38
Common/Tests/Utils/Faker.test.ts
Normal file
38
Common/Tests/Utils/Faker.test.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
import Faker from '../../Utils/Faker';
|
||||
import Email from '../../Types/Email';
|
||||
import Name from '../../Types/Name';
|
||||
import Phone from '../../Types/Phone';
|
||||
|
||||
describe('Faker Class', () => {
|
||||
it('should generate a random name with alphanumeric characters', () => {
|
||||
expect(Faker.generateName()).toMatch(/^[a-zA-Z0-9]{10}$/);
|
||||
});
|
||||
|
||||
it('should generate a random company name', () => {
|
||||
expect(Faker.generateCompanyName()).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should generate a string of random numbers of specified length', () => {
|
||||
expect(Faker.randomNumbers(8)).toMatch(/^\d{8}$/);
|
||||
});
|
||||
|
||||
it('should generate a user full name', () => {
|
||||
const userFullName: Name = Faker.generateUserFullName();
|
||||
expect(userFullName).toHaveProperty('name');
|
||||
expect(userFullName.name).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should generate a valid email address', () => {
|
||||
const email: Email = Faker.generateEmail();
|
||||
expect(email.email).toMatch(
|
||||
/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,9}$/i
|
||||
);
|
||||
});
|
||||
|
||||
it('should generate a valid phone number', () => {
|
||||
const phone: Phone = Faker.generatePhone();
|
||||
expect(phone.phone).toMatch(
|
||||
/^[+]?[(]?[0-9]{3}[)]?[-\s.]?[0-9]{3}[-\s.]?[0-9]{4,7}$/
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -1,9 +1,12 @@
|
||||
import Slug from '../../Utils/Slug';
|
||||
describe('Slug.getSlug()', () => {
|
||||
test('should return empty string, if name is empty ', () => {
|
||||
test('should return empty string, if name is empty ', () => {
|
||||
expect(Slug.getSlug('')).toEqual('');
|
||||
expect(Slug.getSlug(' ')).toEqual('');
|
||||
});
|
||||
test('should generate a slug from a valid name when name is null', () => {
|
||||
expect(Slug.getSlug(null)).toMatch(/^[a-z0-9-]+$/);
|
||||
});
|
||||
test('should replaces spaces in nonEmpty with hyphen -', () => {
|
||||
expect(Slug.getSlug('this is slug')).toMatch(/this-is-slug/g);
|
||||
});
|
||||
|
||||
@@ -20,6 +20,8 @@ export default class Hostname extends DatabaseProperty {
|
||||
}
|
||||
|
||||
public set hostname(value: string) {
|
||||
value = value.trim();
|
||||
|
||||
if (Hostname.isValid(value)) {
|
||||
this._route = value;
|
||||
} else {
|
||||
|
||||
@@ -209,7 +209,15 @@ export default class URL extends DatabaseProperty {
|
||||
return this;
|
||||
}
|
||||
|
||||
public addQueryParam(paramName: string, value: string): URL {
|
||||
public addQueryParam(
|
||||
paramName: string,
|
||||
value: string,
|
||||
encode?: boolean | undefined
|
||||
): URL {
|
||||
if (encode) {
|
||||
value = encodeURIComponent(value);
|
||||
}
|
||||
|
||||
this.params[paramName] = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
import { ColumnAccessControl } from '../BaseDatabase/AccessControl';
|
||||
import ColumnBillingAccessControl from '../BaseDatabase/ColumnBillingAccessControl';
|
||||
import TableColumnType from '../BaseDatabase/TableColumnType';
|
||||
import { JSONValue } from '../JSON';
|
||||
|
||||
export default class AnalyticsTableColumn {
|
||||
private _key: string = 'id';
|
||||
|
||||
public get key(): string {
|
||||
return this._key;
|
||||
}
|
||||
@@ -33,6 +37,14 @@ export default class AnalyticsTableColumn {
|
||||
this._required = v;
|
||||
}
|
||||
|
||||
private _isTenantId: boolean = false;
|
||||
public get isTenantId(): boolean {
|
||||
return this._isTenantId;
|
||||
}
|
||||
public set isTenantId(v: boolean) {
|
||||
this._isTenantId = v;
|
||||
}
|
||||
|
||||
private _type: TableColumnType = TableColumnType.ShortText;
|
||||
public get type(): TableColumnType {
|
||||
return this._type;
|
||||
@@ -41,17 +53,82 @@ export default class AnalyticsTableColumn {
|
||||
this._type = v;
|
||||
}
|
||||
|
||||
private _forceGetDefaultValueOnCreate?:
|
||||
| (() => Date | string | number | boolean)
|
||||
| undefined;
|
||||
public get forceGetDefaultValueOnCreate():
|
||||
| (() => Date | string | number | boolean)
|
||||
| undefined {
|
||||
return this._forceGetDefaultValueOnCreate;
|
||||
}
|
||||
public set forceGetDefaultValueOnCreate(
|
||||
v: (() => Date | string | number | boolean) | undefined
|
||||
) {
|
||||
this._forceGetDefaultValueOnCreate = v;
|
||||
}
|
||||
|
||||
private _defaultValue: JSONValue | undefined;
|
||||
public get defaultValue(): JSONValue {
|
||||
return this._defaultValue;
|
||||
}
|
||||
public set defaultValue(v: JSONValue) {
|
||||
this._defaultValue = v;
|
||||
}
|
||||
|
||||
public get isDefaultValueColumn(): boolean {
|
||||
return Boolean(this.defaultValue !== undefined);
|
||||
}
|
||||
|
||||
private _billingAccessControl?: ColumnBillingAccessControl | undefined;
|
||||
public get billingAccessControl(): ColumnBillingAccessControl | undefined {
|
||||
return this._billingAccessControl;
|
||||
}
|
||||
public set billingAccessControl(v: ColumnBillingAccessControl | undefined) {
|
||||
this._billingAccessControl = v;
|
||||
}
|
||||
|
||||
private _allowAccessIfSubscriptionIsUnpaid: boolean = false;
|
||||
public get allowAccessIfSubscriptionIsUnpaid(): boolean {
|
||||
return this._allowAccessIfSubscriptionIsUnpaid;
|
||||
}
|
||||
public set allowAccessIfSubscriptionIsUnpaid(v: boolean) {
|
||||
this._allowAccessIfSubscriptionIsUnpaid = v;
|
||||
}
|
||||
|
||||
private _accessControl: ColumnAccessControl | undefined;
|
||||
public get accessControl(): ColumnAccessControl | undefined {
|
||||
return this._accessControl;
|
||||
}
|
||||
public set accessControl(v: ColumnAccessControl | undefined) {
|
||||
this._accessControl = v;
|
||||
}
|
||||
|
||||
public constructor(data: {
|
||||
key: string;
|
||||
title: string;
|
||||
description: string;
|
||||
required: boolean;
|
||||
defaultValue?: JSONValue | undefined;
|
||||
type: TableColumnType;
|
||||
billingAccessControl?: ColumnBillingAccessControl | undefined;
|
||||
isTenantId?: boolean | undefined;
|
||||
accessControl?: ColumnAccessControl | undefined;
|
||||
allowAccessIfSubscriptionIsUnpaid?: boolean | undefined;
|
||||
forceGetDefaultValueOnCreate?:
|
||||
| (() => Date | string | number | boolean)
|
||||
| undefined;
|
||||
}) {
|
||||
this.accessControl = data.accessControl;
|
||||
this.key = data.key;
|
||||
this.title = data.title;
|
||||
this.description = data.description;
|
||||
this.required = data.required;
|
||||
this.type = data.type;
|
||||
this.isTenantId = data.isTenantId || false;
|
||||
this.forceGetDefaultValueOnCreate = data.forceGetDefaultValueOnCreate;
|
||||
this.defaultValue = data.defaultValue;
|
||||
this.billingAccessControl = data.billingAccessControl;
|
||||
this.allowAccessIfSubscriptionIsUnpaid =
|
||||
data.allowAccessIfSubscriptionIsUnpaid || false;
|
||||
}
|
||||
}
|
||||
|
||||
11
Common/Types/BaseDatabase/AccessControl.ts
Normal file
11
Common/Types/BaseDatabase/AccessControl.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import Permission from '../Permission';
|
||||
|
||||
export interface ColumnAccessControl {
|
||||
read: Array<Permission>;
|
||||
create: Array<Permission>;
|
||||
update: Array<Permission>;
|
||||
}
|
||||
|
||||
export interface TableAccessControl extends ColumnAccessControl {
|
||||
delete: Array<Permission>;
|
||||
}
|
||||
7
Common/Types/BaseDatabase/ColumnBillingAccessControl.ts
Normal file
7
Common/Types/BaseDatabase/ColumnBillingAccessControl.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { PlanSelect } from '../Billing/SubscriptionPlan';
|
||||
|
||||
export default interface ColumnBillingAccessControl {
|
||||
create: PlanSelect;
|
||||
read: PlanSelect;
|
||||
update: PlanSelect;
|
||||
}
|
||||
@@ -20,4 +20,5 @@ export default interface DatabaseCommonInteractionProps {
|
||||
ignoreHooks?: boolean | undefined;
|
||||
currentPlan?: PlanSelect | undefined;
|
||||
isSubscriptionUnpaid?: boolean | undefined;
|
||||
isMasterAdmin?: boolean | undefined;
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
import Permission, { UserPermission } from '../Permission';
|
||||
import DatabaseCommonInteractionProps from './DatabaseCommonInteractionProps';
|
||||
|
||||
export default class DatabaseCommonInteractionPropsUtil {
|
||||
public static getUserPermissions(
|
||||
props: DatabaseCommonInteractionProps
|
||||
): Array<UserPermission> {
|
||||
// Check first if the user has Global Permissions.
|
||||
// Global permissions includes all the tenantId user has access to.
|
||||
// and it includes all the global permissions that applies to all the tenant, like PUBLIC.
|
||||
if (!props.userGlobalAccessPermission) {
|
||||
props.userGlobalAccessPermission = {
|
||||
globalPermissions: [Permission.Public],
|
||||
projectIds: [],
|
||||
_type: 'UserGlobalAccessPermission',
|
||||
};
|
||||
}
|
||||
|
||||
// If the PUBLIC Permission is not found in global permissions, include it.
|
||||
if (
|
||||
props.userGlobalAccessPermission &&
|
||||
!props.userGlobalAccessPermission.globalPermissions.includes(
|
||||
Permission.Public
|
||||
)
|
||||
) {
|
||||
props.userGlobalAccessPermission.globalPermissions.push(
|
||||
Permission.Public
|
||||
); // add public permission if not already.
|
||||
}
|
||||
|
||||
// If the CurrentUser Permission is not found in global permissions, include it.
|
||||
if (
|
||||
props.userId &&
|
||||
props.userGlobalAccessPermission &&
|
||||
!props.userGlobalAccessPermission.globalPermissions.includes(
|
||||
Permission.CurrentUser
|
||||
)
|
||||
) {
|
||||
props.userGlobalAccessPermission.globalPermissions.push(
|
||||
Permission.CurrentUser
|
||||
);
|
||||
}
|
||||
|
||||
let userPermissions: Array<UserPermission> = [];
|
||||
|
||||
// Include global permission in userPermissions.
|
||||
|
||||
if (props.userGlobalAccessPermission) {
|
||||
/// take global permissions.
|
||||
userPermissions =
|
||||
props.userGlobalAccessPermission.globalPermissions.map(
|
||||
(permission: Permission) => {
|
||||
return {
|
||||
permission: permission,
|
||||
labelIds: [],
|
||||
_type: 'UserPermission',
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
if (props.tenantId && props.userTenantAccessPermission) {
|
||||
// Include Tenant Permission in userPermissions.
|
||||
userPermissions = [
|
||||
...userPermissions,
|
||||
...(props.userTenantAccessPermission[props.tenantId.toString()]
|
||||
?.permissions || []),
|
||||
];
|
||||
}
|
||||
|
||||
return userPermissions;
|
||||
}
|
||||
}
|
||||
6
Common/Types/BaseDatabase/EnableWorkflowOn.ts
Normal file
6
Common/Types/BaseDatabase/EnableWorkflowOn.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
export default interface EnableWorkflowOn {
|
||||
create?: boolean | undefined;
|
||||
update?: boolean | undefined;
|
||||
delete?: boolean | undefined;
|
||||
read?: boolean | undefined;
|
||||
}
|
||||
8
Common/Types/BaseDatabase/TableBillingAccessControl.ts
Normal file
8
Common/Types/BaseDatabase/TableBillingAccessControl.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import { PlanSelect } from '../Billing/SubscriptionPlan';
|
||||
|
||||
export default interface TableBillingAccessControl {
|
||||
create: PlanSelect;
|
||||
read: PlanSelect;
|
||||
update: PlanSelect;
|
||||
delete: PlanSelect;
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
import { PlanSelect } from '../../Billing/SubscriptionPlan';
|
||||
import Permission from '../../Permission';
|
||||
|
||||
export interface ColumnAccessControl {
|
||||
read: Array<Permission>;
|
||||
create: Array<Permission>;
|
||||
update: Array<Permission>;
|
||||
}
|
||||
|
||||
export interface TableAccessControl extends ColumnAccessControl {
|
||||
delete: Array<Permission>;
|
||||
}
|
||||
|
||||
export interface BillingAccessControl {
|
||||
create: PlanSelect;
|
||||
read: PlanSelect;
|
||||
update: PlanSelect;
|
||||
delete: PlanSelect;
|
||||
}
|
||||
|
||||
export interface ColumnBillingAccessControl {
|
||||
create: PlanSelect;
|
||||
read: PlanSelect;
|
||||
update: PlanSelect;
|
||||
}
|
||||
@@ -2,7 +2,7 @@ import 'reflect-metadata';
|
||||
import BaseModel from '../../../Models/BaseModel';
|
||||
import Dictionary from '../../Dictionary';
|
||||
import { ReflectionMetadataType } from '../../Reflection';
|
||||
import { ColumnAccessControl } from './AccessControl';
|
||||
import { ColumnAccessControl } from '../../BaseDatabase/AccessControl';
|
||||
|
||||
const accessControlSymbol: Symbol = Symbol('ColumnAccessControl');
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import 'reflect-metadata';
|
||||
import BaseModel from '../../../Models/BaseModel';
|
||||
import Dictionary from '../../Dictionary';
|
||||
import { ReflectionMetadataType } from '../../Reflection';
|
||||
import { ColumnBillingAccessControl } from './AccessControl';
|
||||
import ColumnBillingAccessControl from '../../BaseDatabase/ColumnBillingAccessControl';
|
||||
|
||||
const accessControlSymbol: Symbol = Symbol('ColumnBillingAccessControl');
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { TableAccessControl } from './AccessControl';
|
||||
import { TableAccessControl } from '../../BaseDatabase/AccessControl';
|
||||
|
||||
export default (accessControl: TableAccessControl) => {
|
||||
return (ctr: Function) => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { BillingAccessControl } from './AccessControl';
|
||||
import TableBillingAccessControl from '../../BaseDatabase/TableBillingAccessControl';
|
||||
|
||||
export default (accessControl: BillingAccessControl) => {
|
||||
export default (accessControl: TableBillingAccessControl) => {
|
||||
return (ctr: Function) => {
|
||||
if (accessControl.create) {
|
||||
ctr.prototype.createBillingPlan = accessControl.create;
|
||||
|
||||
7
Common/Types/Database/EnableWorkflow.ts
Normal file
7
Common/Types/Database/EnableWorkflow.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import EnableWorkflowOn from '../BaseDatabase/EnableWorkflowOn';
|
||||
|
||||
export default (enableWorkflowOn: EnableWorkflowOn) => {
|
||||
return (ctr: Function) => {
|
||||
ctr.prototype.enableWorkflowOn = enableWorkflowOn;
|
||||
};
|
||||
};
|
||||
@@ -16,6 +16,7 @@ enum IconProp {
|
||||
Database = 'Database',
|
||||
ChevronDown = 'ChevronDown',
|
||||
Pencil = 'Pencil',
|
||||
Copy = 'Copy',
|
||||
ChevronRight = 'ChevronRight',
|
||||
ChevronUp = 'ChevronUp',
|
||||
Play = 'Play',
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
export interface EnableWorkflowOn {
|
||||
create?: boolean | undefined;
|
||||
update?: boolean | undefined;
|
||||
delete?: boolean | undefined;
|
||||
read?: boolean | undefined;
|
||||
}
|
||||
|
||||
export default (enableWorkflowOn: EnableWorkflowOn) => {
|
||||
return (ctr: Function) => {
|
||||
ctr.prototype.enableWorkflowOn = enableWorkflowOn;
|
||||
};
|
||||
};
|
||||
@@ -9,6 +9,7 @@ export enum CheckOn {
|
||||
RequestBody = 'Request Body',
|
||||
RequestHeader = 'Request Header',
|
||||
RequestHeaderValue = 'Request Header Value',
|
||||
JavaScriptExpression = 'JavaScript Expression',
|
||||
}
|
||||
|
||||
export interface CriteriaFilter {
|
||||
@@ -34,6 +35,7 @@ export enum FilterType {
|
||||
False = 'False',
|
||||
NotRecievedInMinutes = 'Not Recieved In Minutes',
|
||||
RecievedInMinutes = 'Recieved In Minutes',
|
||||
EvaluatesToTrue = 'Evaluates To True',
|
||||
}
|
||||
|
||||
export enum FilterCondition {
|
||||
|
||||
@@ -58,7 +58,7 @@ export default class MonitorStep extends DatabaseProperty {
|
||||
}
|
||||
|
||||
public get id(): ObjectID {
|
||||
return new ObjectID(this.data?.id!);
|
||||
return new ObjectID(this.data?.id as string);
|
||||
}
|
||||
|
||||
public set id(v: ObjectID) {
|
||||
|
||||
@@ -14,8 +14,13 @@ export default class ObjectID extends DatabaseProperty {
|
||||
this._id = v;
|
||||
}
|
||||
|
||||
public constructor(id: string) {
|
||||
public constructor(id: string | ObjectID) {
|
||||
super();
|
||||
|
||||
if (id instanceof ObjectID) {
|
||||
id = id.toString();
|
||||
}
|
||||
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ export default class Port extends DatabaseProperty {
|
||||
public static isValid(port: number | string | PositiveNumber): boolean {
|
||||
if (typeof port === Typeof.String) {
|
||||
try {
|
||||
port = Number.parseInt(port.toString(), 10);
|
||||
port = Number.parseInt(port.toString().trim(), 10);
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,10 @@ export default class PositiveNumber {
|
||||
|
||||
public constructor(positiveNumber: number | string) {
|
||||
if (typeof positiveNumber === Typeof.String) {
|
||||
positiveNumber = Number.parseInt(positiveNumber.toString(), 10);
|
||||
positiveNumber = Number.parseInt(
|
||||
positiveNumber.toString().trim(),
|
||||
10
|
||||
);
|
||||
if (isNaN(positiveNumber)) {
|
||||
throw new BadDataException(`Invalid number: ${positiveNumber}`);
|
||||
}
|
||||
|
||||
@@ -42,25 +42,12 @@ export default class WebsiteRequest {
|
||||
try {
|
||||
response = await axios(url.toString(), axiosOptions);
|
||||
} catch (err: unknown) {
|
||||
if (
|
||||
err &&
|
||||
err.toString().includes('404') &&
|
||||
options.isHeadRequest
|
||||
) {
|
||||
if (err && options.isHeadRequest) {
|
||||
// 404 because of HEAD request. Retry with GET request.
|
||||
response = await axios(url.toString(), {
|
||||
...axiosOptions,
|
||||
method: HTTPMethod.GET,
|
||||
});
|
||||
} else if (
|
||||
err &&
|
||||
Object.keys(err).includes('code') &&
|
||||
(err as any)['code'] === 'HPE_INVALID_CONSTANT'
|
||||
) {
|
||||
response = await axios(url.toString(), {
|
||||
...axiosOptions,
|
||||
method: HTTPMethod.GET,
|
||||
});
|
||||
} else {
|
||||
throw err;
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ import ObjectID from 'Common/Types/ObjectID';
|
||||
import { JSONObject } from 'Common/Types/JSON';
|
||||
import JSONFunctions from 'Common/Types/JSONFunctions';
|
||||
import CreateBy from '../Types/Database/CreateBy';
|
||||
import DatabaseCommonInteractionProps from 'Common/Types/Database/DatabaseCommonInteractionProps';
|
||||
import DatabaseCommonInteractionProps from 'Common/Types/BaseDatabase/DatabaseCommonInteractionProps';
|
||||
import Query from '../Types/Database/Query';
|
||||
import Select from '../Types/Database/Select';
|
||||
import Sort from '../Types/Database/Sort';
|
||||
@@ -268,7 +268,7 @@ export default class BaseAPI<
|
||||
// check for root permissions.
|
||||
|
||||
if (props.userType === UserType.MasterAdmin) {
|
||||
props.isRoot = true;
|
||||
props.isMasterAdmin = true;
|
||||
}
|
||||
|
||||
return props;
|
||||
|
||||
@@ -83,10 +83,6 @@ export default class UserAPI extends BaseAPI<
|
||||
throw new BadDataException('Project not found');
|
||||
}
|
||||
|
||||
if (!project) {
|
||||
throw new BadDataException('Project not found');
|
||||
}
|
||||
|
||||
if (!project.paymentProviderCustomerId) {
|
||||
throw new BadDataException(
|
||||
'Payment Provider customer not found'
|
||||
@@ -146,6 +142,16 @@ export default class UserAPI extends BaseAPI<
|
||||
project.paymentProviderMeteredSubscriptionId as string
|
||||
);
|
||||
|
||||
// if subscription is cancelled, create a new subscription and update project.
|
||||
|
||||
if (
|
||||
meteredSubscriptionState ===
|
||||
SubscriptionStatus.Canceled ||
|
||||
subscriptionState === SubscriptionStatus.Canceled
|
||||
) {
|
||||
await ProjectService.reactiveSubscription(project.id!);
|
||||
}
|
||||
|
||||
await ProjectService.updateOneById({
|
||||
id: project.id!,
|
||||
data: {
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
} from '../Utils/Express';
|
||||
import Response from '../Utils/Response';
|
||||
import BaseAPI from './BaseAPI';
|
||||
import ObjectID from 'Common/Types/ObjectID';
|
||||
// import ObjectID from 'Common/Types/ObjectID';
|
||||
|
||||
export default class GlobalConfigAPI extends BaseAPI<
|
||||
GlobalConfig,
|
||||
@@ -26,20 +26,20 @@ export default class GlobalConfigAPI extends BaseAPI<
|
||||
next: NextFunction
|
||||
) => {
|
||||
try {
|
||||
const globalConfig: GlobalConfig | null =
|
||||
await GlobalConfigService.findOneById({
|
||||
id: ObjectID.getZeroObjectID(),
|
||||
select: {
|
||||
useHttps: true,
|
||||
},
|
||||
props: {
|
||||
isRoot: true,
|
||||
},
|
||||
});
|
||||
// const globalConfig: GlobalConfig | null =
|
||||
// await GlobalConfigService.findOneById({
|
||||
// id: ObjectID.getZeroObjectID(),
|
||||
// select: {
|
||||
// useHttps: true,
|
||||
// },
|
||||
// props: {
|
||||
// isRoot: true,
|
||||
// },
|
||||
// });
|
||||
|
||||
return Response.sendJsonObjectResponse(req, res, {
|
||||
USE_HTTPS:
|
||||
globalConfig?.useHttps?.toString() || 'false',
|
||||
// USE_HTTPS:
|
||||
// globalConfig?.useHttps?.toString() || 'false',
|
||||
});
|
||||
} catch (err) {
|
||||
next(err);
|
||||
|
||||
@@ -13,7 +13,7 @@ import BaseAPI from './BaseAPI';
|
||||
import LIMIT_MAX from 'Common/Types/Database/LimitMax';
|
||||
import PositiveNumber from 'Common/Types/PositiveNumber';
|
||||
|
||||
export default class ProbeAPI extends BaseAPI<Probe, ProbeServiceType> {
|
||||
export default class Ingestor extends BaseAPI<Probe, ProbeServiceType> {
|
||||
public constructor() {
|
||||
super(Probe, ProbeService);
|
||||
|
||||
|
||||
@@ -12,10 +12,10 @@ import {
|
||||
} from '../Utils/Express';
|
||||
import TeamMemberService from '../Services/TeamMemberService';
|
||||
import { LIMIT_PER_PROJECT } from 'Common/Types/Database/LimitMax';
|
||||
import NotAuthorizedException from 'Common/Types/Exception/NotAuthorizedException';
|
||||
import PositiveNumber from 'Common/Types/PositiveNumber';
|
||||
import Response from '../Utils/Response';
|
||||
import TeamMember from 'Model/Models/TeamMember';
|
||||
import NotAuthenticatedException from 'Common/Types/Exception/NotAuthenticatedException';
|
||||
|
||||
export default class ProjectAPI extends BaseAPI<Project, ProjectServiceType> {
|
||||
public constructor() {
|
||||
@@ -35,7 +35,7 @@ export default class ProjectAPI extends BaseAPI<Project, ProjectServiceType> {
|
||||
) => {
|
||||
try {
|
||||
if (!(req as OneUptimeRequest).userAuthorization?.userId) {
|
||||
throw new NotAuthorizedException(
|
||||
throw new NotAuthenticatedException(
|
||||
'User should be logged in to access this API'
|
||||
);
|
||||
}
|
||||
|
||||
@@ -20,6 +20,8 @@ import StatusCode from 'Common/Types/API/StatusCode';
|
||||
import Project from 'Model/Models/Project';
|
||||
import ProjectService from '../Services/ProjectService';
|
||||
import DatabaseConfig from '../DatabaseConfig';
|
||||
import { PlanSelect } from 'Common/Types/Billing/SubscriptionPlan';
|
||||
import ObjectID from 'Common/Types/ObjectID';
|
||||
|
||||
export default class ResellerPlanAPI extends BaseAPI<
|
||||
ResellerPlan,
|
||||
@@ -135,10 +137,12 @@ export default class ResellerPlanAPI extends BaseAPI<
|
||||
const promoCode: PromoCode = new PromoCode();
|
||||
|
||||
promoCode.promoCodeId = couponcode;
|
||||
promoCode.resellerId = resellerPlan?.reseller.id!;
|
||||
promoCode.resellerPlanId = resellerPlan?.id!;
|
||||
promoCode.resellerId = resellerPlan?.reseller
|
||||
.id as ObjectID;
|
||||
promoCode.resellerPlanId = resellerPlan?.id as ObjectID;
|
||||
promoCode.userEmail = userEmail;
|
||||
promoCode.planType = resellerPlan?.planType!;
|
||||
promoCode.planType =
|
||||
resellerPlan?.planType as PlanSelect;
|
||||
promoCode.resellerLicenseId = licenseKey || '';
|
||||
|
||||
await PromoCodeService.create({
|
||||
@@ -244,7 +248,7 @@ export default class ResellerPlanAPI extends BaseAPI<
|
||||
await ProjectService.deleteOneBy({
|
||||
query: {
|
||||
resellerLicenseId: licenseKey,
|
||||
_id: project.id?.toString()!,
|
||||
_id: project.id?.toString() as string,
|
||||
},
|
||||
props: {
|
||||
isRoot: true,
|
||||
|
||||
@@ -30,7 +30,7 @@ import MonitorStatusService from '../Services/MonitorStatusService';
|
||||
import OneUptimeDate from 'Common/Types/Date';
|
||||
import MonitorStatusTimelineService from '../Services/MonitorStatusTimelineService';
|
||||
import QueryHelper from '../Types/Database/QueryHelper';
|
||||
import SortOrder from 'Common/Types/Database/SortOrder';
|
||||
import SortOrder from 'Common/Types/BaseDatabase/SortOrder';
|
||||
import IncidentService from '../Services/IncidentService';
|
||||
import IncidentPublicNote from 'Model/Models/IncidentPublicNote';
|
||||
import IncidentPublicNoteService from '../Services/IncidentPublicNoteService';
|
||||
@@ -47,7 +47,7 @@ import IncidentStateTimeline from 'Model/Models/IncidentStateTimeline';
|
||||
import IncidentStateTimelineService from '../Services/IncidentStateTimelineService';
|
||||
import ScheduledMaintenanceStateTimeline from 'Model/Models/ScheduledMaintenanceStateTimeline';
|
||||
import ScheduledMaintenanceStateTimelineService from '../Services/ScheduledMaintenanceStateTimelineService';
|
||||
import DatabaseCommonInteractionProps from 'Common/Types/Database/DatabaseCommonInteractionProps';
|
||||
import DatabaseCommonInteractionProps from 'Common/Types/BaseDatabase/DatabaseCommonInteractionProps';
|
||||
import Query from '../Types/Database/Query';
|
||||
import JSONFunctions from 'Common/Types/JSONFunctions';
|
||||
import GreenlockChallenge from 'Model/Models/GreenlockChallenge';
|
||||
|
||||
@@ -37,9 +37,11 @@ export default class DatabaseConfig {
|
||||
}
|
||||
|
||||
public static async getHttpProtocol(): Promise<Protocol> {
|
||||
return (await DatabaseConfig.getFromGlobalConfig('useHttps'))
|
||||
? Protocol.HTTPS
|
||||
: Protocol.HTTP;
|
||||
return Promise.resolve(
|
||||
process.env['HTTP_PROTOCOL'] === 'https'
|
||||
? Protocol.HTTPS
|
||||
: Protocol.HTTP
|
||||
);
|
||||
}
|
||||
|
||||
public static async getAccountsUrl(): Promise<URL> {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import ObjectID from 'Common/Types/ObjectID';
|
||||
import Port from 'Common/Types/Port';
|
||||
import Hostname from 'Common/Types/API/Hostname';
|
||||
import Route from 'Common/Types/API/Route';
|
||||
import SubscriptionPlan from 'Common/Types/Billing/SubscriptionPlan';
|
||||
import { JSONObject } from 'Common/Types/JSON';
|
||||
|
||||
@@ -62,28 +61,65 @@ export const ClusterKey: ObjectID = new ObjectID(
|
||||
|
||||
export const HasClusterKey: boolean = Boolean(process.env['ONEUPTIME_SECRET']);
|
||||
|
||||
export const RealtimeHostname: Hostname = Hostname.fromString('realtime:3300');
|
||||
export const RealtimeHostname: Hostname = Hostname.fromString(
|
||||
`${process.env['SERVER_REALTIME_HOSTNAME'] || 'localhost'}:${
|
||||
process.env['REALTIME_PORT'] || 80
|
||||
}`
|
||||
);
|
||||
|
||||
export const NotificationHostname: Hostname =
|
||||
Hostname.fromString('notification:3191');
|
||||
export const NotificationHostname: Hostname = Hostname.fromString(
|
||||
`${process.env['SERVER_NOTIFICATION_HOSTNAME'] || 'localhost'}:${
|
||||
process.env['NOTIFICATION_PORT'] || 80
|
||||
}`
|
||||
);
|
||||
|
||||
export const WorkerHostname: Hostname = Hostname.fromString('worker:3452');
|
||||
export const WorkerHostname: Hostname = Hostname.fromString(
|
||||
`${process.env['SERVER_WORKERS_HOSTNAME'] || 'localhost'}:${
|
||||
process.env['WORKERS_PORT'] || 80
|
||||
}`
|
||||
);
|
||||
|
||||
export const LinkShortenerHostname: Route = new Route('link-shortener:3521');
|
||||
export const LinkShortenerHostname: Hostname = Hostname.fromString(
|
||||
`${process.env['SERVER_LINK_SHORTENER_HOSTNAME' || 'localhost']}:${
|
||||
process.env['LINK_SHORTENER_PORT'] || 80
|
||||
}`
|
||||
);
|
||||
|
||||
export const WorkflowHostname: Hostname = Hostname.fromString('workflow:3099');
|
||||
export const WorkflowHostname: Hostname = Hostname.fromString(
|
||||
`${process.env['SERVER_WORKFLOW_HOSTNAME'] || 'localhost'}:${
|
||||
process.env['WORKFLOW_PORT'] || 80
|
||||
}`
|
||||
);
|
||||
|
||||
export const DashboardApiHostname: Hostname =
|
||||
Hostname.fromString('dashboard-api:3002');
|
||||
export const DashboardApiHostname: Hostname = Hostname.fromString(
|
||||
`${process.env['SERVER_DASHBOARD_API_HOSTNAME'] || 'localhost'}:${
|
||||
process.env['DASHBOARD_API_PORT'] || 80
|
||||
}`
|
||||
);
|
||||
|
||||
export const ProbeApiHostname: Hostname = Hostname.fromString('probe-api:3400');
|
||||
export const IngestorHostname: Hostname = Hostname.fromString(
|
||||
`${process.env['SERVER_INGESTOR_HOSTNAME'] || 'localhost'}:${
|
||||
process.env['INGESTOR_PORT'] || 80
|
||||
}`
|
||||
);
|
||||
|
||||
export const AccountsHostname: Hostname = Hostname.fromString('accounts:3003');
|
||||
export const AccountsHostname: Hostname = Hostname.fromString(
|
||||
`${process.env['SERVER_ACCOUNTS_HOSTNAME'] || 'localhost'}:${
|
||||
process.env['ACCOUNTS_PORT'] || 80
|
||||
}`
|
||||
);
|
||||
|
||||
export const HomeHostname: Hostname = Hostname.fromString('home:1444');
|
||||
export const HomeHostname: Hostname = Hostname.fromString(
|
||||
`${process.env['SERVER_HOME_HOSTNAME'] || 'localhost'}:${
|
||||
process.env['HOME_PORT'] || 80
|
||||
}`
|
||||
);
|
||||
|
||||
export const DashboardHostname: Hostname =
|
||||
Hostname.fromString('dashboard:3000');
|
||||
export const DashboardHostname: Hostname = Hostname.fromString(
|
||||
`${process.env['SERVER_DASHBOARD_HOSTNAME'] || 'localhost'}:${
|
||||
process.env['DASHBOARD_PORT'] || 80
|
||||
}`
|
||||
);
|
||||
|
||||
export const Env: string = process.env['NODE_ENV'] || 'production';
|
||||
|
||||
|
||||
@@ -39,6 +39,16 @@ export default class ClickhouseDatabase {
|
||||
const connectToDatabase: Function =
|
||||
async (): Promise<ClickhouseClient> => {
|
||||
try {
|
||||
const defaultDbClient: ClickhouseClient = createClient({
|
||||
...dataSourceOptions,
|
||||
database: 'default',
|
||||
});
|
||||
await defaultDbClient.exec({
|
||||
query: `CREATE DATABASE IF NOT EXISTS ${dataSourceOptions.database}`,
|
||||
});
|
||||
|
||||
await defaultDbClient.close();
|
||||
|
||||
const clickhouseClient: ClickhouseClient =
|
||||
createClient(dataSourceOptions);
|
||||
this.dataSource = clickhouseClient;
|
||||
|
||||
@@ -49,6 +49,35 @@ export default abstract class Redis {
|
||||
|
||||
this.client = new RedisClient(redisOptions);
|
||||
|
||||
// Listen to 'error' events to the Redis connection
|
||||
this.client.on('error', (error: Error) => {
|
||||
if ((error as any).code === 'ECONNRESET') {
|
||||
logger.error(
|
||||
'Connection to Redis Session Store timed out.'
|
||||
);
|
||||
} else if ((error as any).code === 'ECONNREFUSED') {
|
||||
logger.error('Connection to Redis Session Store refused!');
|
||||
} else {
|
||||
logger.error(error);
|
||||
}
|
||||
});
|
||||
|
||||
// Listen to 'reconnecting' event to Redis
|
||||
this.client.on('reconnecting', () => {
|
||||
if (this.client?.status === 'reconnecting') {
|
||||
logger.error('Reconnecting to Redis Session Store...');
|
||||
} else {
|
||||
logger.error('Error reconnecting to Redis Session Store.');
|
||||
}
|
||||
});
|
||||
|
||||
// Listen to the 'connect' event to Redis
|
||||
this.client.on('connect', (err: Error) => {
|
||||
if (!err) {
|
||||
logger.info('Connected to Redis Session Store!');
|
||||
}
|
||||
});
|
||||
|
||||
const connectToDatabase: Function = async (
|
||||
client: RedisClient
|
||||
): Promise<void> => {
|
||||
|
||||
@@ -29,6 +29,7 @@ import SsoAuthorizationException from 'Common/Types/Exception/SsoAuthorizationEx
|
||||
import JSONWebTokenData from 'Common/Types/JsonWebTokenData';
|
||||
import logger from '../Utils/Logger';
|
||||
import Exception from 'Common/Types/Exception/Exception';
|
||||
import CookieUtil from '../Utils/Cookie';
|
||||
|
||||
export default class UserMiddleware {
|
||||
/*
|
||||
@@ -38,19 +39,14 @@ export default class UserMiddleware {
|
||||
* Returns: 401: User is unauthorized since unauthorized token was present.
|
||||
*/
|
||||
|
||||
public static getAccessToken(req: ExpressRequest): string | null {
|
||||
let accessToken: string | null = null;
|
||||
public static getAccessToken(req: ExpressRequest): string | undefined {
|
||||
let accessToken: string | undefined = undefined;
|
||||
|
||||
if (req.headers['authorization']) {
|
||||
accessToken = req.headers['authorization'] as string;
|
||||
}
|
||||
|
||||
if (req.query['accessToken']) {
|
||||
accessToken = req.query['accessToken'] as string;
|
||||
}
|
||||
|
||||
if (accessToken?.includes(' ')) {
|
||||
accessToken = accessToken.split(' ')[1] || '';
|
||||
if (CookieUtil.getCookie(req, CookieUtil.getUserTokenKey())) {
|
||||
accessToken = CookieUtil.getCookie(
|
||||
req,
|
||||
CookieUtil.getUserTokenKey()
|
||||
);
|
||||
}
|
||||
|
||||
return accessToken;
|
||||
@@ -59,10 +55,13 @@ export default class UserMiddleware {
|
||||
public static getSsoTokens(req: ExpressRequest): Dictionary<string> {
|
||||
const ssoTokens: Dictionary<string> = {};
|
||||
|
||||
for (const key of Object.keys(req.headers)) {
|
||||
if (key.startsWith('sso-')) {
|
||||
const value: string | undefined | Array<string> =
|
||||
req.headers[key];
|
||||
// get sso tokens from cookies.
|
||||
|
||||
const cookies: Dictionary<string> = CookieUtil.getAllCookies(req);
|
||||
|
||||
for (const key of Object.keys(cookies)) {
|
||||
if (key.startsWith(CookieUtil.getSSOKey())) {
|
||||
const value: string | undefined | Array<string> = cookies[key];
|
||||
let projectId: string | undefined = undefined;
|
||||
|
||||
try {
|
||||
@@ -80,7 +79,7 @@ export default class UserMiddleware {
|
||||
typeof value === 'string' &&
|
||||
typeof projectId === 'string'
|
||||
) {
|
||||
ssoTokens[projectId] = req.headers[key] as string;
|
||||
ssoTokens[projectId] = cookies[key] as string;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -133,7 +132,8 @@ export default class UserMiddleware {
|
||||
);
|
||||
}
|
||||
|
||||
const accessToken: string | null = UserMiddleware.getAccessToken(req);
|
||||
const accessToken: string | undefined =
|
||||
UserMiddleware.getAccessToken(req);
|
||||
|
||||
if (!accessToken) {
|
||||
oneuptimeRequest.userType = UserType.Public;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user