diff --git a/.github/workflows/compile.yml b/.github/workflows/compile.yml index 6b27cbace8..1348d76348 100644 --- a/.github/workflows/compile.yml +++ b/.github/workflows/compile.yml @@ -248,7 +248,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}} @@ -260,7 +260,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: diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index 4f495bfb41..a71b66a370 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -223,7 +223,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}} @@ -236,7 +236,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 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ee20e471e0..1ff8b50f12 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -567,7 +567,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: @@ -576,8 +576,8 @@ 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 @@ -599,7 +599,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 @@ -617,7 +617,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 diff --git a/.github/workflows/test-release.yaml b/.github/workflows/test-release.yaml index ab4afd2cd2..38cdf3bfa6 100644 --- a/.github/workflows/test-release.yaml +++ b/.github/workflows/test-release.yaml @@ -509,7 +509,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: @@ -518,8 +518,8 @@ 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 @@ -542,7 +542,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 @@ -560,7 +560,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 diff --git a/.github/workflows/test.probe-api.yaml b/.github/workflows/test.probe-api.yaml index b317ae4728..7c6344e1be 100644 --- a/.github/workflows/test.probe-api.yaml +++ b/.github/workflows/test.probe-api.yaml @@ -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 diff --git a/.vscode/launch.json b/.vscode/launch.json index 620bd58b73..22e5f9f5bd 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -99,7 +99,7 @@ }, { "address": "127.0.0.1", - "localRoot": "${workspaceFolder}/ProbeAPI", + "localRoot": "${workspaceFolder}/Ingestor", "name": "Probe API: Debug with Docker", "port": 9932, "remoteRoot": "/usr/src/app", @@ -197,7 +197,7 @@ }, { "address": "127.0.0.1", - "localRoot": "${workspaceFolder}/ProbeAPI", + "localRoot": "${workspaceFolder}/Ingestor", "name": "Probe API: Debug with Docker", "port": 9251, "remoteRoot": "/usr/src/app", diff --git a/Common/ServiceRoute.ts b/Common/ServiceRoute.ts index 398b4bfb24..9cf9bd94b9 100644 --- a/Common/ServiceRoute.ts +++ b/Common/ServiceRoute.ts @@ -26,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'); diff --git a/Common/Types/Probe/ProbeApiIngestResponse.ts b/Common/Types/Probe/ProbeApiIngestResponse.ts index 9d7dae3282..f1bf71e93f 100644 --- a/Common/Types/Probe/ProbeApiIngestResponse.ts +++ b/Common/Types/Probe/ProbeApiIngestResponse.ts @@ -1,6 +1,6 @@ import ObjectID from '../ObjectID'; -export default interface ProbeApiIngestResponse { +export default interface IngestorIngestResponse { monitorId: ObjectID; ingestedMonitorStepId?: ObjectID | undefined; nextMonitorStepId?: ObjectID | undefined; diff --git a/CommonServer/API/ProbeAPI.ts b/CommonServer/API/ProbeAPI.ts index 094e3719e5..d6675f8978 100644 --- a/CommonServer/API/ProbeAPI.ts +++ b/CommonServer/API/ProbeAPI.ts @@ -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 { +export default class Ingestor extends BaseAPI { public constructor() { super(Probe, ProbeService); diff --git a/CommonServer/EnvironmentConfig.ts b/CommonServer/EnvironmentConfig.ts index 2f5989baea..6b8a7990b0 100644 --- a/CommonServer/EnvironmentConfig.ts +++ b/CommonServer/EnvironmentConfig.ts @@ -97,9 +97,9 @@ export const DashboardApiHostname: Hostname = Hostname.fromString( }` ); -export const ProbeApiHostname: Hostname = Hostname.fromString( - `${process.env['SERVER_PROBE_API_HOSTNAME'] || 'localhost'}:${ - process.env['PROBE_API_PORT'] || 80 +export const IngestorHostname: Hostname = Hostname.fromString( + `${process.env['SERVER_INGESTOR_HOSTNAME'] || 'localhost'}:${ + process.env['INGESTOR_PORT'] || 80 }` ); diff --git a/CommonServer/Utils/Probe/ProbeMonitorResponse.ts b/CommonServer/Utils/Probe/ProbeMonitorResponse.ts index 6fc77f9925..9c226454e4 100644 --- a/CommonServer/Utils/Probe/ProbeMonitorResponse.ts +++ b/CommonServer/Utils/Probe/ProbeMonitorResponse.ts @@ -9,7 +9,7 @@ import MonitorCriteria from 'Common/Types/Monitor/MonitorCriteria'; import MonitorCriteriaInstance from 'Common/Types/Monitor/MonitorCriteriaInstance'; import MonitorStep from 'Common/Types/Monitor/MonitorStep'; import MonitorSteps from 'Common/Types/Monitor/MonitorSteps'; -import ProbeApiIngestResponse from 'Common/Types/Probe/ProbeApiIngestResponse'; +import IngestorIngestResponse from 'Common/Types/Probe/IngestorIngestResponse'; import ProbeMonitorResponse from 'Common/Types/Probe/ProbeMonitorResponse'; import Typeof from 'Common/Types/Typeof'; import MonitorService from '../../Services/MonitorService'; @@ -39,8 +39,8 @@ import VMUtil from '../VM'; export default class ProbeMonitorResponseService { public static async processProbeResponse( dataToProcess: ProbeMonitorResponse | IncomingMonitorRequest - ): Promise { - let response: ProbeApiIngestResponse = { + ): Promise { + let response: IngestorIngestResponse = { monitorId: dataToProcess.monitorId, criteriaMetId: undefined, rootCause: null, @@ -289,7 +289,7 @@ export default class ProbeMonitorResponseService { dataToProcess: dataToProcess, monitorStep: monitorStep, monitor: monitor, - probeApiIngestResponse: response, + ingestorIngestResponse: response, }); if (response.criteriaMetId && response.rootCause) { @@ -665,8 +665,8 @@ export default class ProbeMonitorResponseService { dataToProcess: ProbeMonitorResponse | IncomingMonitorRequest; monitorStep: MonitorStep; monitor: Monitor; - probeApiIngestResponse: ProbeApiIngestResponse; - }): Promise { + ingestorIngestResponse: IngestorIngestResponse; + }): Promise { // process monitor step here. const criteria: MonitorCriteria | undefined = @@ -674,7 +674,7 @@ export default class ProbeMonitorResponseService { if (!criteria || !criteria.data) { // do nothing as there's no criteria to process. - return input.probeApiIngestResponse; + return input.ingestorIngestResponse; } for (const criteriaInstance of criteria.data @@ -685,15 +685,15 @@ export default class ProbeMonitorResponseService { dataToProcess: input.dataToProcess, monitorStep: input.monitorStep, monitor: input.monitor, - probeApiIngestResponse: input.probeApiIngestResponse, + ingestorIngestResponse: input.ingestorIngestResponse, criteriaInstance: criteriaInstance, } ); if (rootCause) { - input.probeApiIngestResponse.criteriaMetId = + input.ingestorIngestResponse.criteriaMetId = criteriaInstance.data?.id; - input.probeApiIngestResponse.rootCause = + input.ingestorIngestResponse.rootCause = rootCause + ' ' + ( @@ -704,14 +704,14 @@ export default class ProbeMonitorResponseService { } } - return input.probeApiIngestResponse; + return input.ingestorIngestResponse; } private static async processMonitorCriteiaInstance(input: { dataToProcess: ProbeMonitorResponse | IncomingMonitorRequest; monitorStep: MonitorStep; monitor: Monitor; - probeApiIngestResponse: ProbeApiIngestResponse; + ingestorIngestResponse: IngestorIngestResponse; criteriaInstance: MonitorCriteriaInstance; }): Promise { // returns root cause if any. Otherwise criteria is not met. @@ -723,7 +723,7 @@ export default class ProbeMonitorResponseService { dataToProcess: input.dataToProcess, monitorStep: input.monitorStep, monitor: input.monitor, - probeApiIngestResponse: input.probeApiIngestResponse, + ingestorIngestResponse: input.ingestorIngestResponse, criteriaInstance: input.criteriaInstance, } ); @@ -736,7 +736,7 @@ export default class ProbeMonitorResponseService { dataToProcess: ProbeMonitorResponse | IncomingMonitorRequest; monitorStep: MonitorStep; monitor: Monitor; - probeApiIngestResponse: ProbeApiIngestResponse; + ingestorIngestResponse: IngestorIngestResponse; criteriaInstance: MonitorCriteriaInstance; }): Promise { // returns root cause if any. Otherwise criteria is not met. @@ -756,7 +756,7 @@ export default class ProbeMonitorResponseService { dataToProcess: input.dataToProcess, monitorStep: input.monitorStep, monitor: input.monitor, - probeApiIngestResponse: input.probeApiIngestResponse, + ingestorIngestResponse: input.ingestorIngestResponse, criteriaInstance: input.criteriaInstance, criteriaFilter: criteriaFilter, } @@ -798,7 +798,7 @@ export default class ProbeMonitorResponseService { dataToProcess: ProbeMonitorResponse | IncomingMonitorRequest; monitorStep: MonitorStep; monitor: Monitor; - probeApiIngestResponse: ProbeApiIngestResponse; + ingestorIngestResponse: IngestorIngestResponse; criteriaInstance: MonitorCriteriaInstance; criteriaFilter: CriteriaFilter; }): Promise { diff --git a/CommonUI/src/Config.ts b/CommonUI/src/Config.ts index 70e8be5072..be48d91337 100644 --- a/CommonUI/src/Config.ts +++ b/CommonUI/src/Config.ts @@ -10,7 +10,7 @@ import { IdentityRoute, IntegrationRoute, NotificationRoute, - ProbeApiRoute, + IngestorRoute, StatusPageRoute, WorkflowRoute, homeRoute, @@ -54,7 +54,7 @@ export const STATUS_PAGE_HOSTNAME: Hostname = Hostname.fromString(HOST); export const WORKFLOW_HOSTNAME: Hostname = Hostname.fromString(HOST); -export const PROBE_API_HOSTNAME: Hostname = Hostname.fromString(HOST); +export const INGESTOR_HOSTNAME: Hostname = Hostname.fromString(HOST); export const HELM_HOSTNAME: Hostname = Hostname.fromString(HOST); @@ -90,10 +90,10 @@ export const WORKFLOW_URL: URL = new URL( WorkflowRoute ); -export const PROBE_API_URL: URL = new URL( +export const INGESTOR_URL: URL = new URL( HTTP_PROTOCOL, - PROBE_API_HOSTNAME, - ProbeApiRoute + INGESTOR_HOSTNAME, + IngestorRoute ); export const STATUS_PAGE_URL: URL = new URL( diff --git a/DashboardAPI/Index.ts b/DashboardAPI/Index.ts index f399410d04..1c50dcfe69 100755 --- a/DashboardAPI/Index.ts +++ b/DashboardAPI/Index.ts @@ -307,7 +307,7 @@ import ResellerPlanAPI from 'CommonServer/API/ResellerPlanAPI'; import StatusPageAPI from 'CommonServer/API/StatusPageAPI'; import NotificationAPI from 'CommonServer/API/NotificationAPI'; -import ProbeAPI from 'CommonServer/API/ProbeAPI'; +import Ingestor from 'CommonServer/API/Ingestor'; import StatusPageSubscriberAPI from 'CommonServer/API/StatusPageSubscriberAPI'; @@ -836,7 +836,7 @@ app.use( app.use(`/${APP_NAME.toLocaleLowerCase()}`, new UserCallAPI().getRouter()); app.use(`/${APP_NAME.toLocaleLowerCase()}`, new UserEmailAPI().getRouter()); app.use(`/${APP_NAME.toLocaleLowerCase()}`, new UserSMSAPI().getRouter()); -app.use(`/${APP_NAME.toLocaleLowerCase()}`, new ProbeAPI().getRouter()); +app.use(`/${APP_NAME.toLocaleLowerCase()}`, new Ingestor().getRouter()); app.use( `/${APP_NAME.toLocaleLowerCase()}`, diff --git a/HelmChart/Public/oneuptime/templates/_helpers.tpl b/HelmChart/Public/oneuptime/templates/_helpers.tpl index fc10857acf..f3fc82dd66 100644 --- a/HelmChart/Public/oneuptime/templates/_helpers.tpl +++ b/HelmChart/Public/oneuptime/templates/_helpers.tpl @@ -31,8 +31,8 @@ value: {{ $.Release.Name }}-workflow.{{ $.Release.Namespace }}.svc.cluster.local - name: SERVER_LINK_SHORTENER_HOSTNAME value: {{ $.Release.Name }}-link-shortener.{{ $.Release.Namespace }}.svc.cluster.local -- name: SERVER_PROBE_API_HOSTNAME - value: {{ $.Release.Name }}-probe-api.{{ $.Release.Namespace }}.svc.cluster.local +- name: SERVER_INGESTOR_HOSTNAME + value: {{ $.Release.Name }}-ingestor.{{ $.Release.Namespace }}.svc.cluster.local - name: SERVER_TEST_SERVER_HOSTNAME value: {{ $.Release.Name }}-test-server.{{ $.Release.Namespace }}.svc.cluster.local - name: SERVER_FILE_HOSTNAME @@ -64,8 +64,8 @@ value: {{ $.Values.port.linkShortener | squote }} - name: ALERT_PORT value: {{ $.Values.port.alert | squote }} -- name: PROBE_API_PORT - value: {{ $.Values.port.probeApi | squote }} +- name: INGESTOR_PORT + value: {{ $.Values.port.ingestor | squote }} - name: PROBE_PORT value: {{ $.Values.port.probe | squote }} - name: TEST_SERVER_PORT diff --git a/HelmChart/Public/oneuptime/templates/probe-api.yaml b/HelmChart/Public/oneuptime/templates/probe-api.yaml index cd07a17ee5..dc53e6dbb5 100644 --- a/HelmChart/Public/oneuptime/templates/probe-api.yaml +++ b/HelmChart/Public/oneuptime/templates/probe-api.yaml @@ -1,16 +1,16 @@ -# OneUptime probeApi Deployment -{{- $probeApiEnv := dict "PORT" $.Values.port.probeApi -}} -{{- $probeApiDeploymentArgs :=dict "IsServer" true "ServiceName" "probe-api" "Port" $.Values.port.probeApi "Release" $.Release "Values" $.Values "Env" $probeApiEnv -}} -{{- include "oneuptime.deployment" $probeApiDeploymentArgs }} +# OneUptime ingestor Deployment +{{- $ingestorEnv := dict "PORT" $.Values.port.ingestor -}} +{{- $ingestorDeploymentArgs :=dict "IsServer" true "ServiceName" "ingestor" "Port" $.Values.port.ingestor "Release" $.Release "Values" $.Values "Env" $ingestorEnv -}} +{{- include "oneuptime.deployment" $ingestorDeploymentArgs }} --- -# OneUptime probeApi Service +# OneUptime ingestor Service -{{- $probeApiServiceArgs := dict "ServiceName" "probe-api" "Port" $.Values.port.probeApi "Release" $.Release "Values" $.Values -}} -{{- include "oneuptime.service" $probeApiServiceArgs }} +{{- $ingestorServiceArgs := dict "ServiceName" "ingestor" "Port" $.Values.port.ingestor "Release" $.Release "Values" $.Values -}} +{{- include "oneuptime.service" $ingestorServiceArgs }} --- -# OneUptime probeApi autoscaler -{{- $probeApiAutoScalerArgs := dict "ServiceName" "probe-api" "Release" $.Release "Values" $.Values -}} -{{- include "oneuptime.autoscaler" $probeApiAutoScalerArgs }} +# OneUptime ingestor autoscaler +{{- $ingestorAutoScalerArgs := dict "ServiceName" "ingestor" "Release" $.Release "Values" $.Values -}} +{{- include "oneuptime.autoscaler" $ingestorAutoScalerArgs }} --- \ No newline at end of file diff --git a/HelmChart/Public/oneuptime/templates/probe.yaml b/HelmChart/Public/oneuptime/templates/probe.yaml index 3643162be7..a399d0da69 100644 --- a/HelmChart/Public/oneuptime/templates/probe.yaml +++ b/HelmChart/Public/oneuptime/templates/probe.yaml @@ -28,8 +28,8 @@ spec: env: - name: PORT value: {{ $.Values.port.probe | squote }} - - name: PROBE_API_URL - value: http://{{ $.Release.Name }}-probe-api.{{ $.Release.Namespace }}.svc.cluster.local:{{ $.Values.port.probeApi }} + - name: INGESTOR_URL + value: http://{{ $.Release.Name }}-ingestor.{{ $.Release.Namespace }}.svc.cluster.local:{{ $.Values.port.ingestor }} - name: PROBE_NAME value: {{ $val.name }} - name: PROBE_DESCRIPTION diff --git a/HelmChart/Public/oneuptime/values.yaml b/HelmChart/Public/oneuptime/values.yaml index dcf7aa11d5..c8e8171ad6 100644 --- a/HelmChart/Public/oneuptime/values.yaml +++ b/HelmChart/Public/oneuptime/values.yaml @@ -130,7 +130,7 @@ port: workflow: 3099 linkShortener: 3521 alert: 3088 - probeApi: 3400 + ingestor: 3400 testServer: 3800 file: 3125 identity: 3087 diff --git a/ProbeAPI/.dockerignore b/Ingestor/.dockerignore similarity index 100% rename from ProbeAPI/.dockerignore rename to Ingestor/.dockerignore diff --git a/ProbeAPI/.gitattributes b/Ingestor/.gitattributes similarity index 100% rename from ProbeAPI/.gitattributes rename to Ingestor/.gitattributes diff --git a/ProbeAPI/.gitignore b/Ingestor/.gitignore similarity index 100% rename from ProbeAPI/.gitignore rename to Ingestor/.gitignore diff --git a/ProbeAPI/API/Alive.ts b/Ingestor/API/Alive.ts similarity index 100% rename from ProbeAPI/API/Alive.ts rename to Ingestor/API/Alive.ts diff --git a/ProbeAPI/API/IncomingRequest.ts b/Ingestor/API/IncomingRequest.ts similarity index 100% rename from ProbeAPI/API/IncomingRequest.ts rename to Ingestor/API/IncomingRequest.ts diff --git a/ProbeAPI/API/Monitor.ts b/Ingestor/API/Monitor.ts similarity index 100% rename from ProbeAPI/API/Monitor.ts rename to Ingestor/API/Monitor.ts diff --git a/ProbeAPI/API/Probe.ts b/Ingestor/API/Probe.ts similarity index 90% rename from ProbeAPI/API/Probe.ts rename to Ingestor/API/Probe.ts index bc52f214f9..8cc708eba9 100644 --- a/ProbeAPI/API/Probe.ts +++ b/Ingestor/API/Probe.ts @@ -7,7 +7,7 @@ import Express, { import Response from 'CommonServer/Utils/Response'; import ProbeAuthorization from '../Middleware/ProbeAuthorization'; import ProbeMonitorResponse from 'Common/Types/Probe/ProbeMonitorResponse'; -import ProbeApiIngestResponse from 'Common/Types/Probe/ProbeApiIngestResponse'; +import IngestorIngestResponse from 'Common/Types/Probe/IngestorIngestResponse'; import BadDataException from 'Common/Types/Exception/BadDataException'; import ProbeMonitorResponseService from 'CommonServer/Utils/Probe/ProbeMonitorResponse'; import JSONFunctions from 'Common/Types/JSONFunctions'; @@ -44,13 +44,13 @@ router.post( } // process probe response here. - const probeApiIngestResponse: ProbeApiIngestResponse = + const ingestorIngestResponse: IngestorIngestResponse = await ProbeMonitorResponseService.processProbeResponse( probeResponse ); return Response.sendJsonObjectResponse(req, res, { - probeApiIngestResponse: probeApiIngestResponse, + ingestorIngestResponse: ingestorIngestResponse, } as any); } catch (err) { return next(err); diff --git a/ProbeAPI/API/Register.ts b/Ingestor/API/Register.ts similarity index 100% rename from ProbeAPI/API/Register.ts rename to Ingestor/API/Register.ts diff --git a/ProbeAPI/Dockerfile.tpl b/Ingestor/Dockerfile.tpl similarity index 89% rename from ProbeAPI/Dockerfile.tpl rename to Ingestor/Dockerfile.tpl index dcd235ae90..e8b1884853 100755 --- a/ProbeAPI/Dockerfile.tpl +++ b/Ingestor/Dockerfile.tpl @@ -1,5 +1,5 @@ # -# OneUptime-probe-api Dockerfile +# OneUptime-ingestor Dockerfile # # Pull base image nodejs image. @@ -53,11 +53,11 @@ ENV PRODUCTION=true WORKDIR /usr/src/app # Install app dependencies -COPY ./ProbeAPI/package*.json /usr/src/app/ +COPY ./Ingestor/package*.json /usr/src/app/ RUN npm install # Expose ports. -# - 3400: OneUptime-probe-api +# - 3400: OneUptime-ingestor EXPOSE 3400 {{ if eq .Env.ENVIRONMENT "development" }} @@ -65,7 +65,7 @@ EXPOSE 3400 CMD [ "npm", "run", "dev" ] {{ else }} # Copy app source -COPY ./ProbeAPI /usr/src/app +COPY ./Ingestor /usr/src/app # Bundle app source RUN npm run compile #Run the app diff --git a/ProbeAPI/Index.ts b/Ingestor/Index.ts similarity index 92% rename from ProbeAPI/Index.ts rename to Ingestor/Index.ts index f69c813164..7d77b1f1a9 100644 --- a/ProbeAPI/Index.ts +++ b/Ingestor/Index.ts @@ -6,7 +6,7 @@ import App from 'CommonServer/Utils/StartServer'; import AliveAPI from './API/Alive'; import RegisterAPI from './API/Register'; import MonitorAPI from './API/Monitor'; -import ProbeAPI from './API/Probe'; +import Ingestor from './API/Probe'; import IncomingRequestAPI from './API/IncomingRequest'; import { ClickhouseAppInstance } from 'CommonServer/Infrastructure/ClickhouseDatabase'; @@ -14,12 +14,12 @@ import Redis from 'CommonServer/Infrastructure/Redis'; const app: ExpressApplication = Express.getExpressApp(); -const APP_NAME: string = 'probe-api'; +const APP_NAME: string = 'ingestor'; app.use([`/${APP_NAME}`, '/'], AliveAPI); app.use([`/${APP_NAME}`, '/'], RegisterAPI); app.use([`/${APP_NAME}`, '/'], MonitorAPI); -app.use([`/${APP_NAME}`, '/'], ProbeAPI); +app.use([`/${APP_NAME}`, '/'], Ingestor); app.use([`/${APP_NAME}`, '/'], IncomingRequestAPI); const init: () => Promise = async (): Promise => { diff --git a/ProbeAPI/Middleware/ProbeAuthorization.ts b/Ingestor/Middleware/ProbeAuthorization.ts similarity index 100% rename from ProbeAPI/Middleware/ProbeAuthorization.ts rename to Ingestor/Middleware/ProbeAuthorization.ts diff --git a/ProbeAPI/Types/Request.ts b/Ingestor/Types/Request.ts similarity index 100% rename from ProbeAPI/Types/Request.ts rename to Ingestor/Types/Request.ts diff --git a/ProbeAPI/jest.config.json b/Ingestor/jest.config.json similarity index 100% rename from ProbeAPI/jest.config.json rename to Ingestor/jest.config.json diff --git a/ProbeAPI/nodemon.json b/Ingestor/nodemon.json similarity index 100% rename from ProbeAPI/nodemon.json rename to Ingestor/nodemon.json diff --git a/ProbeAPI/package-lock.json b/Ingestor/package-lock.json similarity index 100% rename from ProbeAPI/package-lock.json rename to Ingestor/package-lock.json diff --git a/ProbeAPI/package.json b/Ingestor/package.json similarity index 100% rename from ProbeAPI/package.json rename to Ingestor/package.json diff --git a/ProbeAPI/tsconfig.json b/Ingestor/tsconfig.json similarity index 100% rename from ProbeAPI/tsconfig.json rename to Ingestor/tsconfig.json diff --git a/Nginx/default.conf.template b/Nginx/default.conf.template index ebfab22db8..a66190235b 100644 --- a/Nginx/default.conf.template +++ b/Nginx/default.conf.template @@ -28,8 +28,8 @@ upstream api-reference { server ${SERVER_API_REFERENCE_HOSTNAME}:${API_REFERENCE_PORT} weight=10 max_fails=3 fail_timeout=30s; } -upstream probe-api { - server ${SERVER_PROBE_API_HOSTNAME}:${PROBE_API_PORT} weight=10 max_fails=3 fail_timeout=30s; +upstream ingestor { + server ${SERVER_INGESTOR_HOSTNAME}:${INGESTOR_PORT} weight=10 max_fails=3 fail_timeout=30s; } upstream dashboard { @@ -225,7 +225,7 @@ server { proxy_pass http://notification; } - location /probe-api { + location /ingestor { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; @@ -235,7 +235,7 @@ server { proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; - proxy_pass http://probe-api; + proxy_pass http://ingestor; client_max_body_size 50M; } @@ -347,7 +347,7 @@ server { proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; - proxy_pass http://probe-api/incoming-request; + proxy_pass http://ingestor/incoming-request; client_max_body_size 50M; } diff --git a/Probe/Config.ts b/Probe/Config.ts index f2768778d3..5166df1742 100644 --- a/Probe/Config.ts +++ b/Probe/Config.ts @@ -2,20 +2,20 @@ import URL from 'Common/Types/API/URL'; import logger from 'CommonServer/Utils/Logger'; import ObjectID from 'Common/Types/ObjectID'; -if (!process.env['PROBE_API_URL']) { - logger.error('PROBE_API_URL is not set'); +if (!process.env['INGESTOR_URL']) { + logger.error('INGESTOR_URL is not set'); process.exit(); } -export let PROBE_API_URL: URL = URL.fromString(process.env['PROBE_API_URL']); +export let INGESTOR_URL: URL = URL.fromString(process.env['INGESTOR_URL']); // If probe api does not have the path. Add it. if ( - !PROBE_API_URL.toString().endsWith('probe-api') && - !PROBE_API_URL.toString().endsWith('probe-api/') + !INGESTOR_URL.toString().endsWith('ingestor') && + !INGESTOR_URL.toString().endsWith('ingestor/') ) { - PROBE_API_URL = URL.fromString( - PROBE_API_URL.addRoute('/probe-api').toString() + INGESTOR_URL = URL.fromString( + INGESTOR_URL.addRoute('/ingestor').toString() ); } diff --git a/Probe/Jobs/Alive.ts b/Probe/Jobs/Alive.ts index 4d56166d3d..f01b58dd1e 100644 --- a/Probe/Jobs/Alive.ts +++ b/Probe/Jobs/Alive.ts @@ -1,11 +1,11 @@ import API from 'Common/Utils/API'; import RunCron from '../Utils/Cron'; import { EVERY_MINUTE } from 'Common/Utils/CronTime'; -import { PROBE_API_URL } from '../Config'; +import { INGESTOR_URL } from '../Config'; import LocalCache from 'CommonServer/Infrastructure/LocalCache'; import URL from 'Common/Types/API/URL'; import logger from 'CommonServer/Utils/Logger'; -import ProbeAPIRequest from '../Utils/ProbeAPIRequest'; +import IngestorRequest from '../Utils/IngestorRequest'; import Register from '../Services/Register'; RunCron( @@ -33,8 +33,8 @@ RunCron( } await API.post( - URL.fromString(PROBE_API_URL.toString()).addRoute('/alive'), - ProbeAPIRequest.getDefaultRequestBody() + URL.fromString(INGESTOR_URL.toString()).addRoute('/alive'), + IngestorRequest.getDefaultRequestBody() ); } ); diff --git a/Probe/Jobs/Monitor/FetchList.ts b/Probe/Jobs/Monitor/FetchList.ts index d6d5045568..64c5fead0a 100644 --- a/Probe/Jobs/Monitor/FetchList.ts +++ b/Probe/Jobs/Monitor/FetchList.ts @@ -1,11 +1,11 @@ import API from 'Common/Utils/API'; -import { PROBE_API_URL, PROBE_MONITOR_FETCH_LIMIT } from '../../Config'; +import { INGESTOR_URL, PROBE_MONITOR_FETCH_LIMIT } from '../../Config'; import URL from 'Common/Types/API/URL'; import HTTPResponse from 'Common/Types/API/HTTPResponse'; import HTTPErrorResponse from 'Common/Types/API/HTTPErrorResponse'; import Monitor from 'Model/Models/Monitor'; import HTTPMethod from 'Common/Types/API/HTTPMethod'; -import ProbeAPIRequest from '../../Utils/ProbeAPIRequest'; +import IngestorRequest from '../../Utils/IngestorRequest'; import MonitorUtil from '../../Utils/Monitors/Monitor'; import logger from 'CommonServer/Utils/Logger'; import JSONFunctions from 'Common/Types/JSONFunctions'; @@ -54,7 +54,7 @@ export default class FetchListAndProbe { logger.info('Fetching monitor list'); const monitorListUrl: URL = URL.fromString( - PROBE_API_URL.toString() + INGESTOR_URL.toString() ).addRoute('/monitor/list'); const result: HTTPResponse | HTTPErrorResponse = @@ -62,7 +62,7 @@ export default class FetchListAndProbe { HTTPMethod.POST, monitorListUrl, { - ...ProbeAPIRequest.getDefaultRequestBody(), + ...IngestorRequest.getDefaultRequestBody(), limit: PROBE_MONITOR_FETCH_LIMIT || 100, }, {}, diff --git a/Probe/Services/Register.ts b/Probe/Services/Register.ts index 29b7dfb2fe..237eb54cc1 100644 --- a/Probe/Services/Register.ts +++ b/Probe/Services/Register.ts @@ -1,6 +1,6 @@ import API from 'Common/Utils/API'; import { - PROBE_API_URL, + INGESTOR_URL, PROBE_DESCRIPTION, PROBE_ID, PROBE_KEY, @@ -44,7 +44,7 @@ export default class Register { private static async _registerProbe(): Promise { if (HasClusterKey) { const probeRegistrationUrl: URL = URL.fromString( - PROBE_API_URL.toString() + INGESTOR_URL.toString() ).addRoute('/register'); logger.info('Registering Probe...'); @@ -77,7 +77,7 @@ export default class Register { } await API.post( - URL.fromString(PROBE_API_URL.toString()).addRoute('/alive'), + URL.fromString(INGESTOR_URL.toString()).addRoute('/alive'), { probeKey: PROBE_KEY.toString(), probeId: PROBE_ID.toString(), diff --git a/Probe/Utils/Monitors/Monitor.ts b/Probe/Utils/Monitors/Monitor.ts index 9320e031bb..b020048b84 100644 --- a/Probe/Utils/Monitors/Monitor.ts +++ b/Probe/Utils/Monitors/Monitor.ts @@ -6,8 +6,8 @@ import PingMonitor, { PingResponse } from './MonitorTypes/PingMonitor'; import API from 'Common/Utils/API'; import HTTPMethod from 'Common/Types/API/HTTPMethod'; import URL from 'Common/Types/API/URL'; -import { PROBE_API_URL } from '../../Config'; -import ProbeAPIRequest from '../ProbeAPIRequest'; +import { INGESTOR_URL } from '../../Config'; +import IngestorRequest from '../IngestorRequest'; import { JSONObject } from 'Common/Types/JSON'; import WebsiteMonitor, { ProbeWebsiteResponse, @@ -47,11 +47,11 @@ export default class MonitorUtil { await API.fetch( HTTPMethod.POST, - URL.fromString(PROBE_API_URL.toString()).addRoute( + URL.fromString(INGESTOR_URL.toString()).addRoute( '/probe/response/ingest' ), { - ...ProbeAPIRequest.getDefaultRequestBody(), + ...IngestorRequest.getDefaultRequestBody(), probeMonitorResponse: result as any, }, {}, diff --git a/Probe/Utils/ProbeAPIRequest.ts b/Probe/Utils/ProbeAPIRequest.ts index 0b276f3839..564c239fd0 100644 --- a/Probe/Utils/ProbeAPIRequest.ts +++ b/Probe/Utils/ProbeAPIRequest.ts @@ -2,7 +2,7 @@ import { JSONObject } from 'Common/Types/JSON'; import ProbeUtil from './Probe'; import { PROBE_KEY } from '../Config'; -export default class ProbeAPIRequest { +export default class IngestorRequest { public static getDefaultRequestBody(): JSONObject { return { probeKey: PROBE_KEY, diff --git a/ProbeAPI/.gitignore copy b/ProbeAPI/.gitignore copy deleted file mode 100755 index 9ff7be318d..0000000000 --- a/ProbeAPI/.gitignore copy +++ /dev/null @@ -1,29 +0,0 @@ -# See https://help.github.com/ignore-files/ for more about ignoring files. - -# dependencies -#/backend/node_modules -/kubernetes -/node_modules -.idea - -# misc -.DS_Store - - -npm-debug.log* -yarn-debug.log* -yarn-error.log* -yarn.lock - -**/*/paymentService.test.js -apiTest.rest - -application_security_dir -container_security_dir - -# coverage -/coverage -/.nyc_output - -/greenlock.d/config.json -/greenlock.d/config.json.bak \ No newline at end of file diff --git a/config.example.env b/config.example.env index d6e24a5800..988477b36e 100644 --- a/config.example.env +++ b/config.example.env @@ -76,7 +76,7 @@ REDIS_TLS_CA= REDIS_TLS_SENTINEL_MODE=false # Hostnames. Usually does not need to change. -PROBE_API_HOSTNAME=probe-api:3400 +INGESTOR_HOSTNAME=ingestor:3400 SERVER_ACCOUNTS_HOSTNAME=accounts SERVER_REALTIME_HOSTNAME=realtime @@ -84,7 +84,7 @@ SERVER_DASHBOARD_API_HOSTNAME=dashboard-api SERVER_WORKFLOW_HOSTNAME=workflow SERVER_LINK_SHORTENER_HOSTNAME=link-shortener SERVER_ALERT_HOSTNAME=alert -SERVER_PROBE_API_HOSTNAME=probe-api +SERVER_INGESTOR_HOSTNAME=ingestor SERVER_TEST_SERVER_HOSTNAME=test-server SERVER_FILE_HOSTNAME=file SERVER_HOME_HOSTNAME=home @@ -98,13 +98,13 @@ SERVER_API_REFERENCE_HOSTNAME=api-reference OTEL_COLLECTOR_HOSTNAME=otel-collector #Ports. Usually they don't need to change. - + DASHBOARD_API_PORT=3002 API_REFERENCE_PORT=1445 WORKFLOW_PORT=3099 LINK_SHORTENER_PORT=3521 ALERT_PORT=3088 -PROBE_API_PORT=3400 +INGESTOR_PORT=3400 PROBE_PORT=3500 TEST_SERVER_PORT=3800 FILE_PORT=3125 diff --git a/docker-compose.base.yml b/docker-compose.base.yml index 16616fda1e..0ea55aac34 100644 --- a/docker-compose.base.yml +++ b/docker-compose.base.yml @@ -22,7 +22,7 @@ x-common-variables: &common-variables SERVER_WORKFLOW_HOSTNAME: workflow SERVER_LINK_SHORTENER_HOSTNAME: link-shortener SERVER_ALERT_HOSTNAME: alert - SERVER_PROBE_API_HOSTNAME: probe-api + SERVER_INGESTOR_HOSTNAME: ingestor SERVER_TEST_SERVER_HOSTNAME: test-server SERVER_FILE_HOSTNAME: file SERVER_HOME_HOSTNAME: home @@ -41,7 +41,7 @@ x-common-variables: &common-variables WORKFLOW_PORT: ${WORKFLOW_PORT} LINK_SHORTENER_PORT: ${LINK_SHORTENER_PORT} ALERT_PORT: ${ALERT_PORT} - PROBE_API_PORT: ${PROBE_API_PORT} + INGESTOR_PORT: ${INGESTOR_PORT} PROBE_PORT: ${PROBE_PORT} TEST_SERVER_PORT: ${TEST_SERVER_PORT} FILE_PORT: ${FILE_PORT} @@ -312,12 +312,12 @@ services: PROBE_DESCRIPTION: ${GLOBAL_PROBE_1_DESCRIPTION} PROBE_MONITORING_WORKERS: ${GLOBAL_PROBE_1_MONITORING_WORKERS} PROBE_KEY: ${GLOBAL_PROBE_1_KEY} - PROBE_API_URL: http://${PROBE_API_HOSTNAME} + INGESTOR_URL: http://${INGESTOR_HOSTNAME} PROBE_MONITOR_FETCH_LIMIT: ${GLOBAL_PROBE_1_MONITOR_FETCH_LIMIT} depends_on: - - probe-api + - ingestor links: - - probe-api + - ingestor probe-2: networks: @@ -330,12 +330,12 @@ services: PROBE_DESCRIPTION: ${GLOBAL_PROBE_2_DESCRIPTION} PROBE_MONITORING_WORKERS: ${GLOBAL_PROBE_2_MONITORING_WORKERS} PROBE_KEY: ${GLOBAL_PROBE_2_KEY} - PROBE_API_URL: http://${PROBE_API_HOSTNAME} + INGESTOR_URL: http://${INGESTOR_HOSTNAME} PROBE_MONITOR_FETCH_LIMIT: ${GLOBAL_PROBE_2_MONITOR_FETCH_LIMIT} depends_on: - - probe-api + - ingestor links: - - probe-api + - ingestor identity: @@ -356,13 +356,13 @@ services: - probe-api: + ingestor: networks: - oneuptime restart: always environment: <<: *common-server-variables - PORT: ${PROBE_API_PORT} + PORT: ${INGESTOR_PORT} depends_on: - redis - postgres diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index 152a8f5b2c..cce36d18ea 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -349,9 +349,9 @@ services: - probe-api: + ingestor: volumes: - - ./ProbeAPI:/usr/src/app + - ./Ingestor:/usr/src/app # Use node modules of the container and not host system. # https://stackoverflow.com/questions/29181032/add-a-volume-to-docker-but-exclude-a-sub-folder - /usr/src/app/node_modules/ @@ -367,11 +367,11 @@ services: - '9932:9229' # Debugging port. extends: file: ./docker-compose.base.yml - service: probe-api + service: ingestor build: network: host context: . - dockerfile: ./ProbeAPI/Dockerfile + dockerfile: ./Ingestor/Dockerfile file: diff --git a/docker-compose.yml b/docker-compose.yml index 1dea9fc957..2f84f60ee9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -115,11 +115,11 @@ services: - probe-api: - image: oneuptime/probe-api:${APP_TAG} + ingestor: + image: oneuptime/ingestor:${APP_TAG} extends: file: ./docker-compose.base.yml - service: probe-api + service: ingestor file: