mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-13 20:35:56 +08:00
ci(deployments): workflows for staging and testing deployments and related changes (#1933)
* chore(Makefile): ⚡️ remove no-cache from all docker build commands * chore(Makefile): 🔧 update target name * feat(docker-standalone): ✨ introduce tag environment variables for easy custom deployments * ci(deployments): 👷 workflows for staging and testing deployments * ci(deployments): 👷 pass DEV_BUILD env to remote host
This commit is contained in:
parent
57d28be9f5
commit
da1fd4b0cd
2
.github/workflows/remove-label.yaml
vendored
2
.github/workflows/remove-label.yaml
vendored
@ -11,6 +11,6 @@ jobs:
|
|||||||
- name: Remove label
|
- name: Remove label
|
||||||
uses: buildsville/add-remove-label@v1
|
uses: buildsville/add-remove-label@v1
|
||||||
with:
|
with:
|
||||||
label: ok-to-test
|
label: ok-to-test,testing-deploy
|
||||||
type: remove
|
type: remove
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
37
.github/workflows/staging-deployment.yaml
vendored
Normal file
37
.github/workflows/staging-deployment.yaml
vendored
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
name: staging-deployment
|
||||||
|
# Trigger deployment only on push to develop branch
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- develop
|
||||||
|
jobs:
|
||||||
|
deploy:
|
||||||
|
name: Deploy latest develop branch to staging
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
environment: staging
|
||||||
|
steps:
|
||||||
|
- name: Executing remote ssh commands using ssh key
|
||||||
|
uses: appleboy/ssh-action@v0.1.6
|
||||||
|
env:
|
||||||
|
DOCKER_TAG: develop
|
||||||
|
GITHUB_SHA: ${{ github.sha }}
|
||||||
|
with:
|
||||||
|
host: ${{ secrets.HOST_DNS }}
|
||||||
|
username: ${{ secrets.USERNAME }}
|
||||||
|
key: ${{ secrets.EC2_SSH_KEY }}
|
||||||
|
envs: DOCKER_TAG,GITHUB_SHA
|
||||||
|
command_timeout: 60m
|
||||||
|
script: |
|
||||||
|
echo "DOCKER_TAG: ${DOCKER_TAG}"
|
||||||
|
echo "GITHUB_SHA: ${GITHUB_SHA}"
|
||||||
|
docker system prune --force
|
||||||
|
cd ~/signoz
|
||||||
|
git status
|
||||||
|
git add .
|
||||||
|
git stash push -m "stashed on $(date --iso-8601=seconds)"
|
||||||
|
git fetch origin
|
||||||
|
git checkout develop
|
||||||
|
git pull
|
||||||
|
make build-ee-query-service-amd64
|
||||||
|
make build-frontend-amd64
|
||||||
|
make run-signoz
|
39
.github/workflows/testing-deployment.yaml
vendored
Normal file
39
.github/workflows/testing-deployment.yaml
vendored
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
name: testing-deployment
|
||||||
|
# Trigger deployment only on testing-deploy label on pull request
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
types: [labeled]
|
||||||
|
jobs:
|
||||||
|
deploy:
|
||||||
|
name: Deploy PR branch to testing
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
environment: testing
|
||||||
|
if: ${{ github.event.label.name == 'testing-deploy' }}
|
||||||
|
steps:
|
||||||
|
- name: Executing remote ssh commands using ssh key
|
||||||
|
uses: appleboy/ssh-action@v0.1.6
|
||||||
|
env:
|
||||||
|
GITHUB_BRANCH: ${{ github.head_ref || github.ref_name }}
|
||||||
|
GITHUB_SHA: ${{ github.sha }}
|
||||||
|
DEV_BUILD: "1"
|
||||||
|
with:
|
||||||
|
host: ${{ secrets.HOST_DNS }}
|
||||||
|
username: ${{ secrets.USERNAME }}
|
||||||
|
key: ${{ secrets.EC2_SSH_KEY }}
|
||||||
|
envs: GITHUB_BRANCH,GITHUB_SHA,DEV_BUILD
|
||||||
|
command_timeout: 60m
|
||||||
|
script: |
|
||||||
|
echo "GITHUB_BRANCH: ${GITHUB_BRANCH}"
|
||||||
|
echo "GITHUB_SHA: ${GITHUB_SHA}"
|
||||||
|
export DOCKER_TAG="${GITHUB_SHA:0:7}" # needed for child process to access it
|
||||||
|
docker system prune --force
|
||||||
|
cd ~/signoz
|
||||||
|
git status
|
||||||
|
git add .
|
||||||
|
git stash push -m "stashed on $(date --iso-8601=seconds)"
|
||||||
|
git fetch origin
|
||||||
|
git checkout ${GITHUB_BRANCH}
|
||||||
|
git pull
|
||||||
|
make build-ee-query-service-amd64
|
||||||
|
make build-frontend-amd64
|
||||||
|
make run-signoz
|
25
Makefile
25
Makefile
@ -45,7 +45,7 @@ build-frontend-amd64:
|
|||||||
@echo "--> Building frontend docker image for amd64"
|
@echo "--> Building frontend docker image for amd64"
|
||||||
@echo "------------------"
|
@echo "------------------"
|
||||||
@cd $(FRONTEND_DIRECTORY) && \
|
@cd $(FRONTEND_DIRECTORY) && \
|
||||||
docker build --file Dockerfile --no-cache -t $(REPONAME)/$(FRONTEND_DOCKER_IMAGE):$(DOCKER_TAG) \
|
docker build --file Dockerfile -t $(REPONAME)/$(FRONTEND_DOCKER_IMAGE):$(DOCKER_TAG) \
|
||||||
--build-arg TARGETPLATFORM="linux/amd64" .
|
--build-arg TARGETPLATFORM="linux/amd64" .
|
||||||
|
|
||||||
# Step to build and push docker image of frontend(used in push pipeline)
|
# Step to build and push docker image of frontend(used in push pipeline)
|
||||||
@ -54,7 +54,7 @@ build-push-frontend:
|
|||||||
@echo "--> Building and pushing frontend docker image"
|
@echo "--> Building and pushing frontend docker image"
|
||||||
@echo "------------------"
|
@echo "------------------"
|
||||||
@cd $(FRONTEND_DIRECTORY) && \
|
@cd $(FRONTEND_DIRECTORY) && \
|
||||||
docker buildx build --file Dockerfile --progress plane --no-cache --push --platform linux/amd64 \
|
docker buildx build --file Dockerfile --progress plane --push --platform linux/amd64 \
|
||||||
--tag $(REPONAME)/$(FRONTEND_DOCKER_IMAGE):$(DOCKER_TAG) .
|
--tag $(REPONAME)/$(FRONTEND_DOCKER_IMAGE):$(DOCKER_TAG) .
|
||||||
|
|
||||||
# Steps to build and push docker image of query service
|
# Steps to build and push docker image of query service
|
||||||
@ -65,7 +65,7 @@ build-query-service-amd64:
|
|||||||
@echo "--> Building query-service docker image for amd64"
|
@echo "--> Building query-service docker image for amd64"
|
||||||
@echo "------------------"
|
@echo "------------------"
|
||||||
@docker build --file $(QUERY_SERVICE_DIRECTORY)/Dockerfile \
|
@docker build --file $(QUERY_SERVICE_DIRECTORY)/Dockerfile \
|
||||||
--no-cache -t $(REPONAME)/$(QUERY_SERVICE_DOCKER_IMAGE):$(DOCKER_TAG) \
|
-t $(REPONAME)/$(QUERY_SERVICE_DOCKER_IMAGE):$(DOCKER_TAG) \
|
||||||
--build-arg TARGETPLATFORM="linux/amd64" --build-arg LD_FLAGS="$(LD_FLAGS)" .
|
--build-arg TARGETPLATFORM="linux/amd64" --build-arg LD_FLAGS="$(LD_FLAGS)" .
|
||||||
|
|
||||||
# Step to build and push docker image of query in amd64 and arm64 (used in push pipeline)
|
# Step to build and push docker image of query in amd64 and arm64 (used in push pipeline)
|
||||||
@ -73,7 +73,7 @@ build-push-query-service:
|
|||||||
@echo "------------------"
|
@echo "------------------"
|
||||||
@echo "--> Building and pushing query-service docker image"
|
@echo "--> Building and pushing query-service docker image"
|
||||||
@echo "------------------"
|
@echo "------------------"
|
||||||
@docker buildx build --file $(QUERY_SERVICE_DIRECTORY)/Dockerfile --progress plane --no-cache \
|
@docker buildx build --file $(QUERY_SERVICE_DIRECTORY)/Dockerfile --progress plane \
|
||||||
--push --platform linux/arm64,linux/amd64 --build-arg LD_FLAGS="$(LD_FLAGS)" \
|
--push --platform linux/arm64,linux/amd64 --build-arg LD_FLAGS="$(LD_FLAGS)" \
|
||||||
--tag $(REPONAME)/$(QUERY_SERVICE_DOCKER_IMAGE):$(DOCKER_TAG) .
|
--tag $(REPONAME)/$(QUERY_SERVICE_DOCKER_IMAGE):$(DOCKER_TAG) .
|
||||||
|
|
||||||
@ -84,11 +84,11 @@ build-ee-query-service-amd64:
|
|||||||
@echo "------------------"
|
@echo "------------------"
|
||||||
@if [ $(DEV_BUILD) != "" ]; then \
|
@if [ $(DEV_BUILD) != "" ]; then \
|
||||||
docker build --file $(EE_QUERY_SERVICE_DIRECTORY)/Dockerfile \
|
docker build --file $(EE_QUERY_SERVICE_DIRECTORY)/Dockerfile \
|
||||||
--no-cache -t $(REPONAME)/$(QUERY_SERVICE_DOCKER_IMAGE):$(DOCKER_TAG) \
|
-t $(REPONAME)/$(QUERY_SERVICE_DOCKER_IMAGE):$(DOCKER_TAG) \
|
||||||
--build-arg TARGETPLATFORM="linux/amd64" --build-arg LD_FLAGS="${LD_FLAGS} ${DEV_LD_FLAGS}" .; \
|
--build-arg TARGETPLATFORM="linux/amd64" --build-arg LD_FLAGS="${LD_FLAGS} ${DEV_LD_FLAGS}" .; \
|
||||||
else \
|
else \
|
||||||
docker build --file $(EE_QUERY_SERVICE_DIRECTORY)/Dockerfile \
|
docker build --file $(EE_QUERY_SERVICE_DIRECTORY)/Dockerfile \
|
||||||
--no-cache -t $(REPONAME)/$(QUERY_SERVICE_DOCKER_IMAGE):$(DOCKER_TAG) \
|
-t $(REPONAME)/$(QUERY_SERVICE_DOCKER_IMAGE):$(DOCKER_TAG) \
|
||||||
--build-arg TARGETPLATFORM="linux/amd64" --build-arg LD_FLAGS="$(LD_FLAGS)" .; \
|
--build-arg TARGETPLATFORM="linux/amd64" --build-arg LD_FLAGS="$(LD_FLAGS)" .; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -98,7 +98,7 @@ build-push-ee-query-service:
|
|||||||
@echo "--> Building and pushing query-service docker image"
|
@echo "--> Building and pushing query-service docker image"
|
||||||
@echo "------------------"
|
@echo "------------------"
|
||||||
@docker buildx build --file $(EE_QUERY_SERVICE_DIRECTORY)/Dockerfile \
|
@docker buildx build --file $(EE_QUERY_SERVICE_DIRECTORY)/Dockerfile \
|
||||||
--progress plane --no-cache --push --platform linux/arm64,linux/amd64 \
|
--progress plane --push --platform linux/arm64,linux/amd64 \
|
||||||
--build-arg LD_FLAGS="$(LD_FLAGS)" --tag $(REPONAME)/$(QUERY_SERVICE_DOCKER_IMAGE):$(DOCKER_TAG) .
|
--build-arg LD_FLAGS="$(LD_FLAGS)" --tag $(REPONAME)/$(QUERY_SERVICE_DOCKER_IMAGE):$(DOCKER_TAG) .
|
||||||
|
|
||||||
dev-setup:
|
dev-setup:
|
||||||
@ -119,16 +119,19 @@ down-local:
|
|||||||
$(STANDALONE_DIRECTORY)/docker-compose-core.yaml -f $(STANDALONE_DIRECTORY)/docker-compose-local.yaml \
|
$(STANDALONE_DIRECTORY)/docker-compose-core.yaml -f $(STANDALONE_DIRECTORY)/docker-compose-local.yaml \
|
||||||
down -v
|
down -v
|
||||||
|
|
||||||
run-x86:
|
pull-signoz:
|
||||||
|
@docker-compose -f $(STANDALONE_DIRECTORY)/docker-compose.yaml pull
|
||||||
|
|
||||||
|
run-signoz:
|
||||||
@docker-compose -f $(STANDALONE_DIRECTORY)/docker-compose.yaml up --build -d
|
@docker-compose -f $(STANDALONE_DIRECTORY)/docker-compose.yaml up --build -d
|
||||||
|
|
||||||
down-x86:
|
down-signoz:
|
||||||
@docker-compose -f $(STANDALONE_DIRECTORY)/docker-compose.yaml down -v
|
@docker-compose -f $(STANDALONE_DIRECTORY)/docker-compose.yaml down -v
|
||||||
|
|
||||||
clear-standalone-data:
|
clear-standalone-data:
|
||||||
@docker run --rm -v "$(PWD)/$(STANDALONE_DIRECTORY)/data:/pwd" busybox \
|
@docker run --rm -v "$(PWD)/$(STANDALONE_DIRECTORY)/data:/pwd" busybox \
|
||||||
sh -c "cd /pwd && rm -rf alertmanager/* clickhous*/* signoz/* zookeeper-*/*"
|
sh -c "cd /pwd && rm -rf alertmanager/* clickhouse*/* signoz/* zookeeper-*/*"
|
||||||
|
|
||||||
clear-swarm-data:
|
clear-swarm-data:
|
||||||
@docker run --rm -v "$(PWD)/$(SWARM_DIRECTORY)/data:/pwd" busybox \
|
@docker run --rm -v "$(PWD)/$(SWARM_DIRECTORY)/data:/pwd" busybox \
|
||||||
sh -c "cd /pwd && rm -rf alertmanager/* clickhous*/* signoz/* zookeeper-*/*"
|
sh -c "cd /pwd && rm -rf alertmanager/* clickhouse*/* signoz/* zookeeper-*/*"
|
||||||
|
@ -132,7 +132,7 @@ services:
|
|||||||
# - ./data/clickhouse-3/:/var/lib/clickhouse/
|
# - ./data/clickhouse-3/:/var/lib/clickhouse/
|
||||||
|
|
||||||
alertmanager:
|
alertmanager:
|
||||||
image: signoz/alertmanager:0.23.0-0.2
|
image: signoz/alertmanager:${ALERTMANAGER_TAG:-0.23.0-0.2}
|
||||||
volumes:
|
volumes:
|
||||||
- ./data/alertmanager:/data
|
- ./data/alertmanager:/data
|
||||||
depends_on:
|
depends_on:
|
||||||
@ -146,7 +146,7 @@ services:
|
|||||||
# Notes for Maintainers/Contributors who will change Line Numbers of Frontend & Query-Section. Please Update Line Numbers in `./scripts/commentLinesForSetup.sh` & `./CONTRIBUTING.md`
|
# Notes for Maintainers/Contributors who will change Line Numbers of Frontend & Query-Section. Please Update Line Numbers in `./scripts/commentLinesForSetup.sh` & `./CONTRIBUTING.md`
|
||||||
|
|
||||||
query-service:
|
query-service:
|
||||||
image: signoz/query-service:0.13.0
|
image: signoz/query-service:${DOCKER_TAG:-0.13.0}
|
||||||
container_name: query-service
|
container_name: query-service
|
||||||
command: ["-config=/root/config/prometheus.yml"]
|
command: ["-config=/root/config/prometheus.yml"]
|
||||||
# ports:
|
# ports:
|
||||||
@ -174,7 +174,7 @@ services:
|
|||||||
<<: *clickhouse-depend
|
<<: *clickhouse-depend
|
||||||
|
|
||||||
frontend:
|
frontend:
|
||||||
image: signoz/frontend:0.13.0
|
image: signoz/frontend:${DOCKER_TAG:-0.13.0}
|
||||||
container_name: frontend
|
container_name: frontend
|
||||||
restart: on-failure
|
restart: on-failure
|
||||||
depends_on:
|
depends_on:
|
||||||
@ -186,7 +186,7 @@ services:
|
|||||||
- ../common/nginx-config.conf:/etc/nginx/conf.d/default.conf
|
- ../common/nginx-config.conf:/etc/nginx/conf.d/default.conf
|
||||||
|
|
||||||
otel-collector:
|
otel-collector:
|
||||||
image: signoz/signoz-otel-collector:0.66.1
|
image: signoz/signoz-otel-collector:${OTELCOL_TAG:-0.66.1}
|
||||||
command: ["--config=/etc/otel-collector-config.yaml"]
|
command: ["--config=/etc/otel-collector-config.yaml"]
|
||||||
user: root # required for reading docker container logs
|
user: root # required for reading docker container logs
|
||||||
volumes:
|
volumes:
|
||||||
@ -211,7 +211,7 @@ services:
|
|||||||
<<: *clickhouse-depend
|
<<: *clickhouse-depend
|
||||||
|
|
||||||
otel-collector-metrics:
|
otel-collector-metrics:
|
||||||
image: signoz/signoz-otel-collector:0.66.1
|
image: signoz/signoz-otel-collector:${OTELCOL_TAG:-0.66.1}
|
||||||
command: ["--config=/etc/otel-collector-metrics-config.yaml"]
|
command: ["--config=/etc/otel-collector-metrics-config.yaml"]
|
||||||
volumes:
|
volumes:
|
||||||
- ./otel-collector-metrics-config.yaml:/etc/otel-collector-metrics-config.yaml
|
- ./otel-collector-metrics-config.yaml:/etc/otel-collector-metrics-config.yaml
|
||||||
|
Loading…
x
Reference in New Issue
Block a user