fix dockerfiles

This commit is contained in:
Nawaz Dhandala
2022-01-19 12:23:34 +00:00
parent a8ce71d0bf
commit bfa53c96ae
69 changed files with 11599 additions and 10189 deletions

58
.dockerignore Normal file
View File

@@ -0,0 +1,58 @@
.git
node_modules
# See https://help.github.com/ignore-files/ for more about ignoring files.
# dependencies
/node_modules
/newrelic_agent.log
.idea
# testing
/coverage
# production
/build
# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
env.js
npm-debug.log*
yarn-debug.log*
yarn-error.log*
yarn.lock
Untitled-1
*.local.sh
*.local.yaml
run
stop
nohup.out*
encrypted-credentials.tar
encrypted-credentials/
_README.md
# Important Add production values to gitignore.
values-saas-production.yaml
kubernetes/values-saas-production.yaml
/private
/public
/tls_cert.pem
/tls_key.pem
/keys
temp_readme.md
tests/coverage
settings.json
go-sdk/tester/

View File

@@ -156,10 +156,10 @@ include:
- '/ci/spec/data-ingestor/deploy.yaml'
- '/ci/spec/data-ingestor/rollback.yaml'
# fetch-resources
- '/ci/spec/fetch-resources/audit.yaml'
- '/ci/spec/fetch-resources/deploy.yaml'
- '/ci/spec/fetch-resources/rollback.yaml'
# probe-api
- '/ci/spec/probe-api/audit.yaml'
- '/ci/spec/probe-api/deploy.yaml'
- '/ci/spec/probe-api/rollback.yaml'
# # GO-SDK
# - '/ci/spec/go-sdk/audit.yaml'

View File

@@ -1,2 +1,58 @@
.git
node_modules
build
# See https://help.github.com/ignore-files/ for more about ignoring files.
# dependencies
/node_modules
/newrelic_agent.log
.idea
# testing
/coverage
# production
/build
# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
env.js
npm-debug.log*
yarn-debug.log*
yarn-error.log*
yarn.lock
Untitled-1
*.local.sh
*.local.yaml
run
stop
nohup.out*
encrypted-credentials.tar
encrypted-credentials/
_README.md
# Important Add production values to gitignore.
values-saas-production.yaml
kubernetes/values-saas-production.yaml
/private
/public
/tls_cert.pem
/tls_key.pem
/keys
temp_readme.md
tests/coverage
settings.json
go-sdk/tester/

View File

@@ -1,2 +1,58 @@
.git
node_modules
build
# See https://help.github.com/ignore-files/ for more about ignoring files.
# dependencies
/node_modules
/newrelic_agent.log
.idea
# testing
/coverage
# production
/build
# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
env.js
npm-debug.log*
yarn-debug.log*
yarn-error.log*
yarn.lock
Untitled-1
*.local.sh
*.local.yaml
run
stop
nohup.out*
encrypted-credentials.tar
encrypted-credentials/
_README.md
# Important Add production values to gitignore.
values-saas-production.yaml
kubernetes/values-saas-production.yaml
/private
/public
/tls_cert.pem
/tls_key.pem
/keys
temp_readme.md
tests/coverage
settings.json
go-sdk/tester/

View File

@@ -1,2 +1,58 @@
.git
node_modules
build
# See https://help.github.com/ignore-files/ for more about ignoring files.
# dependencies
/node_modules
/newrelic_agent.log
.idea
# testing
/coverage
# production
/build
# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
env.js
npm-debug.log*
yarn-debug.log*
yarn-error.log*
yarn.lock
Untitled-1
*.local.sh
*.local.yaml
run
stop
nohup.out*
encrypted-credentials.tar
encrypted-credentials/
_README.md
# Important Add production values to gitignore.
values-saas-production.yaml
kubernetes/values-saas-production.yaml
/private
/public
/tls_cert.pem
/tls_key.pem
/keys
temp_readme.md
tests/coverage
settings.json
go-sdk/tester/

View File

@@ -11,6 +11,14 @@ RUN apk update && apk add bash && apk add curl
#Use bash shell by default
SHELL ["/bin/bash", "-c"]
# Install common-server
RUN mkdir /usr/src/common-server
WORKDIR /usr/src/common-server
COPY ../common-server/package*.json /usr/src/common-server/
RUN npm ci --only=production
COPY ../common-server /usr/src/common-server
#SET ENV Variables
ENV PRODUCTION=true
@@ -20,11 +28,11 @@ RUN mkdir /usr/src/app
WORKDIR /usr/src/app
# Install app dependencies
COPY package*.json /usr/src/app/
COPY ./application-scanner/package*.json /usr/src/app/
RUN npm ci --only=production
# Bundle app source
COPY . /usr/src/app
COPY ./application-scanner /usr/src/app
# Expose ports.
# - 3005: Application Scanner

View File

@@ -11,14 +11,22 @@ RUN apk update && apk add bash && apk add curl
#Use bash shell by default
SHELL ["/bin/bash", "-c"]
# Install common-server
RUN mkdir /usr/src/common-server
WORKDIR /usr/src/common-server
COPY ../common-server/package*.json /usr/src/common-server/
RUN npm ci --only=production
COPY ../common-server /usr/src/common-server
WORKDIR /usr/src/app
# Install app dependencies
RUN cd /usr/src/app
# Copy package.json files
COPY ./package.json /usr/src/app/package.json
COPY ./package-lock.json /usr/src/app/package-lock.json
COPY ./application-scanner/package.json /usr/src/app/package.json
COPY ./application-scanner/package-lock.json /usr/src/app/package-lock.json
RUN npm ci

View File

@@ -1,11 +1,58 @@
node_modules/
.vscode/
.git
node_modules
# See https://help.github.com/ignore-files/ for more about ignoring files.
# dependencies
/node_modules
/newrelic_agent.log
.idea
# testing
/coverage
# production
/build
# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
env.js
npm-debug.log*
yarn-debug.log*
yarn-error.log*
yarn.lock
yarn.lock
Untitled-1
*.local.sh
*.local.yaml
run
stop
nohup.out*
encrypted-credentials.tar
encrypted-credentials/
_README.md
# Important Add production values to gitignore.
values-saas-production.yaml
kubernetes/values-saas-production.yaml
/private
/public
/tls_cert.pem
/tls_key.pem
/keys
temp_readme.md
tests/coverage
settings.json
go-sdk/tester/

View File

@@ -11,6 +11,14 @@ RUN apk update && apk add bash && apk add curl
#Use bash shell by default
SHELL ["/bin/bash", "-c"]
# Install common-server
RUN mkdir /usr/src/common-server
WORKDIR /usr/src/common-server
COPY ../common-server/package*.json /usr/src/common-server/
RUN npm ci --only=production
COPY ../common-server /usr/src/common-server
#SET ENV Variables
ENV PRODUCTION=true
@@ -23,11 +31,11 @@ WORKDIR /usr/src/app
RUN curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/master/contrib/install.sh | sh -s -- -b /usr/local/bin
# Install app dependencies
COPY package*.json /usr/src/app/
COPY ./backend/package*.json /usr/src/app/
RUN npm ci --only=production
# Bundle app source
COPY . /usr/src/app
COPY ./backend /usr/src/app
# Expose ports.
# - 3002: OneUptime-backend

View File

@@ -11,6 +11,14 @@ RUN apk update && apk add bash && apk add curl
#Use bash shell by default
SHELL ["/bin/bash", "-c"]
# Install common-server
RUN mkdir /usr/src/common-server
WORKDIR /usr/src/common-server
COPY ../common-server/package*.json /usr/src/common-server/
RUN npm ci --only=production
COPY ../common-server /usr/src/common-server
#SET ENV Variables
WORKDIR /usr/src/app
@@ -24,8 +32,8 @@ RUN cd /usr/src/app
RUN mkdir -p greenlock.d || echo "Directory already exists"
# Copy package.json files
COPY ./package.json /usr/src/app/package.json
COPY ./package-lock.json /usr/src/app/package-lock.json
COPY ./backend/package.json /usr/src/app/package.json
COPY ./backend/package-lock.json /usr/src/app/package-lock.json
RUN npm ci

19666
backend/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,23 +1,23 @@
## FETCH-RESOURCES
audit_fetch-resources:
## probe-api
audit_probe-api:
stage: BuildAndTest
allow_failure: true
script:
- chmod +x ./ci/scripts/checkhash.sh
- export next_stage=`./ci/scripts/checkhash.sh audit_fetch-resources fetch-resources`
- export next_stage=`./ci/scripts/checkhash.sh audit_probe-api probe-api`
- if [[ $next_stage == *"skip"* ]]; then exit ${CI_JOB_SKIP_EXIT_CODE:-0}; fi
- sudo apt-get update
- sudo apt-get install -y curl gcc
- sudo apt-get install -y build-essential
- curl -sL https://deb.nodesource.com/setup_15.x | sudo -E bash -
- sudo apt-get install -y nodejs
- cd fetch-resources
- cd probe-api
- npm ci
- npm run audit
- npm run dep-check
- cd ..
- chmod +x ./ci/scripts/storehash.sh
- ./ci/scripts/storehash.sh audit_fetch-resources fetch-resources
- ./ci/scripts/storehash.sh audit_probe-api probe-api
- chmod +x ./ci/scripts/cleanup.sh
- ./ci/scripts/cleanup.sh
only:

View File

@@ -1,4 +1,4 @@
production_fetch-resources:
production_probe-api:
stage: Deploy
retry: 2
allow_failure: true
@@ -12,9 +12,9 @@ production_fetch-resources:
- sudo docker run --rm --privileged docker/binfmt:820fdd95a9972a5308930a2bdfb8573dd4447ad3
- sudo docker login --username $DOCKERHUBUSERNAME --password $DOCKERHUBPASSWORD
- sudo docker buildx create --use
- sudo docker buildx build --platform linux/amd64,linux/arm64 --tag oneuptime/fetch-resources:3.0.$CI_PIPELINE_IID --push ./fetch-resources
- sudo docker buildx build --platform linux/amd64,linux/arm64 --tag oneuptime/fetch-resources:latest --push ./fetch-resources
- sudo kubectl set image deployment/fi-fetch-resources fi-fetch-resources=oneuptime/fetch-resources:3.0.$CI_PIPELINE_IID
- sudo docker buildx build --platform linux/amd64,linux/arm64 --tag oneuptime/probe-api:3.0.$CI_PIPELINE_IID --push ./probe-api
- sudo docker buildx build --platform linux/amd64,linux/arm64 --tag oneuptime/probe-api:latest --push ./probe-api
- sudo kubectl set image deployment/fi-probe-api fi-probe-api=oneuptime/probe-api:3.0.$CI_PIPELINE_IID
# Cleanup
- chmod +x ./ci/scripts/deployment-cleanup.sh
- ./ci/scripts/deployment-cleanup.sh
@@ -28,7 +28,7 @@ production_fetch-resources:
name: production
# DEPLOYMENT STAGE
staging_fetch-resources:
staging_probe-api:
stage: Deploy
retry: 2
allow_failure: true
@@ -40,12 +40,12 @@ staging_fetch-resources:
- chmod +x ./ci/scripts/deployment-staging-setup.sh
- bash ./ci/scripts/deployment-staging-setup.sh
- sudo docker run --rm --privileged docker/binfmt:820fdd95a9972a5308930a2bdfb8573dd4447ad3
# Build and deploy fetch-resources.
# Build and deploy probe-api.
- sudo docker login --username $DOCKERHUBUSERNAME --password $DOCKERHUBPASSWORD
- sudo docker buildx create --use
- sudo docker buildx build --platform linux/amd64,linux/arm64 --tag oneuptime/fetch-resources:3.0.$CI_PIPELINE_IID --push ./fetch-resources
- sudo docker buildx build --platform linux/amd64,linux/arm64 --tag oneuptime/fetch-resources:master --push ./fetch-resources
- sudo kubectl set image deployment/fi-fetch-resources fi-fetch-resources=oneuptime/fetch-resources:3.0.$CI_PIPELINE_IID
- sudo docker buildx build --platform linux/amd64,linux/arm64 --tag oneuptime/probe-api:3.0.$CI_PIPELINE_IID --push ./probe-api
- sudo docker buildx build --platform linux/amd64,linux/arm64 --tag oneuptime/probe-api:master --push ./probe-api
- sudo kubectl set image deployment/fi-probe-api fi-probe-api=oneuptime/probe-api:3.0.$CI_PIPELINE_IID
# Cleanup
- chmod +x ./ci/scripts/deployment-cleanup.sh
- ./ci/scripts/deployment-cleanup.sh

View File

@@ -1,15 +1,15 @@
staging_rollback_fetch-resources:
staging_rollback_probe-api:
stage: RollbackIfTestsFail
script:
- chmod +x ./ci/scripts/deployment-setup.sh
- bash ./ci/scripts/deployment-setup.sh
- chmod +x ./ci/scripts/deployment-staging-setup.sh
- bash ./ci/scripts/deployment-staging-setup.sh
# Rollback fetch-resources
# Rollback probe-api
- chmod +x ./ci/scripts/job-status.sh
- export smoke_test_staging_status=`./ci/scripts/job-status.sh smoke_test_staging`
- if [[ $smoke_test_staging_status == \"success\" ]]; then exit 0; fi
- sudo kubectl rollout undo deployment/fi-fetch-resources
- sudo kubectl rollout undo deployment/fi-probe-api
- chmod +x ./ci/scripts/cleanup.sh
- ./ci/scripts/cleanup.sh
only:
@@ -18,18 +18,18 @@ staging_rollback_fetch-resources:
except:
- $STAGING_SMOKE_TEST_STATUS
production_rollback_fetch-resources:
production_rollback_probe-api:
stage: RollbackIfTestsFail
script:
- chmod +x ./ci/scripts/deployment-setup.sh
- bash ./ci/scripts/deployment-setup.sh
- chmod +x ./ci/scripts/deployment-production-setup.sh
- bash ./ci/scripts/deployment-production-setup.sh
# Rollback fetch-resources
# Rollback probe-api
- chmod +x ./ci/scripts/job-status.sh
- export smoke_test_production_status=`./ci/scripts/job-status.sh smoke_test_production`
- if [[ $smoke_test_production_status == \"success\" ]]; then exit 0; fi
- sudo kubectl rollout undo deployment/fi-fetch-resources
- sudo kubectl rollout undo deployment/fi-probe-api
- chmod +x ./ci/scripts/cleanup.sh
- ./ci/scripts/cleanup.sh
only:

552
common-server/package-lock.json generated Normal file
View File

@@ -0,0 +1,552 @@
{
"name": "common-server",
"version": "1.0.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "common-server",
"version": "1.0.0",
"license": "ISC",
"dependencies": {
"winston": "^3.4.0",
"winston-logstash-transport": "^2.0.0",
"winston-slack-webhook-transport": "^2.1.0"
}
},
"node_modules/@dabh/diagnostics": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/@dabh/diagnostics/-/diagnostics-2.0.2.tgz",
"integrity": "sha512-+A1YivoVDNNVCdfozHSR8v/jyuuLTMXwjWuxPFlFlUapXoGc+Gj9mDlTDDfrwl7rXCl2tNZ0kE8sIBO6YOn96Q==",
"dependencies": {
"colorspace": "1.1.x",
"enabled": "2.0.x",
"kuler": "^2.0.0"
}
},
"node_modules/@types/winston": {
"version": "2.4.4",
"resolved": "https://registry.npmjs.org/@types/winston/-/winston-2.4.4.tgz",
"integrity": "sha512-BVGCztsypW8EYwJ+Hq+QNYiT/MUyCif0ouBH+flrY66O5W+KIXAMML6E/0fJpm7VjIzgangahl5S03bJJQGrZw==",
"deprecated": "This is a stub types definition. winston provides its own type definitions, so you do not need this installed.",
"dependencies": {
"winston": "*"
}
},
"node_modules/async": {
"version": "3.2.3",
"resolved": "https://registry.npmjs.org/async/-/async-3.2.3.tgz",
"integrity": "sha512-spZRyzKL5l5BZQrr/6m/SqFdBN0q3OCI0f9rjfBzCMBIP4p75P620rR3gTmaksNOhmzgdxcaxdNfMy6anrbM0g=="
},
"node_modules/axios": {
"version": "0.22.0",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.22.0.tgz",
"integrity": "sha512-Z0U3uhqQeg1oNcihswf4ZD57O3NrR1+ZXhxaROaWpDmsDTx7T2HNBV2ulBtie2hwJptu8UvgnJoK+BIqdzh/1w==",
"dependencies": {
"follow-redirects": "^1.14.4"
}
},
"node_modules/color": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/color/-/color-3.2.1.tgz",
"integrity": "sha512-aBl7dZI9ENN6fUGC7mWpMTPNHmWUSNan9tuWN6ahh5ZLNk9baLJOnSMlrQkHcrfFgz2/RigjUVAjdx36VcemKA==",
"dependencies": {
"color-convert": "^1.9.3",
"color-string": "^1.6.0"
}
},
"node_modules/color-convert": {
"version": "1.9.3",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
"integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
"dependencies": {
"color-name": "1.1.3"
}
},
"node_modules/color-name": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
"integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU="
},
"node_modules/color-string": {
"version": "1.9.0",
"resolved": "https://registry.npmjs.org/color-string/-/color-string-1.9.0.tgz",
"integrity": "sha512-9Mrz2AQLefkH1UvASKj6v6hj/7eWgjnT/cVsR8CumieLoT+g900exWeNogqtweI8dxloXN9BDQTYro1oWu/5CQ==",
"dependencies": {
"color-name": "^1.0.0",
"simple-swizzle": "^0.2.2"
}
},
"node_modules/colors": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz",
"integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==",
"engines": {
"node": ">=0.1.90"
}
},
"node_modules/colorspace": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/colorspace/-/colorspace-1.1.4.tgz",
"integrity": "sha512-BgvKJiuVu1igBUF2kEjRCZXol6wiiGbY5ipL/oVPwm0BL9sIpMIzM8IK7vwuxIIzOXMV3Ey5w+vxhm0rR/TN8w==",
"dependencies": {
"color": "^3.1.3",
"text-hex": "1.0.x"
}
},
"node_modules/enabled": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/enabled/-/enabled-2.0.0.tgz",
"integrity": "sha512-AKrN98kuwOzMIdAizXGI86UFBoo26CL21UM763y1h/GMSJ4/OHU9k2YlsmBpyScFo/wbLzWQJBMCW4+IO3/+OQ=="
},
"node_modules/fecha": {
"version": "4.2.1",
"resolved": "https://registry.npmjs.org/fecha/-/fecha-4.2.1.tgz",
"integrity": "sha512-MMMQ0ludy/nBs1/o0zVOiKTpG7qMbonKUzjJgQFEuvq6INZ1OraKPRAWkBq5vlKLOUMpmNYG1JoN3oDPUQ9m3Q=="
},
"node_modules/fn.name": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/fn.name/-/fn.name-1.1.0.tgz",
"integrity": "sha512-GRnmB5gPyJpAhTQdSZTSp9uaPSvl09KoYcMQtsB9rQoOmzs9dH6ffeccH+Z+cv6P68Hu5bC6JjRh4Ah/mHSNRw=="
},
"node_modules/follow-redirects": {
"version": "1.14.7",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.7.tgz",
"integrity": "sha512-+hbxoLbFMbRKDwohX8GkTataGqO6Jb7jGwpAlwgy2bIz25XtRm7KEzJM76R1WiNT5SwZkX4Y75SwBolkpmE7iQ==",
"funding": [
{
"type": "individual",
"url": "https://github.com/sponsors/RubenVerborgh"
}
],
"engines": {
"node": ">=4.0"
},
"peerDependenciesMeta": {
"debug": {
"optional": true
}
}
},
"node_modules/inherits": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
},
"node_modules/is-arrayish": {
"version": "0.3.2",
"resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.3.2.tgz",
"integrity": "sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ=="
},
"node_modules/is-stream": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz",
"integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==",
"engines": {
"node": ">=8"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/kuler": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/kuler/-/kuler-2.0.0.tgz",
"integrity": "sha512-Xq9nH7KlWZmXAtodXDDRE7vs6DU1gTU8zYDHDiWLSip45Egwq3plLHzPn27NgvzL2r1LMPC1vdqh98sQxtqj4A=="
},
"node_modules/logform": {
"version": "2.3.2",
"resolved": "https://registry.npmjs.org/logform/-/logform-2.3.2.tgz",
"integrity": "sha512-V6JiPThZzTsbVRspNO6TmHkR99oqYTs8fivMBYQkjZj6rxW92KxtDCPE6IkAk1DNBnYKNkjm4jYBm6JDUcyhOA==",
"dependencies": {
"colors": "1.4.0",
"fecha": "^4.2.0",
"ms": "^2.1.1",
"safe-stable-stringify": "^1.1.0",
"triple-beam": "^1.3.0"
}
},
"node_modules/ms": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="
},
"node_modules/one-time": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/one-time/-/one-time-1.0.0.tgz",
"integrity": "sha512-5DXOiRKwuSEcQ/l0kGCF6Q3jcADFv5tSmRaJck/OqkVFcOzutB134KRSfF0xDrL39MNnqxbHBbUUcjZIhTgb2g==",
"dependencies": {
"fn.name": "1.x.x"
}
},
"node_modules/readable-stream": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz",
"integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==",
"dependencies": {
"inherits": "^2.0.3",
"string_decoder": "^1.1.1",
"util-deprecate": "^1.0.1"
},
"engines": {
"node": ">= 6"
}
},
"node_modules/safe-buffer": {
"version": "5.2.1",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/feross"
},
{
"type": "patreon",
"url": "https://www.patreon.com/feross"
},
{
"type": "consulting",
"url": "https://feross.org/support"
}
]
},
"node_modules/safe-stable-stringify": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-1.1.1.tgz",
"integrity": "sha512-ERq4hUjKDbJfE4+XtZLFPCDi8Vb1JqaxAPTxWFLBx8XcAlf9Bda/ZJdVezs/NAfsMQScyIlUMx+Yeu7P7rx5jw=="
},
"node_modules/simple-swizzle": {
"version": "0.2.2",
"resolved": "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz",
"integrity": "sha1-pNprY1/8zMoz9w0Xy5JZLeleVXo=",
"dependencies": {
"is-arrayish": "^0.3.1"
}
},
"node_modules/stack-trace": {
"version": "0.0.10",
"resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.10.tgz",
"integrity": "sha1-VHxws0fo0ytOEI6hoqFZ5f3eGcA=",
"engines": {
"node": "*"
}
},
"node_modules/string_decoder": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
"integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
"dependencies": {
"safe-buffer": "~5.2.0"
}
},
"node_modules/text-hex": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/text-hex/-/text-hex-1.0.0.tgz",
"integrity": "sha512-uuVGNWzgJ4yhRaNSiubPY7OjISw4sw4E5Uv0wbjp+OzcbmVU/rsT8ujgcXJhn9ypzsgr5vlzpPqP+MBBKcGvbg=="
},
"node_modules/triple-beam": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/triple-beam/-/triple-beam-1.3.0.tgz",
"integrity": "sha512-XrHUvV5HpdLmIj4uVMxHggLbFSZYIn7HEWsqePZcI50pco+MPqJ50wMGY794X7AOOhxOBAjbkqfAbEe/QMp2Lw=="
},
"node_modules/util-deprecate": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
"integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8="
},
"node_modules/winston": {
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/winston/-/winston-3.4.0.tgz",
"integrity": "sha512-FqilVj+5HKwCfIHQzMxrrd5tBIH10JTS3koFGbLVWBODjiIYq7zir08rFyBT4rrTYG/eaTqDcfSIbcjSM78YSw==",
"dependencies": {
"@dabh/diagnostics": "^2.0.2",
"async": "^3.2.3",
"is-stream": "^2.0.0",
"logform": "^2.3.2",
"one-time": "^1.0.0",
"readable-stream": "^3.4.0",
"stack-trace": "0.0.x",
"triple-beam": "^1.3.0",
"winston-transport": "^4.4.2"
},
"engines": {
"node": ">= 6.4.0"
}
},
"node_modules/winston-logstash-transport": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/winston-logstash-transport/-/winston-logstash-transport-2.0.0.tgz",
"integrity": "sha512-Ku9DgDqvCKZQbsEL9bAVxus6oUbWpCQMt4J7Z6JwrvWCHaWU5KyumaSZO6ZYW1St7h0iaCZAAQU0yRewM8o23Q==",
"dependencies": {
"@types/winston": "^2.3.9",
"winston": "^3.0.0"
}
},
"node_modules/winston-slack-webhook-transport": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/winston-slack-webhook-transport/-/winston-slack-webhook-transport-2.1.0.tgz",
"integrity": "sha512-Zdnc/sVyMi+affkv3zzZpmuaEPvyKAefzLK907QTvU+rDiv2v1N0XRHILTte9u4il6jag9popruajWEgixonwQ==",
"dependencies": {
"axios": "^0.22.0",
"winston-transport": "^4.4.0"
}
},
"node_modules/winston-transport": {
"version": "4.4.2",
"resolved": "https://registry.npmjs.org/winston-transport/-/winston-transport-4.4.2.tgz",
"integrity": "sha512-9jmhltAr5ygt5usgUTQbEiw/7RYXpyUbEAFRCSicIacpUzPkrnQsQZSPGEI12aLK9Jth4zNcYJx3Cvznwrl8pw==",
"dependencies": {
"logform": "^2.3.2",
"readable-stream": "^3.4.0",
"triple-beam": "^1.2.0"
},
"engines": {
"node": ">= 6.4.0"
}
}
},
"dependencies": {
"@dabh/diagnostics": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/@dabh/diagnostics/-/diagnostics-2.0.2.tgz",
"integrity": "sha512-+A1YivoVDNNVCdfozHSR8v/jyuuLTMXwjWuxPFlFlUapXoGc+Gj9mDlTDDfrwl7rXCl2tNZ0kE8sIBO6YOn96Q==",
"requires": {
"colorspace": "1.1.x",
"enabled": "2.0.x",
"kuler": "^2.0.0"
}
},
"@types/winston": {
"version": "2.4.4",
"resolved": "https://registry.npmjs.org/@types/winston/-/winston-2.4.4.tgz",
"integrity": "sha512-BVGCztsypW8EYwJ+Hq+QNYiT/MUyCif0ouBH+flrY66O5W+KIXAMML6E/0fJpm7VjIzgangahl5S03bJJQGrZw==",
"requires": {
"winston": "*"
}
},
"async": {
"version": "3.2.3",
"resolved": "https://registry.npmjs.org/async/-/async-3.2.3.tgz",
"integrity": "sha512-spZRyzKL5l5BZQrr/6m/SqFdBN0q3OCI0f9rjfBzCMBIP4p75P620rR3gTmaksNOhmzgdxcaxdNfMy6anrbM0g=="
},
"axios": {
"version": "0.22.0",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.22.0.tgz",
"integrity": "sha512-Z0U3uhqQeg1oNcihswf4ZD57O3NrR1+ZXhxaROaWpDmsDTx7T2HNBV2ulBtie2hwJptu8UvgnJoK+BIqdzh/1w==",
"requires": {
"follow-redirects": "^1.14.4"
}
},
"color": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/color/-/color-3.2.1.tgz",
"integrity": "sha512-aBl7dZI9ENN6fUGC7mWpMTPNHmWUSNan9tuWN6ahh5ZLNk9baLJOnSMlrQkHcrfFgz2/RigjUVAjdx36VcemKA==",
"requires": {
"color-convert": "^1.9.3",
"color-string": "^1.6.0"
}
},
"color-convert": {
"version": "1.9.3",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
"integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
"requires": {
"color-name": "1.1.3"
}
},
"color-name": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
"integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU="
},
"color-string": {
"version": "1.9.0",
"resolved": "https://registry.npmjs.org/color-string/-/color-string-1.9.0.tgz",
"integrity": "sha512-9Mrz2AQLefkH1UvASKj6v6hj/7eWgjnT/cVsR8CumieLoT+g900exWeNogqtweI8dxloXN9BDQTYro1oWu/5CQ==",
"requires": {
"color-name": "^1.0.0",
"simple-swizzle": "^0.2.2"
}
},
"colors": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz",
"integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA=="
},
"colorspace": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/colorspace/-/colorspace-1.1.4.tgz",
"integrity": "sha512-BgvKJiuVu1igBUF2kEjRCZXol6wiiGbY5ipL/oVPwm0BL9sIpMIzM8IK7vwuxIIzOXMV3Ey5w+vxhm0rR/TN8w==",
"requires": {
"color": "^3.1.3",
"text-hex": "1.0.x"
}
},
"enabled": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/enabled/-/enabled-2.0.0.tgz",
"integrity": "sha512-AKrN98kuwOzMIdAizXGI86UFBoo26CL21UM763y1h/GMSJ4/OHU9k2YlsmBpyScFo/wbLzWQJBMCW4+IO3/+OQ=="
},
"fecha": {
"version": "4.2.1",
"resolved": "https://registry.npmjs.org/fecha/-/fecha-4.2.1.tgz",
"integrity": "sha512-MMMQ0ludy/nBs1/o0zVOiKTpG7qMbonKUzjJgQFEuvq6INZ1OraKPRAWkBq5vlKLOUMpmNYG1JoN3oDPUQ9m3Q=="
},
"fn.name": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/fn.name/-/fn.name-1.1.0.tgz",
"integrity": "sha512-GRnmB5gPyJpAhTQdSZTSp9uaPSvl09KoYcMQtsB9rQoOmzs9dH6ffeccH+Z+cv6P68Hu5bC6JjRh4Ah/mHSNRw=="
},
"follow-redirects": {
"version": "1.14.7",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.7.tgz",
"integrity": "sha512-+hbxoLbFMbRKDwohX8GkTataGqO6Jb7jGwpAlwgy2bIz25XtRm7KEzJM76R1WiNT5SwZkX4Y75SwBolkpmE7iQ=="
},
"inherits": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
},
"is-arrayish": {
"version": "0.3.2",
"resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.3.2.tgz",
"integrity": "sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ=="
},
"is-stream": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz",
"integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg=="
},
"kuler": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/kuler/-/kuler-2.0.0.tgz",
"integrity": "sha512-Xq9nH7KlWZmXAtodXDDRE7vs6DU1gTU8zYDHDiWLSip45Egwq3plLHzPn27NgvzL2r1LMPC1vdqh98sQxtqj4A=="
},
"logform": {
"version": "2.3.2",
"resolved": "https://registry.npmjs.org/logform/-/logform-2.3.2.tgz",
"integrity": "sha512-V6JiPThZzTsbVRspNO6TmHkR99oqYTs8fivMBYQkjZj6rxW92KxtDCPE6IkAk1DNBnYKNkjm4jYBm6JDUcyhOA==",
"requires": {
"colors": "1.4.0",
"fecha": "^4.2.0",
"ms": "^2.1.1",
"safe-stable-stringify": "^1.1.0",
"triple-beam": "^1.3.0"
}
},
"ms": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="
},
"one-time": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/one-time/-/one-time-1.0.0.tgz",
"integrity": "sha512-5DXOiRKwuSEcQ/l0kGCF6Q3jcADFv5tSmRaJck/OqkVFcOzutB134KRSfF0xDrL39MNnqxbHBbUUcjZIhTgb2g==",
"requires": {
"fn.name": "1.x.x"
}
},
"readable-stream": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz",
"integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==",
"requires": {
"inherits": "^2.0.3",
"string_decoder": "^1.1.1",
"util-deprecate": "^1.0.1"
}
},
"safe-buffer": {
"version": "5.2.1",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="
},
"safe-stable-stringify": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-1.1.1.tgz",
"integrity": "sha512-ERq4hUjKDbJfE4+XtZLFPCDi8Vb1JqaxAPTxWFLBx8XcAlf9Bda/ZJdVezs/NAfsMQScyIlUMx+Yeu7P7rx5jw=="
},
"simple-swizzle": {
"version": "0.2.2",
"resolved": "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz",
"integrity": "sha1-pNprY1/8zMoz9w0Xy5JZLeleVXo=",
"requires": {
"is-arrayish": "^0.3.1"
}
},
"stack-trace": {
"version": "0.0.10",
"resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.10.tgz",
"integrity": "sha1-VHxws0fo0ytOEI6hoqFZ5f3eGcA="
},
"string_decoder": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
"integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
"requires": {
"safe-buffer": "~5.2.0"
}
},
"text-hex": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/text-hex/-/text-hex-1.0.0.tgz",
"integrity": "sha512-uuVGNWzgJ4yhRaNSiubPY7OjISw4sw4E5Uv0wbjp+OzcbmVU/rsT8ujgcXJhn9ypzsgr5vlzpPqP+MBBKcGvbg=="
},
"triple-beam": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/triple-beam/-/triple-beam-1.3.0.tgz",
"integrity": "sha512-XrHUvV5HpdLmIj4uVMxHggLbFSZYIn7HEWsqePZcI50pco+MPqJ50wMGY794X7AOOhxOBAjbkqfAbEe/QMp2Lw=="
},
"util-deprecate": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
"integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8="
},
"winston": {
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/winston/-/winston-3.4.0.tgz",
"integrity": "sha512-FqilVj+5HKwCfIHQzMxrrd5tBIH10JTS3koFGbLVWBODjiIYq7zir08rFyBT4rrTYG/eaTqDcfSIbcjSM78YSw==",
"requires": {
"@dabh/diagnostics": "^2.0.2",
"async": "^3.2.3",
"is-stream": "^2.0.0",
"logform": "^2.3.2",
"one-time": "^1.0.0",
"readable-stream": "^3.4.0",
"stack-trace": "0.0.x",
"triple-beam": "^1.3.0",
"winston-transport": "^4.4.2"
}
},
"winston-logstash-transport": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/winston-logstash-transport/-/winston-logstash-transport-2.0.0.tgz",
"integrity": "sha512-Ku9DgDqvCKZQbsEL9bAVxus6oUbWpCQMt4J7Z6JwrvWCHaWU5KyumaSZO6ZYW1St7h0iaCZAAQU0yRewM8o23Q==",
"requires": {
"@types/winston": "^2.3.9",
"winston": "^3.0.0"
}
},
"winston-slack-webhook-transport": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/winston-slack-webhook-transport/-/winston-slack-webhook-transport-2.1.0.tgz",
"integrity": "sha512-Zdnc/sVyMi+affkv3zzZpmuaEPvyKAefzLK907QTvU+rDiv2v1N0XRHILTte9u4il6jag9popruajWEgixonwQ==",
"requires": {
"axios": "^0.22.0",
"winston-transport": "^4.4.0"
}
},
"winston-transport": {
"version": "4.4.2",
"resolved": "https://registry.npmjs.org/winston-transport/-/winston-transport-4.4.2.tgz",
"integrity": "sha512-9jmhltAr5ygt5usgUTQbEiw/7RYXpyUbEAFRCSicIacpUzPkrnQsQZSPGEI12aLK9Jth4zNcYJx3Cvznwrl8pw==",
"requires": {
"logform": "^2.3.2",
"readable-stream": "^3.4.0",
"triple-beam": "^1.2.0"
}
}
}
}

View File

@@ -7,5 +7,10 @@
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
"license": "ISC",
"dependencies": {
"winston": "^3.4.0",
"winston-logstash-transport": "^2.0.0",
"winston-slack-webhook-transport": "^2.1.0"
}
}

View File

@@ -0,0 +1,111 @@
const winston = require('winston');
const logstash = require('winston-logstash-transport');
const Slack = require('winston-slack-webhook-transport');
const MESSAGE = Symbol.for('message');
const LEVEL = Symbol.for('level');
const errorToLog = log => {
// convert an instance of the Error class to a formatted log
const formatted = {
message: null,
level: 'error',
};
formatted[LEVEL] = 'error';
if (log.message) {
formatted.message = `${log.message}: \n${log.stack}`;
} else {
formatted.message = log.stack;
}
// formatted.message = log.stack;
return formatted;
};
// TODO:
// add a handler for normal info logs
const logFormatter = logEntry => {
if (logEntry instanceof Error) {
// an error object was passed in
return errorToLog(logEntry);
}
if (logEntry.stack) {
// an error object was passed in addition to an error message
// logEntry.message = `${logEntry.message}: \n${logEntry.stack}`;
logEntry.message = logEntry.stack;
}
if (logEntry.message && typeof logEntry.message === 'object') {
if (logEntry.message?.err instanceof Error) {
// Ugh. So here we are with a log message that is an instance of the Error class
return errorToLog(logEntry.message.err);
} else {
// here we have an object as the log message but it's not an Error object
logEntry.message = JSON.stringify(logEntry.message);
}
}
return logEntry;
};
const consoleTransport = new winston.transports.Console({
format: winston.format.combine(
winston.format.colorize(),
winston.format.cli({
colors: {
error: 'red',
warn: 'yellow',
info: 'blue',
http: 'green',
verbose: 'cyan',
debug: 'white',
},
})
),
handleExceptions: true,
});
const logstashTransport = new logstash.LogstashTransport({
host: process.env.LOGSTASH_HOST,
port: process.env.LOGSTASH_PORT,
});
const envTag = logEntry => {
const tag = {
env: process.env.NODE_ENV || 'development',
containerName: process.env.CONTAINER_NAME,
deploymentName: process.env.DEPLOYMENT_NAME,
};
const taggedLog = Object.assign(tag, logEntry);
logEntry[MESSAGE] = JSON.stringify(taggedLog);
return logEntry;
};
const transports = [];
// configure transports (defined above)
transports.push(consoleTransport);
transports.push(logstashTransport);
const logger = winston.createLogger({
level: process.env.LOG_LEVEL || 'info',
format: winston.format.combine(
winston.format(logFormatter)(),
winston.format(envTag)()
),
transports,
});
if (
process.env.PORT &&
process.env.SLACK_ERROR_LOG_WEBHOOK &&
process.env.SLACK_ERROR_LOG_CHANNEL
) {
winston.add(new Slack({ webhookUrl: process.env.SLACK_ERROR_LOG_WEBHOOK }));
}
logger.stream = {
// eslint-disable-next-line no-unused-vars
write: function(message, _encoding) {
logger.http(message);
},
};
module.exports = logger;

View File

@@ -11,6 +11,14 @@ RUN apk update && apk add bash && apk add curl
#Use bash shell by default
SHELL ["/bin/bash", "-c"]
# Install common-server
RUN mkdir /usr/src/common-server
WORKDIR /usr/src/common-server
COPY ../common-server/package*.json /usr/src/common-server/
RUN npm ci --only=production
COPY ../common-server /usr/src/common-server
#SET ENV Variables
ENV PRODUCTION=true

View File

@@ -11,15 +11,22 @@ RUN apk update && apk add bash && apk add curl
#Use bash shell by default
SHELL ["/bin/bash", "-c"]
# Install common-server
RUN mkdir /usr/src/common-server
WORKDIR /usr/src/common-server
COPY ../common-server/package*.json /usr/src/common-server/
RUN npm ci --only=production
COPY ../common-server /usr/src/common-server
WORKDIR /usr/src/app
# Install app dependencies
RUN cd /usr/src/app
# Copy package.json files
COPY ./package.json /usr/src/app/package.json
COPY ./package-lock.json /usr/src/app/package-lock.json
COPY ./container-scanner/package.json /usr/src/app/package.json
COPY ./container-scanner/package-lock.json /usr/src/app/package-lock.json
RUN npm ci

View File

@@ -1,2 +1,58 @@
.git
node_modules
build
# See https://help.github.com/ignore-files/ for more about ignoring files.
# dependencies
/node_modules
/newrelic_agent.log
.idea
# testing
/coverage
# production
/build
# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
env.js
npm-debug.log*
yarn-debug.log*
yarn-error.log*
yarn.lock
Untitled-1
*.local.sh
*.local.yaml
run
stop
nohup.out*
encrypted-credentials.tar
encrypted-credentials/
_README.md
# Important Add production values to gitignore.
values-saas-production.yaml
kubernetes/values-saas-production.yaml
/private
/public
/tls_cert.pem
/tls_key.pem
/keys
temp_readme.md
tests/coverage
settings.json
go-sdk/tester/

View File

@@ -1,11 +1,58 @@
node_modules/
.vscode/
.git
node_modules
# See https://help.github.com/ignore-files/ for more about ignoring files.
# dependencies
/node_modules
/newrelic_agent.log
.idea
# testing
/coverage
# production
/build
# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
env.js
npm-debug.log*
yarn-debug.log*
yarn-error.log*
yarn.lock
yarn.lock
Untitled-1
*.local.sh
*.local.yaml
run
stop
nohup.out*
encrypted-credentials.tar
encrypted-credentials/
_README.md
# Important Add production values to gitignore.
values-saas-production.yaml
kubernetes/values-saas-production.yaml
/private
/public
/tls_cert.pem
/tls_key.pem
/keys
temp_readme.md
tests/coverage
settings.json
go-sdk/tester/

View File

@@ -11,6 +11,14 @@ RUN apk update && apk add bash && apk add curl
#Use bash shell by default
SHELL ["/bin/bash", "-c"]
# Install common-server
RUN mkdir /usr/src/common-server
WORKDIR /usr/src/common-server
COPY ../common-server/package*.json /usr/src/common-server/
RUN npm ci --only=production
COPY ../common-server /usr/src/common-server
#SET ENV Variables
ENV PRODUCTION=true
@@ -36,11 +44,11 @@ RUN mv ./kubectl /usr/local/bin/kubectl && \
# Install app dependencies
COPY package*.json /usr/src/app/
COPY ./data-ingestor/package*.json /usr/src/app/
RUN npm ci --only=production
# Bundle app source
COPY . /usr/src/app
COPY ./data-ingestor /usr/src/app
# Expose ports.
EXPOSE 3200

View File

@@ -11,6 +11,14 @@ RUN apk update && apk add bash && apk add curl
#Use bash shell by default
SHELL ["/bin/bash", "-c"]
# Install common-server
RUN mkdir /usr/src/common-server
WORKDIR /usr/src/common-server
COPY ../common-server/package*.json /usr/src/common-server/
RUN npm ci --only=production
COPY ../common-server /usr/src/common-server
WORKDIR /usr/src/app
RUN OS_ARCHITECTURE="amd64"
@@ -32,8 +40,8 @@ RUN mv ./kubectl /usr/local/bin/kubectl && \
RUN cd /usr/src/app
# Copy package.json files
COPY ./package.json /usr/src/app/package.json
COPY ./package-lock.json /usr/src/app/package-lock.json
COPY ./data-ingestor/package.json /usr/src/app/package.json
COPY ./data-ingestor/package-lock.json /usr/src/app/package-lock.json
RUN npm ci

View File

@@ -47,8 +47,8 @@ services:
ports:
- '3003:3003'
build:
context: ./accounts
dockerfile: ./Dockerfile.dev
context: .
dockerfile: ./accounts/Dockerfile.dev
env_file:
- ./accounts/.env
environment:
@@ -64,8 +64,8 @@ services:
- '3200:3200'
- '9239:9229' # Debugging port.
build:
context: ./data-ingestor
dockerfile: ./Dockerfile.dev
context: .
dockerfile: ./data-ingestor/Dockerfile.dev
env_file:
- ./data-ingestor/.env
environment:
@@ -90,8 +90,8 @@ services:
- '3300:3300'
- '9240:9229' # Debugging port.
build:
context: ./realtime
dockerfile: ./Dockerfile.dev
context: .
dockerfile: ./realtime/Dockerfile.dev
env_file:
- ./realtime/.env
environment:
@@ -103,14 +103,14 @@ services:
# https://stackoverflow.com/questions/29181032/add-a-volume-to-docker-but-exclude-a-sub-folder
- /usr/src/app/node_modules
fetch-resources:
probe-api:
ports:
- '3400:3400'
build:
context: ./fetch-resources
dockerfile: ./Dockerfile.dev
context: .
dockerfile: ./probe-api/Dockerfile.dev
env_file:
- ./fetch-resources/.env
- ./probe-api/.env
environment:
- CLUSTER_KEY=test
- PORT=3400
@@ -123,8 +123,8 @@ services:
- '3008:3008'
- '9238:9229' # Debugging port.
build:
context: ./probe
dockerfile: ./Dockerfile.dev
context: .
dockerfile: ./probe/Dockerfile.dev
env_file:
- ./probe/.env
environment:
@@ -135,7 +135,7 @@ services:
- PROBE_KEY=test-key
- IS_SAAS_SERVICE=${IS_SAAS_SERVICE}
- CLUSTER_KEY=test
- FETCH_RESOURCES_URL=http://fetch-resources:3400
- FETCH_RESOURCES_URL=http://probe-api:3400
volumes:
- ./probe:/usr/src/app
# Use node modules of the container and not host system.
@@ -147,8 +147,8 @@ services:
ports:
- '1445:1445'
build:
context: ./api-docs
dockerfile: ./Dockerfile.dev
context: .
dockerfile: ./api-docs/Dockerfile.dev
env_file:
- ./api-docs/.env
environment:
@@ -161,8 +161,8 @@ services:
init-script:
build:
context: ./init-script
dockerfile: ./Dockerfile.dev
context: .
dockerfile: ./init-script/Dockerfile.dev
ports:
- '1447:1447'
- '9237:9229' # Debugging port.
@@ -188,8 +188,8 @@ services:
- '3009:3009'
- '9236:9229' # Debugging port.
build:
context: ./script-runner
dockerfile: ./Dockerfile.dev
context: .
dockerfile: ./script-runner/Dockerfile.dev
env_file:
- ./script-runner/.env
environment:
@@ -207,8 +207,8 @@ services:
- '3002:3002' # Service Port.
- '9232:9229' # Debugging port.
build:
context: ./backend
dockerfile: ./Dockerfile.dev
context: .
dockerfile: ./backend/Dockerfile.dev
env_file:
- ./backend/.env
environment:
@@ -235,8 +235,8 @@ services:
ports:
- '3000:3000'
build:
context: ./dashboard
dockerfile: ./Dockerfile.dev
context: .
dockerfile: ./dashboard/Dockerfile.dev
env_file:
- ./dashboard/.env
environment:
@@ -256,8 +256,8 @@ services:
environment:
- IS_SAAS_SERVICE=${IS_SAAS_SERVICE}
build:
context: ./home
dockerfile: ./Dockerfile.dev
context: .
dockerfile: ./home/Dockerfile.dev
volumes:
- ./home:/usr/src/app
# Use node modules of the container and not host system.
@@ -268,8 +268,8 @@ services:
ports:
- '3006:3006'
build:
context: ./status-page
dockerfile: ./Dockerfile.dev
context: .
dockerfile: ./status-page/Dockerfile.dev
env_file:
- ./status-page/.env
environment:
@@ -284,8 +284,8 @@ services:
ports:
- '3100:3100'
build:
context: ./admin-dashboard
dockerfile: ./Dockerfile.dev
context: .
dockerfile: ./admin-dashboard/Dockerfile.dev
env_file:
- ./admin-dashboard/.env
environment:
@@ -305,8 +305,8 @@ services:
environment:
- IS_SAAS_SERVICE=${IS_SAAS_SERVICE}
build:
context: ./http-test-server
dockerfile: ./Dockerfile.dev
context: .
dockerfile: ./http-test-server/Dockerfile.dev
volumes:
- ./http-test-server:/usr/src/app
# Use node modules of the container and not host system.
@@ -334,8 +334,8 @@ services:
- '3005:3005'
- '9240:9229' # Debugging port.
build:
context: ./application-scanner
dockerfile: ./Dockerfile.dev
context: .
dockerfile: ./application-scanner/Dockerfile.dev
env_file:
- ./application-scanner/.env
environment:
@@ -355,8 +355,8 @@ services:
- '3055:3055'
- '9242:9229' # Debugging port.
build:
context: ./container-scanner
dockerfile: ./Dockerfile.dev
context: .
dockerfile: ./container-scanner/Dockerfile.dev
env_file:
- ./container-scanner/.env
environment:
@@ -376,8 +376,8 @@ services:
- '3015:3015'
- '9241:9229' # Debugging port.
build:
context: ./lighthouse-runner
dockerfile: ./Dockerfile.dev
context: .
dockerfile: ./lighthouse-runner/Dockerfile.dev
env_file:
- ./lighthouse-runner/.env
environment:

View File

@@ -44,7 +44,9 @@ services:
accounts:
ports:
- '3003:3003'
build: ./accounts
build:
context: .
dockerfile: ./accounts/Dockerfile
env_file:
- ./accounts/.env
environment:
@@ -54,7 +56,9 @@ services:
dashboard:
ports:
- '3000:3000'
build: ./dashboard
build:
context: .
dockerfile: ./dashboard/Dockerfile
env_file:
- ./dashboard/.env
environment:
@@ -69,11 +73,15 @@ services:
- ./home/.env
environment:
- IS_SAAS_SERVICE=${IS_SAAS_SERVICE}
build: ./home
build:
context: .
dockerfile: ./home/Dockerfile
status-page:
ports:
- '3006:3006'
build: ./status-page
build:
context: .
dockerfile: ./status-page/Dockerfile
env_file:
- ./status-page/.env
environment:
@@ -85,7 +93,9 @@ services:
admin-dashboard:
ports:
- '3100:3100'
build: ./admin-dashboard
build:
context: .
dockerfile: ./admin-dashboard/Dockerfile
env_file:
- ./admin-dashboard/.env
environment:
@@ -100,7 +110,9 @@ services:
- ./http-test-server/.env
environment:
- IS_SAAS_SERVICE=${IS_SAAS_SERVICE}
build: ./http-test-server
build:
context: .
dockerfile: ./http-test-server/Dockerfile
licensing:
ports:
- '3004:3004'
@@ -108,11 +120,15 @@ services:
- ./licensing/.env
environment:
- IS_SAAS_SERVICE=${IS_SAAS_SERVICE}
build: ./licensing
build:
context: .
dockerfile: ./licensing/Dockerfile
data-ingestor:
ports:
- '3200:3200'
build: ./data-ingestor
build:
context: .
dockerfile: ./data-ingestor/Dockerfile
env_file:
- ./data-ingestor/.env
environment:
@@ -129,18 +145,22 @@ services:
realtime:
ports:
- '3300:3300'
build: ./realtime
build:
context: .
dockerfile: ./realtime/Dockerfile
env_file:
- ./realtime/.env
environment:
- CLUSTER_KEY=test
- PORT=3300
fetch-resources:
probe-api:
ports:
- '3400:3400'
build: ./fetch-resources
build:
context: .
dockerfile: ./probe-api/Dockerfile
env_file:
- ./fetch-resources/.env
- ./probe-api/.env
environment:
- CLUSTER_KEY=test
- PORT=3400
@@ -149,7 +169,9 @@ services:
probe1:
ports:
- '3024:3024'
build: ./probe
build:
context: .
dockerfile: ./probe/Dockerfile
env_file:
- ./probe/.env
environment:
@@ -160,14 +182,16 @@ services:
- IS_SAAS_SERVICE=${IS_SAAS_SERVICE}
- CLUSTER_KEY=test
- DATA_INGESTOR_URL=http://data-ingestor:3200
- FETCH_RESOURCES_URL=http://fetch-resources:3400
- FETCH_RESOURCES_URL=http://probe-api:3400
depends_on:
- backend
- data-ingestor
probe2:
ports:
- '3025:3025'
build: ./probe
build:
context: .
dockerfile: ./probe/Dockerfile
env_file:
- ./probe/.env
environment:
@@ -184,13 +208,17 @@ services:
api-docs:
ports:
- '1445:1445'
build: ./api-docs
build:
context: .
dockerfile: ./api-docs/Dockerfile
env_file:
- ./api-docs/.env
environment:
- IS_SAAS_SERVICE=${IS_SAAS_SERVICE}
init-script:
build: ./init-script
build:
context: .
dockerfile: ./init-script/Dockerfile
ports:
- '1447:1447'
env_file:
@@ -223,7 +251,9 @@ services:
script-runner:
ports:
- '3009:3009'
build: ./script-runner
build:
context: .
dockerfile: ./script-runner/Dockerfile
env_file:
- ./script-runner/.env
environment:
@@ -233,7 +263,9 @@ services:
application-scanner:
ports:
- '3005:3005'
build: ./application-scanner
build:
context: .
dockerfile: ./application-scanner/Dockerfile
env_file:
- ./application-scanner/.env
environment:
@@ -246,7 +278,9 @@ services:
container-scanner:
ports:
- '3055:3055'
build: ./container-scanner
build:
context: .
dockerfile: ./container-scanner/Dockerfile
env_file:
- ./container-scanner/.env
environment:
@@ -259,7 +293,9 @@ services:
lighthouse-runner:
ports:
- '3015:3015'
build: ./lighthouse-runner
build:
context: .
dockerfile: ./lighthouse-runner/Dockerfile
env_file:
- ./lighthouse-runner/.env
environment:

View File

@@ -1,8 +1,64 @@
private
public
.git
node_modules
build
# See https://help.github.com/ignore-files/ for more about ignoring files.
# dependencies
/node_modules
/newrelic_agent.log
.idea
# testing
/coverage
# production
/build
# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
env.js
npm-debug.log*
yarn-debug.log*
yarn-error.log*
yarn.lock
Untitled-1
*.local.sh
*.local.yaml
run
stop
nohup.out*
encrypted-credentials.tar
encrypted-credentials/
_README.md
# Important Add production values to gitignore.
values-saas-production.yaml
kubernetes/values-saas-production.yaml
/private
/public
/tls_cert.pem
/tls_key.pem
/keys
temp_readme.md
tests/coverage
settings.json
go-sdk/tester/
# tls
tls_cert.pem
tls_key.pem

View File

@@ -1,2 +1,58 @@
.git
node_modules
build
# See https://help.github.com/ignore-files/ for more about ignoring files.
# dependencies
/node_modules
/newrelic_agent.log
.idea
# testing
/coverage
# production
/build
# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
env.js
npm-debug.log*
yarn-debug.log*
yarn-error.log*
yarn.lock
Untitled-1
*.local.sh
*.local.yaml
run
stop
nohup.out*
encrypted-credentials.tar
encrypted-credentials/
_README.md
# Important Add production values to gitignore.
values-saas-production.yaml
kubernetes/values-saas-production.yaml
/private
/public
/tls_cert.pem
/tls_key.pem
/keys
temp_readme.md
tests/coverage
settings.json
go-sdk/tester/

View File

@@ -28,7 +28,7 @@ Expand the name of the chart.
{{- end -}}
{{- define "oneuptime.fetchResourcesUrl" -}}
{{ printf "http://%s-fetch-resources.%s.%s" $.Release.Name $.Release.Namespace "svc.cluster.local" }}
{{ printf "http://%s-probe-api.%s.%s" $.Release.Name $.Release.Namespace "svc.cluster.local" }}
{{- end -}}
{{- define "oneuptime.scriptRunnerUrl" -}}

View File

@@ -1,32 +1,32 @@
###########-----FETCH-RESOURCES------##############
###########-----probe-api------##############
# OneUptime Backend Deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ printf "%s-%s" .Release.Name "fetch-resources" }}
name: {{ printf "%s-%s" .Release.Name "probe-api" }}
namespace: {{ .Release.Namespace }}
labels:
app: {{ printf "%s-%s" .Release.Name "fetch-resources" }}
app: {{ printf "%s-%s" .Release.Name "probe-api" }}
{{- if $.Values.saas.isRunningOnGCPMarketplace }}
app.kubernetes.io/name: "$name"
app.kubernetes.io/part-of: oneuptime
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/component: {{ printf "%s-%s" .Release.Name "fetch-resources" }}
app.kubernetes.io/component: {{ printf "%s-%s" .Release.Name "probe-api" }}
{{- end }}
spec:
selector:
matchLabels:
app: {{ printf "%s-%s" .Release.Name "fetch-resources" }}
app: {{ printf "%s-%s" .Release.Name "probe-api" }}
replicas: {{ .Values.replicaCount }}
template:
metadata:
labels:
app: {{ printf "%s-%s" .Release.Name "fetch-resources" }}
app: {{ printf "%s-%s" .Release.Name "probe-api" }}
spec:
containers:
- image: {{ printf "%s/%s/%s:%s" .Values.image.registry .Values.image.repository "fetch-resources" .Values.image.tag }}
name: {{ printf "%s-%s" .Release.Name "fetch-resources" }}
- image: {{ printf "%s/%s/%s:%s" .Values.image.registry .Values.image.repository "probe-api" .Values.image.tag }}
name: {{ printf "%s-%s" .Release.Name "probe-api" }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
resources:
requests:
@@ -66,9 +66,9 @@ spec:
- name: ONEUPTIME_HOST
value: {{ .Values.oneuptime.hosts.host1.host }}
- name: DEPLOYMENT_NAME
value: {{ printf "%s-%s" .Release.Name "fetch-resources" }}
value: {{ printf "%s-%s" .Release.Name "probe-api" }}
- name: CONTAINER_NAME
value: {{ printf "%s-%s" .Release.Name "fetch-resources" }}
value: {{ printf "%s-%s" .Release.Name "probe-api" }}
- name: BACKEND_PROTOCOL
value: {{ .Values.backendProtocol }}
- name: PORT
@@ -80,7 +80,7 @@ spec:
ports:
- containerPort: {{ .Values.host.fetchResourcesPort }}
hostPort: {{ .Values.host.fetchResourcesPort }}
name: {{ printf "%s-%s" .Release.Name "fetch-resources" }}
name: {{ printf "%s-%s" .Release.Name "probe-api" }}
{{- if $.Values.saas.isRunningOnGCPMarketplace }}
- name: ubbagent
image: $imageUbbagent
@@ -119,17 +119,17 @@ apiVersion: v1
kind: Service
metadata:
labels:
app: {{ printf "%s-%s" .Release.Name "fetch-resources" }}
app: {{ printf "%s-%s" .Release.Name "probe-api" }}
app.kubernetes.io/part-of: oneuptime
app.kubernetes.io/managed-by: Helm
name: {{ printf "%s-%s" .Release.Name "fetch-resources" }}
name: {{ printf "%s-%s" .Release.Name "probe-api" }}
namespace: {{ .Release.Namespace }}
spec:
ports:
- port: {{ .Values.host.fetchResourcesServicePort }}
targetPort: {{ .Values.host.fetchResourcesPort }}
selector:
app: {{ printf "%s-%s" .Release.Name "fetch-resources" }}
app: {{ printf "%s-%s" .Release.Name "probe-api" }}
type: ClusterIP
---
##################################################
@@ -138,14 +138,14 @@ spec:
apiVersion: autoscaling/v1
kind: HorizontalPodAutoscaler
metadata:
name: {{ printf "%s-%s" .Release.Name "fetch-resources" }}
name: {{ printf "%s-%s" .Release.Name "probe-api" }}
spec:
maxReplicas: {{ .Values.autoScaler.maxReplicas }}
minReplicas: {{ .Values.autoScaler.minReplicas }}
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ printf "%s-%s" .Release.Name "fetch-resources" }}
name: {{ printf "%s-%s" .Release.Name "probe-api" }}
targetCPUUtilizationPercentage: {{ .Values.autoScaler.averageCpuUtilization }}
---
{{- end }}

View File

@@ -42,9 +42,9 @@ spec:
backend:
serviceName: {{ printf "%s-%s" $.Release.Name "ingestor" }}
servicePort: 80
- path: /fetch-resources
- path: /probe-api
backend:
serviceName: {{ printf "%s-%s" $.Release.Name "fetch-resources" }}
serviceName: {{ printf "%s-%s" $.Release.Name "probe-api" }}
servicePort: 80
- path: /dashboard
backend:

View File

@@ -1,2 +1,58 @@
.git
node_modules
build
# See https://help.github.com/ignore-files/ for more about ignoring files.
# dependencies
/node_modules
/newrelic_agent.log
.idea
# testing
/coverage
# production
/build
# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
env.js
npm-debug.log*
yarn-debug.log*
yarn-error.log*
yarn.lock
Untitled-1
*.local.sh
*.local.yaml
run
stop
nohup.out*
encrypted-credentials.tar
encrypted-credentials/
_README.md
# Important Add production values to gitignore.
values-saas-production.yaml
kubernetes/values-saas-production.yaml
/private
/public
/tls_cert.pem
/tls_key.pem
/keys
temp_readme.md
tests/coverage
settings.json
go-sdk/tester

View File

@@ -1,11 +1,58 @@
node_modules/
.vscode/
.git
node_modules
# See https://help.github.com/ignore-files/ for more about ignoring files.
# dependencies
/node_modules
/newrelic_agent.log
.idea
# testing
/coverage
# production
/build
# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
env.js
npm-debug.log*
yarn-debug.log*
yarn-error.log*
yarn.lock
yarn.lock
Untitled-1
*.local.sh
*.local.yaml
run
stop
nohup.out*
encrypted-credentials.tar
encrypted-credentials/
_README.md
# Important Add production values to gitignore.
values-saas-production.yaml
kubernetes/values-saas-production.yaml
/private
/public
/tls_cert.pem
/tls_key.pem
/keys
temp_readme.md
tests/coverage
settings.json
go-sdk/tester/

View File

@@ -11,6 +11,14 @@ RUN apk update && apk add bash && apk add curl
#Use bash shell by default
SHELL ["/bin/bash", "-c"]
# Install common-server
RUN mkdir /usr/src/common-server
WORKDIR /usr/src/common-server
COPY ../common-server/package*.json /usr/src/common-server/
RUN npm ci --only=production
COPY ../common-server /usr/src/common-server
#SET ENV Variables
ENV PRODUCTION=true
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
@@ -21,11 +29,11 @@ RUN mkdir /usr/src/app
WORKDIR /usr/src/app
# Install app dependencies
COPY package*.json /usr/src/app/
COPY ./http-test-server/package*.json /usr/src/app/
RUN npm ci --only=production
# Bundle app source
COPY . /usr/src/app
COPY ./http-test-server /usr/src/app
# Expose ports.
# - 3010: OneUptime-http-test-server

View File

@@ -11,6 +11,14 @@ RUN apk update && apk add bash && apk add curl
#Use bash shell by default
SHELL ["/bin/bash", "-c"]
# Install common-server
RUN mkdir /usr/src/common-server
WORKDIR /usr/src/common-server
COPY ../common-server/package*.json /usr/src/common-server/
RUN npm ci --only=production
COPY ../common-server /usr/src/common-server
#SET ENV Variables
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
@@ -21,8 +29,8 @@ RUN npm install nodemon -g
WORKDIR /usr/src/app
# Copy package.json files
COPY ./package.json /usr/src/app/package.json
COPY ./package-lock.json /usr/src/app/package-lock.json
COPY ./http-test-server/package.json /usr/src/app/package.json
COPY ./http-test-server/package-lock.json /usr/src/app/package-lock.json
# Install app dependencies

View File

@@ -1,2 +1,58 @@
.git
node_modules
build
# See https://help.github.com/ignore-files/ for more about ignoring files.
# dependencies
/node_modules
/newrelic_agent.log
.idea
# testing
/coverage
# production
/build
# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
env.js
npm-debug.log*
yarn-debug.log*
yarn-error.log*
yarn.lock
Untitled-1
*.local.sh
*.local.yaml
run
stop
nohup.out*
encrypted-credentials.tar
encrypted-credentials/
_README.md
# Important Add production values to gitignore.
values-saas-production.yaml
kubernetes/values-saas-production.yaml
/private
/public
/tls_cert.pem
/tls_key.pem
/keys
temp_readme.md
tests/coverage
settings.json
go-sdk/tester/

View File

@@ -10,6 +10,14 @@ RUN apk update && apk add bash && apk add curl
#Use bash shell by default
SHELL ["/bin/bash", "-c"]
# Install common-server
RUN mkdir /usr/src/common-server
WORKDIR /usr/src/common-server
COPY ../common-server/package*.json /usr/src/common-server/
RUN npm ci --only=production
COPY ../common-server /usr/src/common-server
# Set env variables
ENV PRODUCTION=true
@@ -18,7 +26,7 @@ RUN mkdir /usr/src/app
WORKDIR /usr/src/app
# Copy app source
COPY . /usr/src/app
COPY ./init-script /usr/src/app
# Install app dependencies
RUN npm install

View File

@@ -11,6 +11,14 @@ RUN apk update && apk add bash && apk add curl
#Use bash shell by default
SHELL ["/bin/bash", "-c"]
# Install common-server
RUN mkdir /usr/src/common-server
WORKDIR /usr/src/common-server
COPY ../common-server/package*.json /usr/src/common-server/
RUN npm ci --only=production
COPY ../common-server /usr/src/common-server
#SET ENV Variables
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
@@ -21,8 +29,8 @@ RUN npm install nodemon -g
WORKDIR /usr/src/app
# Copy package.json files
COPY ./package.json /usr/src/app/package.json
COPY ./package-lock.json /usr/src/app/package-lock.json
COPY ./init-script/package.json /usr/src/app/package.json
COPY ./init-script/package-lock.json /usr/src/app/package-lock.json
# Install app dependencies

View File

@@ -1,11 +1,58 @@
node_modules/
.vscode/
.git
node_modules
# See https://help.github.com/ignore-files/ for more about ignoring files.
# dependencies
/node_modules
/newrelic_agent.log
.idea
# testing
/coverage
# production
/build
# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
env.js
npm-debug.log*
yarn-debug.log*
yarn-error.log*
yarn.lock
yarn.lock
Untitled-1
*.local.sh
*.local.yaml
run
stop
nohup.out*
encrypted-credentials.tar
encrypted-credentials/
_README.md
# Important Add production values to gitignore.
values-saas-production.yaml
kubernetes/values-saas-production.yaml
/private
/public
/tls_cert.pem
/tls_key.pem
/keys
temp_readme.md
tests/coverage
settings.json
go-sdk/tester/

View File

@@ -11,6 +11,14 @@ RUN apk update && apk add bash && apk add curl
#Use bash shell by default
SHELL ["/bin/bash", "-c"]
# Install common-server
RUN mkdir /usr/src/common-server
WORKDIR /usr/src/common-server
COPY ../common-server/package*.json /usr/src/common-server/
RUN npm ci --only=production
COPY ../common-server /usr/src/common-server
#SET ENV Variables
ENV PRODUCTION=true
@@ -20,11 +28,11 @@ RUN mkdir /usr/src/app
WORKDIR /usr/src/app
# Install app dependencies
COPY package*.json /usr/src/app/
COPY ./licensing/package*.json /usr/src/app/
RUN npm ci --only=production
# Bundle app source
COPY . /usr/src/app
COPY ./licensing /usr/src/app
# Expose ports.
# - 3004: OneUptime-licensing

View File

@@ -11,6 +11,14 @@ RUN apk update && apk add bash && apk add curl
#Use bash shell by default
SHELL ["/bin/bash", "-c"]
# Install common-server
RUN mkdir /usr/src/common-server
WORKDIR /usr/src/common-server
COPY ../common-server/package*.json /usr/src/common-server/
RUN npm ci --only=production
COPY ../common-server /usr/src/common-server
#SET ENV Variables
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
@@ -21,8 +29,8 @@ RUN npm install nodemon -g
WORKDIR /usr/src/app
# Copy package.json files
COPY ./package.json /usr/src/app/package.json
COPY ./package-lock.json /usr/src/app/package-lock.json
COPY ./licensing/package.json /usr/src/app/package.json
COPY ./licensing/package-lock.json /usr/src/app/package-lock.json
# Install app dependencies

View File

@@ -11,6 +11,14 @@ RUN apk update && apk add bash && apk add curl
#Use bash shell by default
SHELL ["/bin/bash", "-c"]
# Install common-server
RUN mkdir /usr/src/common-server
WORKDIR /usr/src/common-server
COPY ../common-server/package*.json /usr/src/common-server/
RUN npm ci --only=production
COPY ../common-server /usr/src/common-server
#SET ENV Variables
ENV PRODUCTION=true
ENV CHROME_PATH=/usr/bin/chromium
@@ -24,11 +32,11 @@ RUN mkdir /usr/src/app
WORKDIR /usr/src/app
# Install app dependencies
COPY package*.json /usr/src/app/
COPY ./lighthouse-runner/package*.json /usr/src/app/
RUN npm ci --only=production
# Bundle app source
COPY . /usr/src/app
COPY ./lighthouse-runner /usr/src/app
# Expose ports.
# - 3015: Lighthouse Runner

View File

@@ -11,6 +11,14 @@ RUN apk update && apk add bash && apk add curl
#Use bash shell by default
SHELL ["/bin/bash", "-c"]
# Install common-server
RUN mkdir /usr/src/common-server
WORKDIR /usr/src/common-server
COPY ../common-server/package*.json /usr/src/common-server/
RUN npm ci --only=production
COPY ../common-server /usr/src/common-server
#SET ENV Variables
ENV CHROME_PATH=/usr/bin/google-chrome
@@ -23,8 +31,8 @@ RUN apk add chromium
RUN cd /usr/src/app
# Copy package.json files
COPY ./package.json /usr/src/app/package.json
COPY ./package-lock.json /usr/src/app/package-lock.json
COPY ./lighthouse-runner/package.json /usr/src/app/package.json
COPY ./lighthouse-runner/package-lock.json /usr/src/app/package-lock.json
RUN npm ci

View File

@@ -26,8 +26,8 @@ upstream docs {
upstream ingestor {
server data-ingestor:3200;
}
upstream fetch-resources {
server fetch-resources:3400;
upstream probe-api {
server probe-api:3400;
}
upstream probe1 {
server probe1:3024;

View File

@@ -1,5 +1,5 @@
#
# OneUptime-fetch-resources Dockerfile
# OneUptime-probe-api Dockerfile
#
# Pull base image nodejs image.
@@ -11,6 +11,14 @@ RUN apk update && apk add bash && apk add curl
#Use bash shell by default
SHELL ["/bin/bash", "-c"]
# Install common-server
RUN mkdir /usr/src/common-server
WORKDIR /usr/src/common-server
COPY ../common-server/package*.json /usr/src/common-server/
RUN npm ci --only=production
COPY ../common-server /usr/src/common-server
#SET ENV Variables
ENV PRODUCTION=true
@@ -20,11 +28,11 @@ RUN mkdir /usr/src/app
WORKDIR /usr/src/app
# Install app dependencies
COPY package*.json /usr/src/app/
COPY ./probe-api/package*.json /usr/src/app/
RUN npm ci --only=production
# Bundle app source
COPY . /usr/src/app
COPY ./probe-api /usr/src/app
# Expose ports.
EXPOSE 3400

View File

@@ -1,5 +1,5 @@
#
# OneUptime-fetch-resources Dockerfile
# OneUptime-probe-api Dockerfile
#
# Pull base image nodejs image.
@@ -11,14 +11,22 @@ RUN apk update && apk add bash && apk add curl
#Use bash shell by default
SHELL ["/bin/bash", "-c"]
# Install common-server
RUN mkdir /usr/src/common-server
WORKDIR /usr/src/common-server
COPY ../common-server/package*.json /usr/src/common-server/
RUN npm ci --only=production
COPY ../common-server /usr/src/common-server
WORKDIR /usr/src/app
# Install app dependencies
RUN cd /usr/src/app
# Copy package.json files
COPY ./package.json /usr/src/app/package.json
COPY ./package-lock.json /usr/src/app/package-lock.json
COPY ./probe-api/package.json /usr/src/app/package.json
COPY ./probe-api/package-lock.json /usr/src/app/package-lock.json
RUN npm ci

View File

@@ -30,7 +30,7 @@ process.on('uncaughtException', err => {
Sentry.init({
dsn: process.env.SENTRY_DSN,
release: `fetch-resources@${process.env.npm_package_version}`,
release: `probe-api@${process.env.npm_package_version}`,
environment: process.env.NODE_ENV,
integrations: [
// enable HTTP calls tracing
@@ -130,13 +130,13 @@ app.use(function(req, res, next) {
return next();
});
app.get(['/fetch-resources/status', '/status'], function(req, res) {
app.get(['/probe-api/status', '/status'], function(req, res) {
res.setHeader('Content-Type', 'application/json');
res.send(
JSON.stringify({
status: 200,
message: 'Service Status - OK',
serviceType: 'oneuptime-fetch-resources',
serviceType: 'oneuptime-probe-api',
})
);
});
@@ -149,7 +149,7 @@ app.set('port', process.env.PORT || 3400);
http.listen(app.get('port'), function() {
// eslint-disable-next-line
console.log('fetch-resources server started on port ' + app.get('port'));
console.log('probe-api server started on port ' + app.get('port'));
});
module.exports = app;

View File

@@ -4,7 +4,7 @@
*
*/
const ProbeService = require('../services/probeService');
const sendErrorResponse = require('../middlewares/response').sendErrorResponse;
const sendErrorResponse = require('./response').sendErrorResponse;
const ErrorService = require('../services/errorService');
const { clusterKey: CLUSTER_KEY } = require('../utils/config');

View File

@@ -1,11 +1,11 @@
{
"name": "fetch-resources",
"name": "probe-api",
"version": "3.0.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "fetch-resources",
"name": "probe-api",
"version": "3.0.0",
"license": "ISC",
"dependencies": {

View File

@@ -1,5 +1,5 @@
{
"name": "fetch-resources",
"name": "probe-api",
"version": "3.0.0",
"description": "A project to handle all resource fetching or update for probes",
"main": "index.js",

View File

@@ -1,12 +1,58 @@
node_modules/
kubernetes/
.vscode/
.git
node_modules
# See https://help.github.com/ignore-files/ for more about ignoring files.
# dependencies
/node_modules
/newrelic_agent.log
.idea
# testing
/coverage
# production
/build
# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
env.js
npm-debug.log*
yarn-debug.log*
yarn-error.log*
yarn.lock
yarn.lock
Untitled-1
*.local.sh
*.local.yaml
run
stop
nohup.out*
encrypted-credentials.tar
encrypted-credentials/
_README.md
# Important Add production values to gitignore.
values-saas-production.yaml
kubernetes/values-saas-production.yaml
/private
/public
/tls_cert.pem
/tls_key.pem
/keys
temp_readme.md
tests/coverage
settings.json
go-sdk/tester/

View File

@@ -17,6 +17,15 @@ ENV PRODUCTION=true
RUN mkdir /usr/src
RUN mkdir /usr/src/app
# Install common-server
RUN mkdir /usr/src/common-server
WORKDIR /usr/src/common-server
COPY ../common-server/package*.json /usr/src/common-server/
RUN npm ci --only=production
COPY ../common-server /usr/src/common-server
# Install app
WORKDIR /usr/src/app
# Install trivy for container scanning
@@ -38,7 +47,7 @@ COPY package*.json /usr/src/app/
RUN npm ci --only=production
# Bundle app source
COPY . /usr/src/app
COPY /probe /usr/src/app
# Expose ports.
# - 3008: probe

View File

@@ -11,6 +11,14 @@ RUN apk update && apk add bash && apk add curl
#Use bash shell by default
SHELL ["/bin/bash", "-c"]
# Install common-server
RUN mkdir /usr/src/common-server
WORKDIR /usr/src/common-server
COPY ../common-server/package*.json /usr/src/common-server/
RUN npm ci --only=production
COPY ../common-server /usr/src/common-server
WORKDIR /usr/src/app
# Install trivy for container scanning
@@ -31,8 +39,8 @@ RUN mv ./kubectl /usr/local/bin/kubectl && \
RUN cd /usr/src/app
# Copy package.json files
COPY ./package.json /usr/src/app/package.json
COPY ./package-lock.json /usr/src/app/package-lock.json
COPY ./probe/package.json /usr/src/app/package.json
COPY ./probe/package-lock.json /usr/src/app/package-lock.json
RUN npm ci

View File

@@ -3,6 +3,7 @@
* Copyright HackerBay, Inc.
*
*/
const logger = require('../../common-server/utils/logger');
const getApi = require('../utils/api').getApi;
const ApiMonitors = require('./apiMonitors');
const UrlMonitors = require('./urlMonitors');
@@ -31,18 +32,18 @@ const _this = {
monitorStore = {};
try {
console.log(`Getting a list of ${limit} monitors`);
logger.info(`Getting a list of ${limit} monitors`);
let monitors = await getApi('probe/monitors', limit);
monitors = JSON.parse(monitors.data); // parse the stringified data
console.log(
logger.info(
`Number of Monitors fetched - ${monitors.length} monitors`
);
if (monitors.length === 0) {
// there are no monitors to monitor. Sleep for 30 seconds and then wake up.
console.log('No monitors to monitor. Sleeping for 30 seconds.');
logger.info('No monitors to monitor. Sleeping for 30 seconds.');
await asyncSleep(30 * 1000);
}
@@ -56,7 +57,7 @@ const _this = {
// loop over the monitor
for (const [key, monitor] of Object.entries(monitorStore)) {
try {
console.log(`Currently monitoring: Monitor ID ${key}`);
logger.info(`Currently monitoring: Monitor ID ${key}`);
if (monitor.type === 'api') {
await ApiMonitors.ping({ monitor });
} else if (monitor.type === 'url') {

View File

@@ -1,11 +1,58 @@
node_modules/
.vscode/
.git
node_modules
# See https://help.github.com/ignore-files/ for more about ignoring files.
# dependencies
/node_modules
/newrelic_agent.log
.idea
# testing
/coverage
# production
/build
# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
env.js
npm-debug.log*
yarn-debug.log*
yarn-error.log*
yarn.lock
yarn.lock
Untitled-1
*.local.sh
*.local.yaml
run
stop
nohup.out*
encrypted-credentials.tar
encrypted-credentials/
_README.md
# Important Add production values to gitignore.
values-saas-production.yaml
kubernetes/values-saas-production.yaml
/private
/public
/tls_cert.pem
/tls_key.pem
/keys
temp_readme.md
tests/coverage
settings.json
go-sdk/tester/

View File

@@ -11,6 +11,14 @@ RUN apk update && apk add bash && apk add curl
#Use bash shell by default
SHELL ["/bin/bash", "-c"]
# Install common-server
RUN mkdir /usr/src/common-server
WORKDIR /usr/src/common-server
COPY ../common-server/package*.json /usr/src/common-server/
RUN npm ci --only=production
COPY ../common-server /usr/src/common-server
#SET ENV Variables
ENV PRODUCTION=true
@@ -29,11 +37,11 @@ RUN mv ./kubectl /usr/local/bin/kubectl && \
chown root: /usr/local/bin/kubectl
# Install app dependencies
COPY package*.json /usr/src/app/
COPY ./realtime/package*.json /usr/src/app/
RUN npm ci --only=production
# Bundle app source
COPY . /usr/src/app
COPY ./realtime /usr/src/app
# Expose ports.
EXPOSE 3300

View File

@@ -11,6 +11,14 @@ RUN apk update && apk add bash && apk add curl
#Use bash shell by default
SHELL ["/bin/bash", "-c"]
# Install common-server
RUN mkdir /usr/src/common-server
WORKDIR /usr/src/common-server
COPY ../common-server/package*.json /usr/src/common-server/
RUN npm ci --only=production
COPY ../common-server /usr/src/common-server
WORKDIR /usr/src/app
# Install kubectl for kubernetes monitor scanning
@@ -25,8 +33,8 @@ RUN mv ./kubectl /usr/local/bin/kubectl && \
RUN cd /usr/src/app
# Copy package.json files
COPY ./package.json /usr/src/app/package.json
COPY ./package-lock.json /usr/src/app/package-lock.json
COPY ./realtime/package.json /usr/src/app/package.json
COPY ./realtime/package-lock.json /usr/src/app/package-lock.json
RUN npm ci

View File

@@ -11,6 +11,14 @@ RUN apk update && apk add bash && apk add curl
#Use bash shell by default
SHELL ["/bin/bash", "-c"]
# Install common-server
RUN mkdir /usr/src/common-server
WORKDIR /usr/src/common-server
COPY ../common-server/package*.json /usr/src/common-server/
RUN npm ci --only=production
COPY ../common-server /usr/src/common-server
#SET ENV Variables
ENV PRODUCTION=true
@@ -20,11 +28,11 @@ RUN mkdir /usr/src/app
WORKDIR /usr/src/app
# Install app dependencies
COPY package*.json /usr/src/app/
COPY ./script-runner/package*.json /usr/src/app/
RUN npm ci --only=production
# Bundle app source
COPY . /usr/src/app
COPY ./script-runner /usr/src/app
# Expose ports.
# - 3009: OneUptime:script-runner

View File

@@ -11,6 +11,14 @@ RUN apk update && apk add bash && apk add curl
#Use bash shell by default
SHELL ["/bin/bash", "-c"]
# Install common-server
RUN mkdir /usr/src/common-server
WORKDIR /usr/src/common-server
COPY ../common-server/package*.json /usr/src/common-server/
RUN npm ci --only=production
COPY ../common-server /usr/src/common-server
#SET ENV Variables
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
@@ -20,8 +28,8 @@ RUN npm install nodemon -g
WORKDIR /usr/src/app
# Copy package.json files
COPY ./package.json /usr/src/app/package.json
COPY ./package-lock.json /usr/src/app/package-lock.json
COPY ./script-runner/package.json /usr/src/app/package.json
COPY ./script-runner/package-lock.json /usr/src/app/package-lock.json
# Install app dependencies

View File

@@ -1,2 +1,58 @@
.git
node_modules
build
# See https://help.github.com/ignore-files/ for more about ignoring files.
# dependencies
/node_modules
/newrelic_agent.log
.idea
# testing
/coverage
# production
/build
# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
env.js
npm-debug.log*
yarn-debug.log*
yarn-error.log*
yarn.lock
Untitled-1
*.local.sh
*.local.yaml
run
stop
nohup.out*
encrypted-credentials.tar
encrypted-credentials/
_README.md
# Important Add production values to gitignore.
values-saas-production.yaml
kubernetes/values-saas-production.yaml
/private
/public
/tls_cert.pem
/tls_key.pem
/keys
temp_readme.md
tests/coverage
settings.json
go-sdk/tester/