diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml index 139f0264..566aa168 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter.yml @@ -1,38 +1,48 @@ name-template: 'v$NEXT_MINOR_VERSION' tag-template: 'v$NEXT_MINOR_VERSION' +version-template: '$COMPLETE' +prerelease-identifier: rc categories: - title: 'πŸ’₯ Breaking Changes' + collapse-after: 15 label: 'kind/breaking' - title: 'πŸš€ Features' + collapse-after: 15 labels: - 'kind/feature' - title: '🎯 Improvements' + collapse-after: 15 labels: - 'kind/improvement' - title: 'πŸ› Bug Fixes' + collapse-after: 15 labels: - 'kind/bug' - title: '🧰 Maintenance' + collapse-after: 15 labels: - 'area/tech-debt' - 'area/ci' - 'kind/maintenance' - title: 'πŸ“ Documentation' + collapse-after: 10 labels: - 'area/docs' - 'kind/docs' - title: '⬆️ Dependencies' + collapse-after: 10 labels: - 'dependencies' - collapse-after: 5 change-template: '- $TITLE (#$NUMBER)' change-title-escapes: '\<*_&#@`' # You can add # and @ to disable mentions, and add ` to disable code blocks. -version-template: '$COMPLETE' no-changes-template: 'This release contains minor changes and bugfixes.' template: | + # Release v$NEXT_MINOR_VERSION + A simple command to run Grafana LGTMP Stack in Docker or Kubernetes. + ## What's Changed $CHANGES @@ -58,21 +68,21 @@ footer: | | Port-mapping | Component | Description | | --- | --- | --- | - | `12345:12345` | [Grafana Agent][7] | Eexpose `12345` port so we can directly access `grafana-agent` inside container | - | `33100:3100` | [Loki][1] | Expose `33100` port so we can directly access `loki` inside container | - | `3000:3000` | [Grafana][2] | Expose `3000` port so we can directly access `grafana` inside container | - | `33200:3200` | [Tempo][3] | Expose `33200` port so we can directly access `tempo` inside container | - | `38080:8080` | [Mimir][4] | Expose `38080` port so we can directly access `mimir` inside container | - | `34040:4040` | [Pyroscope][5] | Expose `34040` port so we can directly access `pyroscope` inside container | - | `9001:9001` | [Minio][6] | Expose `9001` port so we can access `minio` console with `MINIO_ROOT_USER=lgtmp`, `MINIO_ROOT_PASSWORD=supersecret` | + | `12345:12345`, `4317`, `4318`, `6831` | [Grafana Agent][1] | Eexpose `12345` port so we can directly access `grafana-agent` inside container | + | `33100:3100` | [Loki][2] | Expose `33100` port so we can directly access `loki` inside container | + | `3000:3000`, `6060` | [Grafana][3] | Expose `3000` port so we can directly access `grafana` inside container | + | `33200:3200`, `4317`, `4318` | [Tempo][4] | Expose `33200` port so we can directly access `tempo` inside container | + | `38080:8080` | [Mimir][5] | Expose `38080` port so we can directly access `mimir` inside container | + | `34040:4040` | [Pyroscope][6] | Expose `34040` port so we can directly access `pyroscope` inside container | + | `9001:9001`, `9000` | [Minio][7] | Expose `9001` port so we can access `minio` console with `MINIO_ROOT_USER=lgtmp`, `MINIO_ROOT_PASSWORD=supersecret` | - [7]: https://github.com/grafana/agent - [1]: https://github.com/grafana/loki - [2]: https://github.com/grafana/grafana - [3]: https://github.com/grafana/tempo - [4]: https://github.com/grafana/mimir - [5]: https://github.com/grafana/pyroscope - [6]: https://github.com/minio/minio + [1]: https://github.com/grafana/agent + [2]: https://github.com/grafana/loki + [3]: https://github.com/grafana/grafana + [4]: https://github.com/grafana/tempo + [5]: https://github.com/grafana/mimir + [6]: https://github.com/grafana/pyroscope + [7]: https://github.com/minio/minio ## Helpful Links @@ -83,3 +93,4 @@ footer: | - - - + - [Grafana Agent Configuration Generator](https://github.com/grafana/agent-configurator) a tool allows for easy configuration of Grafana Agents Flow system diff --git a/.github/workflows/pr-labels.yml b/.github/workflows/pr-labels.yml new file mode 100644 index 00000000..d693fcbd --- /dev/null +++ b/.github/workflows/pr-labels.yml @@ -0,0 +1,19 @@ +name: Check PR labels + +on: + pull_request: + types: [labeled, unlabeled, opened, edited, synchronize] + +jobs: + enforce-kind: + name: Enforce a valid PR category + runs-on: ubuntu-latest + steps: + - name: Check if a valid PR category is present + env: + LABELS: ${{ toJson(github.event.pull_request.labels.*.name) }} + run: | + if ! jq --exit-status 'any(test("kind/feature") or test("kind/docs") or test("kind/improvement") or test("kind/bug") or test("kind/maintenance") or test("dependencies") or test("skip-release-notes") or test("area/tech-debt"))' >/dev/null <<< $LABELS; then + echo "::error ::Please set either kind/feature, kind/docs, kind/improvement, kind/bug, kind/maintenance, dependencies, skip-release-notes or area/tech-debt as label" + exit 1 + fi \ No newline at end of file diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index a289e5c7..279236c1 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -1,9 +1,9 @@ -name: GoReleaser Release +name: GoReleaser Publish Release on: workflow_call: inputs: - isReleaseCandidate: + isPreRelease: required: true type: boolean secrets: @@ -14,38 +14,26 @@ env: GORELEASER_VERSION: '1.24.0' jobs: - - publish-release: - name: ${{ inputs.isReleaseCandidate && 'prerelease' || 'release' }} + publish_release: + name: ${{ inputs.isPreRelease && 'prerelease' || 'release' }} publishing runs-on: ubuntu-latest steps: - - name: Free up disk space - run: | - echo "Available storage:" - df -h && echo - sudo docker image prune --all --force - sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL - echo "Available storage:" - df -h - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1 - uses: actions/setup-go@v5 with: go-version: '1.22' - - name: Install GoReleaser run: | wget -q https://github.com/goreleaser/goreleaser/releases/download/v${GORELEASER_VERSION}/goreleaser_Linux_x86_64.tar.gz tar -xzf goreleaser_Linux_x86_64.tar.gz mv goreleaser /home/runner/go/bin/goreleaser-v${GORELEASER_VERSION} - - name: GoReleaser Release - if: ${{ !inputs.isReleaseCandidate }} + - if: ${{ !inputs.isPreRelease }} + run: ./tools/scripts/do-release.sh env: GITHUB_TOKEN: ${{ secrets.ghPAT }} - run: ./tools/scripts/do-release.sh - - name: GoReleaser Release Candidate - if: ${{ inputs.isReleaseCandidate }} + - if: ${{ inputs.isPreRelease }} + run: ./tools/scripts/do-release-candidate.sh env: GITHUB_TOKEN: ${{ secrets.ghPAT }} - run: ./tools/scripts/do-release-candidate.sh \ No newline at end of file diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml index 4e106f4c..ec5baaf7 100644 --- a/.github/workflows/release-drafter.yml +++ b/.github/workflows/release-drafter.yml @@ -1,20 +1,16 @@ name: Release Drafter -# this workflow will run when someone labeled a pull request that targets branch is main on: push: # branches to consider in the event; optional, defaults to all branches: - main - -permissions: - contents: read + workflow_dispatch: {} jobs: update_release_draft: name: Trigger a draft release update permissions: - # write permission is required to create a github release contents: write pull-requests: write runs-on: ubuntu-latest @@ -22,27 +18,28 @@ jobs: # Drafts your next Release notes as Pull Requests are merged into "main" - uses: release-drafter/release-drafter@v6 id: draft - # (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml - # with: - # config-name: my-config.yml - # disable-autolabeler: true env: GITHUB_TOKEN: ${{ secrets.QCBOT_TOKEN }} with: commitish: main - - name: Checkout - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1 + + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1 - name: Copy release notes from Draft run: | tag_name=${{ steps.draft.outputs.tag_name }} echo "${{ steps.draft.outputs.body }}" > docs/release_notes/${tag_name:1}.md - - name: Upsert pull request + - name: Upsert Pull Request uses: peter-evans/create-pull-request@70a41aba780001da0a30141984ae2a0c95d8704e #v6.0.2 with: token: ${{ secrets.QCBOT_TOKEN }} title: Add release notes for ${{ steps.draft.outputs.tag_name }} commit-message: Add release notes for ${{ steps.draft.outputs.tag_name }} - committer: πŸ€–GitHub Actions[Bot] <41898282+github-actions[bot]@users.noreply.github.com> + committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> + signoff: true + # author: ${{ github.actor }} <${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com> + author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> + assignees: qclaogui + # reviewers: qclaogui body: | πŸ€– Copy release notes from Draft @@ -56,8 +53,9 @@ jobs:
- > Auto-generated by [Release Drafter GitHub Action][1] + > Auto-generated by [Release Drafter GitHub Action][0] - [1]: https://github.com/qclaogui/codelab-monitoring/blob/main/.github/workflows/release-drafter.yml - labels: kind/improvement, skip-release-notes + [0]: https://github.com/qclaogui/codelab-monitoring/blob/main/.github/workflows/release-drafter.yml + labels: kind/docs, skip-release-notes branch: update-release-notes + draft: true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3e6c0bc5..5548354e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,4 @@ -name: Release start publishing +name: Release on: push: @@ -6,7 +6,8 @@ on: - '[0-9]+.[0-9]+.[0-9]+*' jobs: - check-release-tag: + check_tag: + name: Parse the pushed tag version runs-on: ubuntu-latest steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1 @@ -22,12 +23,13 @@ jobs: ;; esac outputs: - isRc: ${{ steps.vars.outputs.isRc }} - publish: - name: start publishing + isPreRelease: ${{ steps.vars.outputs.isRc }} + + update_release: + name: Trigger a release update uses: ./.github/workflows/publish-release.yml - needs: [check-release-tag] + needs: [check_tag] with: - isReleaseCandidate: ${{ needs.check-release-tag.outputs.isRc == 'true' }} + isPreRelease: ${{ needs.check_tag.outputs.isPreRelease == 'true' }} secrets: ghPAT: ${{ secrets.QCBOT_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/trigger-release-candidate.yml b/.github/workflows/trigger-release-candidate.yml deleted file mode 100644 index 2e5296b1..00000000 --- a/.github/workflows/trigger-release-candidate.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: Trigger Release Candidate - -on: - workflow_dispatch: {} - -jobs: - rc: - name: Push release candidate tag - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1 - with: - token: ${{ secrets.QCBOT_TOKEN }} - # Set fetch-depth: 0 to fetch all history for all branches and tags. - fetch-depth: 0 - - uses: actions/setup-go@v5 - with: - go-version: '1.22' - - - name: Setup identity - uses: ./.github/actions/setup-identity - with: - token: ${{ secrets.QCBOT_TOKEN }} - - name: Push tag and open PR to default branch - run: make prepare-release-candidate \ No newline at end of file diff --git a/.github/workflows/trigger-release.yml b/.github/workflows/trigger-release.yml index 89607a56..e189dece 100644 --- a/.github/workflows/trigger-release.yml +++ b/.github/workflows/trigger-release.yml @@ -1,11 +1,21 @@ -name: Trigger Release +name: Trigger Release (Manually) +# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#onworkflow_dispatchinputs on: - workflow_dispatch: {} + workflow_dispatch: + inputs: + release: + description: 'Push tag and open PR to default branch' + required: true + default: 'prepare-release-candidate' + type: choice + options: + - prepare-release + - prepare-release-candidate jobs: - rc: - name: Push release tag + prepare_release: + name: Trigger a ${{ inputs.release }} job runs-on: ubuntu-latest steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1 @@ -16,10 +26,9 @@ jobs: - uses: actions/setup-go@v5 with: go-version: '1.22' - - name: Setup identity uses: ./.github/actions/setup-identity with: token: ${{ secrets.QCBOT_TOKEN }} - - name: Push tag and open PR to default branch - run: make prepare-release \ No newline at end of file + + - run: make ${{ inputs.release }} diff --git a/Makefile b/Makefile index d8744319..339ec267 100644 --- a/Makefile +++ b/Makefile @@ -402,8 +402,7 @@ delete-microservices-mode-traces: delete-memcached ##@ Grafana Agent Integrations -.PHONY: deploy-memcached -deploy-memcached: deploy-grafana ## Deploy integration memcached manifests +deploy-memcached: deploy-grafana $(info ******************** deploy integration memcached manifests ********************) @$(KUSTOMIZE) build --enable-helm kubernetes/common/memcached | kubectl apply -f - delete-memcached: delete-minio diff --git a/README.md b/README.md index 550b32a9..decf927b 100644 --- a/README.md +++ b/README.md @@ -1,32 +1,24 @@ # Provisioning Scalable Observability Workspace -

- - - - - License - - - GitHub Last Commit - -

- -## Quick Start - -Open a new terminal window to create `compose.yaml`, an simple use case `compose.yaml` like so: +![CI](https://github.com/qclaogui/codelab-monitoring/actions/workflows/ci.yml/badge.svg) +![Go version](https://img.shields.io/github/go-mod/go-version/qclaogui/codelab-monitoring) +![License](https://img.shields.io/github/license/qclaogui/codelab-monitoring.svg) +![GitHub Last Commit](https://img.shields.io/github/last-commit/qclaogui/codelab-monitoring) + +A simple command to run Grafana LGTMP Stack in Docker or Kubernetes. + +## Usage + +An simple use case `compose.yaml` like so: ```yaml -# include is available in Docker Compose version 2.20 and later, and Docker Desktop version 4.22 and later. -include: -- path: https://github.com/qclaogui/codelab-monitoring.git#main:docker-compose/monolithic-mode/logs/compose.yaml # Just Metrics and Logs +include: # include is available in Docker Compose version 2.20 and later, and Docker Desktop version 4.22 and later. +- path: https://github.com/qclaogui/codelab-monitoring.git#main:docker-compose/monolithic-mode/logs/compose.yaml services: github-exporter: - # https://github.com/qclaogui/codelab-monitoring/blob/main/docker-compose/common/config/agent-flow/modules/docker/README.md - labels: - # want metrics just set false to true - metrics.agent.grafana.com/scrape: false + labels: # https://github.com/qclaogui/codelab-monitoring/blob/main/docker-compose/common/config/agent-flow/modules/docker/README.md + metrics.agent.grafana.com/scrape: false # want metrics just set false to true image: githubexporter/github-exporter:1.1.0 environment: - REPOS=qclaogui/codelab-monitoring @@ -50,7 +42,6 @@ For more examples, See: [examples/](./examples/) ```shell ❯ make help - Usage: make @@ -93,7 +84,6 @@ Kubernetes deploy-microservices-mode-traces Deploy microservices-mode Tempo for traces Grafana Agent Integrations - deploy-memcached Deploy integration memcached manifests deploy-mysql Deploy integration mysql manifests deploy-redis Deploy integration redis manifests @@ -116,11 +106,11 @@ General ## Docker Compose -These instructions will get you through the deploying samples with Docker Compose. +The easiest way to run project locally is to use docker compose, these instructions will get you through the deploying samples with Docker Compose. ***Prerequisites:*** Make sure that you have Docker and Docker Compose installed -> NOTE: +> Note: > `include` is available in Docker Compose version 2.20 and later, and Docker Desktop version 4.22 and later. ### [Monolithic mode (单体樑式)](./docker-compose/monolithic-mode) @@ -153,8 +143,6 @@ git clone https://github.com/qclaogui/codelab-monitoring.git && cd "$(basename " make up-monolithic-mode-all-in-one ``` -That's it. - Once all containers are up and running you can search for metrics in Grafana. Navigate to [http://localhost:3000/explore](http://localhost:3000/explore) and select the search tab. @@ -251,3 +239,34 @@ Flags: Use "lgtmp [command] --help" for more information about a command. ``` + +## Grafana LGTMP Stack default port-mapping + +| Port-mapping | Component | Description | +| --- | --- | --- | +| `12345:12345`, `4317`, `4318`, `6831` | [Grafana Agent][1] | Eexpose `12345` port so we can directly access `grafana-agent` inside container | +| `33100:3100` | [Loki][2] | Expose `33100` port so we can directly access `loki` inside container | +| `3000:3000`, `6060` | [Grafana][3] | Expose `3000` port so we can directly access `grafana` inside container | +| `33200:3200`, `4317`, `4318` | [Tempo][4] | Expose `33200` port so we can directly access `tempo` inside container | +| `38080:8080` | [Mimir][5] | Expose `38080` port so we can directly access `mimir` inside container | +| `34040:4040` | [Pyroscope][6] | Expose `34040` port so we can directly access `pyroscope` inside container | +| `9001:9001`, `9000` | [Minio][7] | Expose `9001` port so we can access `minio` console with `MINIO_ROOT_USER=lgtmp`, `MINIO_ROOT_PASSWORD=supersecret` | + +[1]: https://github.com/grafana/agent +[2]: https://github.com/grafana/loki +[3]: https://github.com/grafana/grafana +[4]: https://github.com/grafana/tempo +[5]: https://github.com/grafana/mimir +[6]: https://github.com/grafana/pyroscope +[7]: https://github.com/minio/minio + +## Helpful Links + +- +- +- +- +- +- +- +- [Grafana Agent Configuration Generator](https://github.com/grafana/agent-configurator) a tool allows for easy configuration of Grafana Agents Flow system diff --git a/fs.go b/fs.go index 344c8bf0..ab66c0a1 100644 --- a/fs.go +++ b/fs.go @@ -18,7 +18,7 @@ import ( //go:embed .lgtmp.tar var DirFS embed.FS -//go:generate tar cf .lgtmp.tar .bingo docker-compose kubernetes monitoring-mixins tools Makefile compose.yaml +//go:generate tar cf .lgtmp.tar .bingo docker-compose kubernetes monitoring-mixins tools Makefile var GenDir = ".lgtmp" func init() { diff --git a/kubernetes/k3d-k3s-config.yaml b/kubernetes/k3d-k3s-config.yaml index c6273c27..ee25ceee 100644 --- a/kubernetes/k3d-k3s-config.yaml +++ b/kubernetes/k3d-k3s-config.yaml @@ -7,7 +7,7 @@ agents: 2 kubeAPI: hostIP: "127.0.0.1" hostPort: "6550" -image: rancher/k3s:v1.29.2-k3s1 +image: rancher/k3s:v1.29.3-k3s1 ports: # mapping the ingress port 80 to localhost:8080 - port: 8080:80