Skip to content

Commit

Permalink
Add Fluent Ingest service with configuration, Docker support, and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
simlarsen committed Nov 21, 2024
1 parent 74e43f0 commit 9244e49
Show file tree
Hide file tree
Showing 35 changed files with 5,483 additions and 49 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,21 @@ jobs:
- name: build docker image
run: sudo docker build -f ./Ingestor/Dockerfile .

docker-build-fluent-ingest:
runs-on: ubuntu-latest
env:
CI_PIPELINE_ID: ${{github.run_number}}
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Preinstall
run: npm run prerun

# build image probe api
- name: build docker image
run: sudo docker build -f ./FluentIngest/Dockerfile .

docker-build-status-page:
runs-on: ubuntu-latest
env:
Expand Down
12 changes: 12 additions & 0 deletions .github/workflows/compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,18 @@ jobs:
node-version: 18.3.0
- run: cd Common && npm install
- run: cd Ingestor && npm install && npm run compile && npm run dep-check

compile-fluent-ingest:
runs-on: ubuntu-latest
env:
CI_PIPELINE_ID: ${{github.run_number}}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 18.3.0
- run: cd Common && npm install
- run: cd FluentIngest && npm install && npm run compile && npm run dep-check


compile-status-page:
Expand Down
64 changes: 62 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,66 @@ jobs:
GIT_SHA=${{ github.sha }}
APP_VERSION=7.0.${{needs.generate-build-number.outputs.build_number}}
fluent-ingest-docker-image-deploy:
needs: [generate-build-number]
runs-on: ubuntu-latest
steps:
- name: Docker Meta
id: meta
uses: docker/metadata-action@v4
with:
images: |
oneuptime/fluent-ingest
ghcr.io/oneuptime/fluent-ingest
tags: |
type=raw,value=release,enable=true
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}},pattern={{version}},enable=true
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}

- uses: actions/setup-node@v2
with:
node-version: 18.3.0

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Generate Dockerfile from Dockerfile.tpl
run: npm run prerun

# Build and deploy fluent-ingest.

- name: Login to Docker Hub
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Login to GitHub Container Registry
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v4
with:
file: ./FluentIngest/Dockerfile
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
GIT_SHA=${{ github.sha }}
APP_VERSION=7.0.${{needs.generate-build-number.outputs.build_number}}
probe-docker-image-deploy:
needs: [generate-build-number]
runs-on: ubuntu-latest
Expand Down Expand Up @@ -1409,7 +1469,7 @@ jobs:

test-e2e-release-saas:
runs-on: ubuntu-latest
needs: [copilot-docker-image-deploy, docs-docker-image-deploy, api-reference-docker-image-deploy, workflow-docker-image-deploy, llm-docker-image-deploy, accounts-docker-image-deploy, admin-dashboard-docker-image-deploy, app-docker-image-deploy, dashboard-docker-image-deploy, haraka-docker-image-deploy, ingestor-docker-image-deploy, isolated-vm-docker-image-deploy, home-docker-image-deploy, worker-docker-image-deploy, otel-collector-docker-image-deploy, probe-docker-image-deploy, status-page-docker-image-deploy, test-docker-image-deploy, test-server-docker-image-deploy, publish-npm-packages, e2e-docker-image-deploy, helm-chart-deploy, generate-build-number, nginx-docker-image-deploy]
needs: [copilot-docker-image-deploy, fluent-ingest-docker-image-deploy, docs-docker-image-deploy, api-reference-docker-image-deploy, workflow-docker-image-deploy, llm-docker-image-deploy, accounts-docker-image-deploy, admin-dashboard-docker-image-deploy, app-docker-image-deploy, dashboard-docker-image-deploy, haraka-docker-image-deploy, ingestor-docker-image-deploy, isolated-vm-docker-image-deploy, home-docker-image-deploy, worker-docker-image-deploy, otel-collector-docker-image-deploy, probe-docker-image-deploy, status-page-docker-image-deploy, test-docker-image-deploy, test-server-docker-image-deploy, publish-npm-packages, e2e-docker-image-deploy, helm-chart-deploy, generate-build-number, nginx-docker-image-deploy]
env:
CI_PIPELINE_ID: ${{github.run_number}}
steps:
Expand Down Expand Up @@ -1462,7 +1522,7 @@ jobs:
test-e2e-release-self-hosted:
runs-on: ubuntu-latest
# After all the jobs runs
needs: [copilot-docker-image-deploy, docs-docker-image-deploy, api-reference-docker-image-deploy, workflow-docker-image-deploy, llm-docker-image-deploy, accounts-docker-image-deploy, admin-dashboard-docker-image-deploy, app-docker-image-deploy, dashboard-docker-image-deploy, haraka-docker-image-deploy, ingestor-docker-image-deploy, isolated-vm-docker-image-deploy, home-docker-image-deploy, worker-docker-image-deploy, otel-collector-docker-image-deploy, probe-docker-image-deploy, status-page-docker-image-deploy, test-docker-image-deploy, test-server-docker-image-deploy, publish-npm-packages, e2e-docker-image-deploy, helm-chart-deploy, generate-build-number, nginx-docker-image-deploy]
needs: [copilot-docker-image-deploy, fluent-ingest-docker-image-deploy, docs-docker-image-deploy, api-reference-docker-image-deploy, workflow-docker-image-deploy, llm-docker-image-deploy, accounts-docker-image-deploy, admin-dashboard-docker-image-deploy, app-docker-image-deploy, dashboard-docker-image-deploy, haraka-docker-image-deploy, ingestor-docker-image-deploy, isolated-vm-docker-image-deploy, home-docker-image-deploy, worker-docker-image-deploy, otel-collector-docker-image-deploy, probe-docker-image-deploy, status-page-docker-image-deploy, test-docker-image-deploy, test-server-docker-image-deploy, publish-npm-packages, e2e-docker-image-deploy, helm-chart-deploy, generate-build-number, nginx-docker-image-deploy]
env:
CI_PIPELINE_ID: ${{github.run_number}}
steps:
Expand Down
63 changes: 62 additions & 1 deletion .github/workflows/test-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,67 @@ jobs:
GIT_SHA=${{ github.sha }}
APP_VERSION=7.0.${{needs.generate-build-number.outputs.build_number}}
fluent-ingest-docker-image-deploy:
needs: generate-build-number
runs-on: ubuntu-latest
steps:
- name: Docker Meta
id: meta
uses: docker/metadata-action@v4
with:
images: |
oneuptime/fluent-ingest
ghcr.io/oneuptime/fluent-ingest
tags: |
type=raw,value=test,enable=true
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}}-test,pattern={{version}},enable=true
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}

- uses: actions/setup-node@v2
with:
node-version: 18.3.0

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Generate Dockerfile from Dockerfile.tpl
run: npm run prerun

# Build and deploy ingestor.

- name: Login to Docker Hub
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Login to GitHub Container Registry
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v4
with:
file: ./FluentIngest/Dockerfile
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
GIT_SHA=${{ github.sha }}
APP_VERSION=7.0.${{needs.generate-build-number.outputs.build_number}}
probe-docker-image-deploy:
needs: generate-build-number
runs-on: ubuntu-latest
Expand Down Expand Up @@ -1343,7 +1404,7 @@ jobs:
test-helm-chart:
runs-on: ubuntu-latest
needs: [llm-docker-image-deploy, copilot-docker-image-deploy, docs-docker-image-deploy, worker-docker-image-deploy, workflow-docker-image-deploy, isolated-vm-docker-image-deploy, home-docker-image-deploy, api-reference-docker-image-deploy, test-server-docker-image-deploy, test-docker-image-deploy, ingestor-docker-image-deploy, probe-docker-image-deploy, haraka-docker-image-deploy, dashboard-docker-image-deploy, admin-dashboard-docker-image-deploy, app-docker-image-deploy, accounts-docker-image-deploy, otel-collector-docker-image-deploy, status-page-docker-image-deploy, nginx-docker-image-deploy, e2e-docker-image-deploy]
needs: [llm-docker-image-deploy, copilot-docker-image-deploy, docs-docker-image-deploy, worker-docker-image-deploy, workflow-docker-image-deploy, isolated-vm-docker-image-deploy, home-docker-image-deploy, api-reference-docker-image-deploy, test-server-docker-image-deploy, test-docker-image-deploy, ingestor-docker-image-deploy, probe-docker-image-deploy, haraka-docker-image-deploy, dashboard-docker-image-deploy, admin-dashboard-docker-image-deploy, app-docker-image-deploy, accounts-docker-image-deploy, otel-collector-docker-image-deploy, status-page-docker-image-deploy, nginx-docker-image-deploy, e2e-docker-image-deploy, fluent-ingest-docker-image-deploy]
env:
CI_PIPELINE_ID: ${{github.run_number}}
steps:
Expand Down
20 changes: 20 additions & 0 deletions .github/workflows/test.fluent-ingest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Fluent Ingest Test

on:
pull_request:
push:
branches-ignore:
- 'hotfix-*' # excludes hotfix branches
- 'release'

jobs:
test:
runs-on: ubuntu-latest
env:
CI_PIPELINE_ID: ${{github.run_number}}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 18.3.0
- run: cd FluentIngest && npm install && npm run test
14 changes: 14 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,20 @@
"restart": true,
"autoAttachChildProcesses": true
},
{
"address": "127.0.0.1",
"localRoot": "${workspaceFolder}/FluentIngest",
"name": "Fluent Ingest: Debug with Docker",
"port": 9937,
"remoteRoot": "/usr/src/app",
"request": "attach",
"skipFiles": [
"<node_internals>/**"
],
"type": "node",
"restart": true,
"autoAttachChildProcesses": true
},
{
"address": "127.0.0.1",
"localRoot": "${workspaceFolder}/IsolatedVM",
Expand Down
4 changes: 2 additions & 2 deletions App/FeatureSet/BaseAPI/Index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import GlobalConfigAPI from "Common/Server/API/GlobalConfigAPI";
import MonitorGroupAPI from "Common/Server/API/MonitorGroupAPI";
import NotificationAPI from "Common/Server/API/NotificationAPI";
import TelemetryAPI from "Common/Server/API/TelemetryAPI";
import Ingestor from "Common/Server/API/ProbeAPI";
import ProbeAPI from "Common/Server/API/ProbeAPI";
import ProjectAPI from "Common/Server/API/ProjectAPI";
import ProjectSsoAPI from "Common/Server/API/ProjectSSO";

Expand Down Expand Up @@ -1359,7 +1359,7 @@ const BaseAPIFeatureSet: FeatureSet = {
);
app.use(`/${APP_NAME.toLocaleLowerCase()}`, new UserEmailAPI().getRouter());
app.use(`/${APP_NAME.toLocaleLowerCase()}`, new UserSMSAPI().getRouter());
app.use(`/${APP_NAME.toLocaleLowerCase()}`, new Ingestor().getRouter());
app.use(`/${APP_NAME.toLocaleLowerCase()}`, new ProbeAPI().getRouter());

app.use(
`/${APP_NAME.toLocaleLowerCase()}`,
Expand Down
2 changes: 1 addition & 1 deletion Common/Server/API/ProbeAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import LIMIT_MAX from "Common/Types/Database/LimitMax";
import PositiveNumber from "Common/Types/PositiveNumber";
import Probe from "Common/Models/DatabaseModels/Probe";

export default class Ingestor extends BaseAPI<Probe, ProbeServiceType> {
export default class ProbeAPI extends BaseAPI<Probe, ProbeServiceType> {
public constructor() {
super(Probe, ProbeService);

Expand Down
7 changes: 7 additions & 0 deletions Common/Server/EnvironmentConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,13 @@ export const IngestorHostname: Hostname = Hostname.fromString(
}`,
);


export const FluentIngestHostname: Hostname = Hostname.fromString(
`${process.env["SERVER_FLUENT_INGEST_HOSTNAME"] || "localhost"}:${
process.env["FLUENT_INGEST_PORT"] || 80
}`,
);

export const IsolatedVMHostname: Hostname = Hostname.fromString(
`${process.env["SERVER_ISOLATED_VM_HOSTNAME"] || "localhost"}:${
process.env["ISOLATED_VM_PORT"] || 80
Expand Down
2 changes: 2 additions & 0 deletions Common/ServiceRoute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ export const AdminDashboardRoute: Route = new Route("/admin");

export const IngestorRoute: Route = new Route("/ingestor");

export const FluentIngestRoute: Route = new Route("/fluent-ingest");

export const RealtimeRoute: Route = new Route("/realtime/socket");

export const DocsRoute: Route = new Route("/docs");
Expand Down
6 changes: 3 additions & 3 deletions Common/Tests/Server/API/ProbeAPI.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Ingestor from "../../../Server/API/ProbeAPI";
import ProbeAPI from "../../../Server/API/ProbeAPI";
import ProbeService from "../../../Server/Services/ProbeService";
import {
ExpressRequest,
Expand Down Expand Up @@ -37,13 +37,13 @@ jest.mock("../../../Server/Utils/Response", () => {

jest.mock("../../../Server/Services/ProbeService");

describe("Ingestor", () => {
describe("ProbeAPI", () => {
let mockRequest: ExpressRequest;
let mockResponse: ExpressResponse;
let nextFunction: NextFunction;

beforeEach(() => {
new Ingestor();
new ProbeAPI();
mockRequest = {} as ExpressRequest;
mockResponse = {
send: jest.fn(),
Expand Down
9 changes: 9 additions & 0 deletions Common/UI/Config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
StatusPageApiRoute,
StatusPageRoute,
WorkflowRoute,
FluentIngestRoute
} from "Common/ServiceRoute";
import Hostname from "Common/Types/API/Hostname";
import Protocol from "Common/Types/API/Protocol";
Expand Down Expand Up @@ -67,6 +68,8 @@ export const WORKFLOW_HOSTNAME: Hostname = Hostname.fromString(HOST);

export const INGESTOR_HOSTNAME: Hostname = Hostname.fromString(HOST);

export const FLUENT_INGEST_HOSTNAME: Hostname = Hostname.fromString(HOST);

export const HELM_HOSTNAME: Hostname = Hostname.fromString(HOST);

export const API_DOCS_HOSTNAME: Hostname = Hostname.fromString(HOST);
Expand Down Expand Up @@ -101,6 +104,12 @@ export const STATUS_PAGE_API_URL: URL = new URL(
StatusPageApiRoute,
);

export const FLUENT_INGEST_URL: URL = new URL(
HTTP_PROTOCOL,
FLUENT_INGEST_HOSTNAME,
FluentIngestRoute,
);

export const IDENTITY_URL: URL = new URL(
HTTP_PROTOCOL,
IDENTITY_HOSTNAME,
Expand Down
2 changes: 1 addition & 1 deletion Docs/Content/installation/docker-compose.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,4 @@ npm run update

### Things to consider

- In our Docker setup, we employ a local logging driver. OneUptime, particularly within the probe and ingestor containers, generates a substantial amount of logs. To prevent your storage from becoming full, it's crucial to limit the logging storage in Docker. For detailed instructions on how to do this, please refer to the official Docker documentation [here](https://docs.docker.com/config/containers/logging/local/).
- In our Docker setup, we employ a local logging driver. OneUptime, particularly within the probe and ingest containers, generates a substantial amount of logs. To prevent your storage from becoming full, it's crucial to limit the logging storage in Docker. For detailed instructions on how to do this, please refer to the official Docker documentation [here](https://docs.docker.com/config/containers/logging/local/).
Loading

0 comments on commit 9244e49

Please sign in to comment.