Skip to content

feat: add /healthz

feat: add /healthz #49

Workflow file for this run

name: Build and Test
on:
push:
branches:
- main
pull_request:
types:
- opened
- reopened
workflow_dispatch:
permissions:
contents: read
id-token: write
jobs:
build:
uses: ./.github/workflows/base.yml
with:
job-type: build
test:
uses: ./.github/workflows/base.yml
with:
job-type: test
build-docker:
runs-on: ubuntu-latest
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
permissions:
contents: read
packages: write
services:
clickhouse:
image: clickhouse/clickhouse-server:23.10
ports:
- 8123:8123
- 9000:9000
options: >-
--health-cmd "wget --no-verbose --tries=1 --spider http://localhost:8123/?query=SELECT%201 || exit 1"
--health-interval 30s
--health-timeout 10s
--health-retries 5
--health-start-period 30s
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver-opts: |
network=host
- name: Log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push
uses: docker/build-push-action@v5
with:
push: ${{ github.ref == 'refs/heads/main' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
allow: network.host,security.insecure
network: host
outputs:
tags: ${{ steps.meta.outputs.tags }}
test-docker:
runs-on: ubuntu-latest
needs: build-docker
if: ${{ github.ref == 'refs/heads/main' }}
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
permissions:
contents: read
packages: write
services:
clickhouse:
image: clickhouse/clickhouse-server:23.10
ports:
- 8123:8123
- 9000:9000
options: >-
--health-cmd "wget --no-verbose --tries=1 --spider http://localhost:8123/?query=SELECT%201 || exit 1"
--health-interval 30s
--health-timeout 10s
--health-retries 5
--health-start-period 30s
test-image:
image: ${{ needs.build-docker.outputs.tags }}
env:
CLICKHOUSE_HOST: http://clickhouse:8123
CLICKHOST_USER: default
CLICKHOST_PASS: ""
ports:
- 3000:3000
steps:
- name: Test image
run: |
curl -sSf http://localhost:3000/healthz || exit 1