forked from b4mad/racing
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ update pipelines, update telegraf config, see b4mad#374
Signed-off-by: Christoph Görn <[email protected]>
- Loading branch information
Showing
5 changed files
with
161 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,49 +4,37 @@ on: | |
types: [opened, reopened, synchronize] | ||
|
||
env: | ||
IMAGE_NAME: paddock | ||
IMAGE_TAGS: ${{ github.sha }} | ||
IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }} | ||
REGISTRY_USER: ${{ github.actor }} | ||
REGISTRY_PASSWORD: ${{ secrets.GITHUB_TOKEN }} | ||
IMAGE_NAME: paddock | ||
IMAGE_TAGS: ${{ github.sha }} | ||
IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }} | ||
REGISTRY_USER: ${{ github.actor }} | ||
REGISTRY_PASSWORD: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
permissions: | ||
contents: read | ||
|
||
# https://github.com/pre-commit/action/issues/7#issuecomment-1251300704 | ||
# run only on changed files | ||
jobs: | ||
lint-and-format: | ||
name: linting and formatting | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
# requites to grab the history of the PR | ||
fetch-depth: 0 | ||
- uses: actions/setup-python@v4 | ||
- uses: pre-commit/[email protected] | ||
with: | ||
extra_args: --color=always --from-ref ${{ github.event.pull_request.base.sha }} --to-ref ${{ github.event.pull_request.head.sha }} | ||
build: | ||
name: build | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Harden Runner | ||
uses: step-security/harden-runner@8ca2b8b2ece13480cda6dacd3511b49857a23c09 # v2.5.1 | ||
with: | ||
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs | ||
- name: Harden Runner | ||
uses: step-security/harden-runner@8ca2b8b2ece13480cda6dacd3511b49857a23c09 # v2.5.1 | ||
with: | ||
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs | ||
|
||
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 | ||
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 | ||
|
||
- name: Buildah Action | ||
id: build_image | ||
uses: redhat-actions/buildah-build@b4dc19b4ba891854660ab1f88a097d45aa158f76 # v2.12 | ||
with: | ||
image: ${{ env.IMAGE_NAME }} | ||
tags: ${{ env.IMAGE_TAGS }} | ||
oci: true | ||
context: components/paddock | ||
containerfiles: | | ||
./components/paddock/Containerfile | ||
- name: Buildah Action | ||
id: build_image | ||
uses: redhat-actions/buildah-build@b4dc19b4ba891854660ab1f88a097d45aa158f76 # v2.12 | ||
with: | ||
image: ${{ env.IMAGE_NAME }} | ||
tags: ${{ env.IMAGE_TAGS }} | ||
oci: true | ||
context: components/paddock | ||
containerfiles: | | ||
./components/paddock/Containerfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
|
||
resources: | ||
- ../../../base/telegraf | ||
|
||
configMapGenerator: | ||
- name: telegraf-config | ||
behavior: replace | ||
files: | ||
- telegraf.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
[agent] | ||
collection_jitter = "0s" | ||
debug = false | ||
flush_interval = "2s" | ||
flush_jitter = "0s" | ||
hostname = "$HOSTNAME" | ||
interval = "1s" | ||
logfile = "" | ||
metric_batch_size = 1000 | ||
metric_buffer_limit = 10000 | ||
omit_hostname = false | ||
precision = "" | ||
quiet = false | ||
round_interval = true | ||
|
||
[[processors.enum]] | ||
[[processors.enum.mapping]] | ||
dest = "status_code" | ||
field = "status" | ||
|
||
[processors.enum.mapping.value_mappings] | ||
critical = 3 | ||
healthy = 1 | ||
problem = 2 | ||
|
||
# Collect statistics about itself | ||
[[inputs.internal]] | ||
## If true, collect telegraf memory stats. | ||
collect_memstats = true | ||
|
||
[[inputs.mqtt_consumer.topic_parsing]] | ||
topic = "racing/+/+/+/+/+/+/+" | ||
# measurement = "measurement/_" | ||
tags = "_/user/UserId/SessionId/GameName/TrackCode/CarModel/SessionTypeName" | ||
# fields = "_/_/_/test" | ||
|
||
[inputs.mqtt_consumer.topic_parsing.types] | ||
CarModel = "string" | ||
GameName = "string" | ||
SessionId = "string" | ||
TrackCode = "string" | ||
UserId = "string" | ||
user = "string" | ||
|
||
[[inputs.mqtt_consumer.json_v2]] | ||
measurement_name = "laps" | ||
# dont use the timestamp from the message, since it is not reliable | ||
# timestamp will be set to the time the message was received | ||
# timestamp_format = "unix_ms" | ||
# timestamp_path = "time" | ||
# timestamp_timezone = "UTC" | ||
|
||
# [[inputs.mqtt_consumer.json_v2.tag]] | ||
# path = "userId" | ||
# type = "text" | ||
|
||
# [[inputs.mqtt_consumer.json_v2.field]] | ||
# path = "carState.CarCoordinates.0" | ||
# rename = "world_x" | ||
|
||
[[inputs.mqtt_consumer.json_v2.object]] | ||
disable_prepend_keys = true | ||
path = "telemetry" | ||
# timestamp_key = "time" | ||
# excluded_keys = ["CarCoordinates"] | ||
# tags = ["CarModel", "CarClass"] | ||
|
||
# CrewChief v1 configuration | ||
[[inputs.mqtt_consumer]] | ||
servers = ["tcp://mosquitto-tcp:1883"] | ||
topics = [ | ||
"crewchief/#" | ||
] | ||
username = "$USERNAME" | ||
password = "$PASSWORD" | ||
data_format = "json_v2" | ||
|
||
[[inputs.mqtt_consumer.topic_parsing]] | ||
topic = "crewchief/+/+/+/+/+/+" | ||
tags = "_/user/SessionId/GameName/TrackCode/CarModel/SessionTypeName" | ||
[inputs.mqtt_consumer.topic_parsing.types] | ||
user = "string" | ||
SessionId = "string" | ||
GameName = "string" | ||
TrackCode = "string" | ||
CarModel = "string" | ||
SessionTypeName = "string" | ||
|
||
[[inputs.mqtt_consumer.json_v2]] | ||
measurement_name = "laps_cc" | ||
# dont use the timestamp from the message, since it is not reliable | ||
# timestamp will be set to the time the message was received | ||
# timestamp_path = "time" | ||
# timestamp_format = "unix_ms" | ||
# timestamp_timezone = "UTC" | ||
|
||
[[inputs.mqtt_consumer.json_v2.object]] | ||
path = "telemetry" | ||
# timestamp_key = "time" | ||
disable_prepend_keys = true | ||
tags = ["CurrentLap", "CarClass"] | ||
|
||
[[outputs.influxdb_v2]] | ||
bucket = "racing" | ||
organization = "b4mad" | ||
token = "$INFLUX_TOKEN" | ||
urls = ["http://influxdb2:8086"] | ||
namepass = ["laps*"] | ||
|
||
# Configuration for the Prometheus client to spawn | ||
[[outputs.prometheus_client]] | ||
## Address to listen on. | ||
listen = ":9090" | ||
namepass = ["internal_*"] |