Skip to content

SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.

Adding multi architecture (ARM64 and AMD64) support for signoz components (#201)

Raj Babu Dasb1169c73157c
diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
index 7298787d8a..c59502333d 100644
--- a/.github/workflows/build.yaml
+++ b/.github/workflows/build.yaml
@@ -40,8 +40,8 @@ jobs:
- name: Build frontend docker image
shell: bash
run: |
- cd frontend
- docker build . -f Dockerfile
+ make build-frontend-amd64
+
build-query-service:
runs-on: ubuntu-latest
needs:
@@ -53,8 +53,8 @@ jobs:
- name: Build query-service image
shell: bash
run: |
- cd pkg/query-service
- docker build . -f Dockerfile
+ make build-flattener-amd64
+
build-flattener:
runs-on: ubuntu-latest
needs:
@@ -66,5 +66,4 @@ jobs:
- name: Build flattener docker image
shell: bash
run: |
- cd pkg/processors/flattener
- docker build . -f Dockerfile
+ make build-query-service-amd64
diff --git a/.github/workflows/push.yaml b/.github/workflows/push.yaml
index 8b5cd4a78e..46ecaf2dd7 100644
--- a/.github/workflows/push.yaml
+++ b/.github/workflows/push.yaml
@@ -52,12 +52,11 @@ jobs:
with:
name: env_artifact
- - name: Build frontend docker image
- shell: bash
- run: |
- source env-vars
- cd frontend
- docker build . -f Dockerfile -t ${{ secrets.REPONAME }}/${FRONTEND_IMAGE}:${IMG_TAG}
+ - name: Set up Docker Buildx
+ id: buildx
+ uses: docker/setup-buildx-action@v1
+ with:
+ version: latest
- name: Login to DockerHub
uses: docker/login-action@v1
@@ -65,15 +64,20 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- - name: Push frontend docker image
+ - name: Build & Push Frontend Docker Image
shell: bash
+ env:
+ FRONTEND_DIRECTORY: "frontend"
+ REPONAME: ${{ secrets.REPONAME }}
+ FRONTEND_DOCKER_IMAGE: ${FRONTEND_IMAGE}
+ DOCKER_TAG: ${IMG_TAG}
run: |
branch=${GITHUB_REF#refs/*/}
array=(`echo ${GITHUB_REF} | sed 's/\//\n/g'`)
if [ $branch == "main" ] || [ ${array[1]} == "tags" ] || [[ $branch =~ ^v[0-9]*.[0-9]*.x$ ]]
then
source env-vars
- docker push ${{ secrets.REPONAME }}/${FRONTEND_IMAGE}:${IMG_TAG}
+ make build-push-frontend
fi
build-and-push-query-service:
@@ -89,12 +93,11 @@ jobs:
with:
name: env_artifact
- - name: Build query-service image
- shell: bash
- run: |
- source env-vars
- cd pkg/query-service
- docker build . -f Dockerfile -t ${{ secrets.REPONAME }}/${QUERY_SERVICE}:${IMG_TAG}
+ - name: Set up Docker Buildx
+ id: buildx
+ uses: docker/setup-buildx-action@v1
+ with:
+ version: latest
- name: Login to DockerHub
uses: docker/login-action@v1
@@ -102,15 +105,20 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- - name: Push query service docker image
+ - name: Build & Push Query Service Docker Image
shell: bash
+ env:
+ QUERY_SERVICE_DIRECTORY: "pkg/query-service"
+ REPONAME: ${{ secrets.REPONAME }}
+ QUERY_SERVICE_DOCKER_IMAGE: ${QUERY_SERVICE}
+ DOCKER_TAG: ${IMG_TAG}
run: |
branch=${GITHUB_REF#refs/*/}
array=(`echo ${GITHUB_REF} | sed 's/\//\n/g'`)
if [ $branch == "main" ] || [ ${array[1]} == "tags" ] || [[ $branch =~ ^v[0-9]*.[0-9]*.x$ ]]
then
source env-vars
- docker push ${{ secrets.REPONAME }}/${QUERY_SERVICE}:${IMG_TAG}
+ make build-push-query-service
fi
build-and-push-flattener:
@@ -126,12 +134,11 @@ jobs:
with:
name: env_artifact
- - name: Build flattener docker image
- shell: bash
- run: |
- source env-vars
- cd pkg/processors/flattener
- docker build . -f Dockerfile -t ${{ secrets.REPONAME }}/${FLATTENER_PROCESSOR}:${IMG_TAG}
+ - name: Set up Docker Buildx
+ id: buildx
+ uses: docker/setup-buildx-action@v1
+ with:
+ version: latest
- name: Login to DockerHub
uses: docker/login-action@v1
@@ -139,13 +146,18 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- - name: Push flattener processor docker image
+ - name: Build & Push Flattener Processor Docker Image
shell: bash
+ env:
+ FLATTENER_DIRECTORY: "pkg/processors/flattener"
+ REPONAME: ${{ secrets.REPONAME }}
+ FLATTERNER_DOCKER_IMAGE: ${FLATTENER_PROCESSOR}
+ DOCKER_TAG: ${IMG_TAG}
run: |
branch=${GITHUB_REF#refs/*/}
array=(`echo ${GITHUB_REF} | sed 's/\//\n/g'`)
if [ $branch == "main" ] || [ ${array[1]} == "tags" ] || [[ $branch =~ ^v[0-9]*.[0-9]*.x$ ]]
then
source env-vars
- docker push ${{ secrets.REPONAME }}/${FLATTENER_PROCESSOR}:${IMG_TAG}
- fi
\ No newline at end of file
+ make build-push-flattener
+ fi
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000000..1f2d65709a
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,69 @@
+# Reference Guide - https://www.gnu.org/software/make/manual/make.html
+#
+# Internal variables or constants.
+#
+FRONTEND_DIRECTORY ?= frontend
+FLATTENER_DIRECTORY ?= pkg/processors/flattener
+QUERY_SERVICE_DIRECTORY ?= pkg/query-service
+
+REPONAME ?= signoz
+DOCKER_TAG ?= latest
+
+FRONTEND_DOCKER_IMAGE ?= frontend
+FLATTERNER_DOCKER_IMAGE ?= query-service
+QUERY_SERVICE_DOCKER_IMAGE ?= flattener-processor
+
+all: build-push-frontend build-push-query-service build-push-flattener
+# Steps to build and push docker image of frontend
+.PHONY: build-frontend-amd64 build-push-frontend
+# Step to build docker image of frontend in amd64 (used in build pipeline)
+build-frontend-amd64:
+ @echo "------------------"
+ @echo "--> Building frontend docker image for amd64"
+ @echo "------------------"
+ @cd $(FRONTEND_DIRECTORY) && \
+ docker build -f Dockerfile --no-cache -t $(REPONAME)/$(FRONTEND_DOCKER_IMAGE):$(DOCKER_TAG) . --build-arg TARGETPLATFORM="linux/amd64"
+
+# Step to build and push docker image of frontend(used in push pipeline)
+build-push-frontend:
+ @echo "------------------"
+ @echo "--> Building and pushing frontend docker image"
+ @echo "------------------"
+ @cd $(FRONTEND_DIRECTORY) && \
+ docker buildx build --file Dockerfile --progress plane --no-cache --push --platform linux/amd64 --tag $(REPONAME)/$(FRONTEND_DOCKER_IMAGE):$(DOCKER_TAG) .
+
+# Steps to build and push docker image of query service
+.PHONY: build-query-service-amd64 build-push-query-service
+# Step to build docker image of query service in amd64 (used in build pipeline)
+build-query-service-amd64:
+ @echo "------------------"
+ @echo "--> Building query-service docker image for amd64"
+ @echo "------------------"
+ @cd $(QUERY_SERVICE_DIRECTORY) && \
+ docker build -f Dockerfile --no-cache -t $(REPONAME)/$(QUERY_SERVICE_DOCKER_IMAGE):$(DOCKER_TAG) . --build-arg TARGETPLATFORM="linux/amd64"
+
+# Step to build and push docker image of query in amd64 and arm64 (used in push pipeline)
+build-push-query-service:
+ @echo "------------------"
+ @echo "--> Building and pushing query-service docker image"
+ @echo "------------------"
+ @cd $(QUERY_SERVICE_DIRECTORY) && \
+ docker buildx build --file Dockerfile --progress plane --no-cache --push --platform linux/arm64,linux/amd64 --tag $(REPONAME)/$(QUERY_SERVICE_DOCKER_IMAGE):$(DOCKER_TAG) .
+
+# Steps to build and push docker image of flattener
+.PHONY: build-flattener-amd64 build-push-flattener
+# Step to build docker image of flattener in amd64 (used in build pipeline)
+build-flattener-amd64:
+ @echo "------------------"
+ @echo "--> Building flattener docker image for amd64"
+ @echo "------------------"
+ @cd $(FLATTENER_DIRECTORY) && \
+ docker build -f Dockerfile --no-cache -t $(REPONAME)/$(FLATTERNER_DOCKER_IMAGE):$(DOCKER_TAG) . --build-arg TARGETPLATFORM="linux/amd64"
+
+# Step to build and push docker image of flattener in amd64 (used in push pipeline)
+build-push-flattener:
+ @echo "------------------"
+ @echo "--> Building and pushing flattener docker image"
+ @echo "------------------"
+ @cd $(FLATTENER_DIRECTORY) && \
+ docker buildx build --file Dockerfile --progress plane --no-cache --push --platform linux/arm64,linux/amd64 --tag $(REPONAME)/$(FLATTERNER_DOCKER_IMAGE):$(DOCKER_TAG) .
diff --git a/frontend/Dockerfile b/frontend/Dockerfile
index 1deba0b08a..ce3d7022ef 100644
--- a/frontend/Dockerfile
+++ b/frontend/Dockerfile
@@ -1,5 +1,11 @@
# stage1 as builder
-FROM node:12-alpine as builder
+FROM node:12.18.0 as builder
+
+# Add Maintainer Info
+LABEL maintainer="signoz"
+
+ARG TARGETOS=linux
+ARG TARGETARCH
WORKDIR /frontend
@@ -14,7 +20,7 @@ COPY . .
# Build the project and copy the files
RUN yarn build
-FROM nginx:1.12-alpine
+FROM nginx:1.18-alpine
#!/bin/sh
diff --git a/frontend/package-lock.json b/frontend/package-lock.json
index 5e90b19456..12c184739b 100644
--- a/frontend/package-lock.json
+++ b/frontend/package-lock.json
@@ -21587,4 +21587,4 @@
"integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q=="
}
}
-}
+}
\ No newline at end of file
diff --git a/pkg/processors/flattener/Dockerfile b/pkg/processors/flattener/Dockerfile
index 28ceb2548c..e800dbc35d 100644
--- a/pkg/processors/flattener/Dockerfile
+++ b/pkg/processors/flattener/Dockerfile
@@ -1,9 +1,16 @@
FROM golang:1.14-buster AS builder
+
+# Add Maintainer Info
+LABEL maintainer="signoz"
+
+ARG TARGETPLATFORM
+
ENV CGO_ENABLED=0
-ENV GOOS=linux
-ENV GOARCH=amd64
ENV GOPATH=/go
+RUN export GOOS=$(echo ${TARGETPLATFORM} | cut -d / -f1) && \
+ export GOARCH=$(echo ${TARGETPLATFORM} | cut -d / -f2)
+
# Prepare and enter src directory
WORKDIR /go/src/github.com/signoz/signoz/pkg/processors/flattener
diff --git a/pkg/query-service/Dockerfile b/pkg/query-service/Dockerfile
index 9038f206de..75fcd1b1c2 100644
--- a/pkg/query-service/Dockerfile
+++ b/pkg/query-service/Dockerfile
@@ -1,9 +1,16 @@
FROM golang:1.14-buster AS builder
+
+# Add Maintainer Info
+LABEL maintainer="signoz"
+
+ARG TARGETPLATFORM
+
ENV CGO_ENABLED=0
-ENV GOOS=linux
-ENV GOARCH=amd64
ENV GOPATH=/go
+RUN export GOOS=$(echo ${TARGETPLATFORM} | cut -d / -f1) && \
+ export GOARCH=$(echo ${TARGETPLATFORM} | cut -d / -f2)
+
# Prepare and enter src directory
WORKDIR /go/src/github.com/signoz/signoz/pkg/query-service