Skip to content

Commit

Permalink
Merge pull request #3 from Inetum-Poland/feat/more-telemetry
Browse files Browse the repository at this point in the history
feat(go): added more telemetry
  • Loading branch information
aamkye authored Dec 9, 2024
2 parents 1eb417f + 93740a1 commit 620d555
Show file tree
Hide file tree
Showing 39 changed files with 1,236 additions and 397 deletions.
9 changes: 9 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
* @inetum-poland/devops-admins

/golang @aamkye

/dotnet @adamsosinski

/python @szomelioza

readme.md
23 changes: 23 additions & 0 deletions .github/workflows/reusable_assign_tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: "Reusable"

on:
push:
branches:
- main
pull_request:
branches:
- main
types:
- labeled
- unlabeled
- opened
- reopened
- synchronize

jobs:
assign:
name: "Assign"
uses: Inetum-Poland/.github/.github/workflows/assign_tag.yml@main
with:
bump_default_level: patch
bump_latest: true
15 changes: 15 additions & 0 deletions .github/workflows/reusable_verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: "Reusable"

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
verify:
name: "Verify"
uses: Inetum-Poland/.github/.github/workflows/verify.yml@main
secrets: inherit
15 changes: 15 additions & 0 deletions .github/workflows/reusable_verify_semantic_pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: "Reusable"

on:
pull_request:
types:
- opened
- reopened
- synchronize
- edited

jobs:
verify:
name: "Verify"
uses: Inetum-Poland/.github/.github/workflows/verify_semantic_pr.yml@main
secrets: inherit
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
.DS_Store
__pychache__/**
**.pyc
**.pyc
15 changes: 15 additions & 0 deletions .mise.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[tools]
pre-commit = 'latest'
python = '3.12'
go = '1.23.3'
golangci-lint = 'latest'
'go:golang.org/x/tools/cmd/goimports' = 'latest'
'go:github.com/golangci/golangci-lint/cmd/golangci-lint' = 'latest'
'go:github.com/fzipp/gocyclo/cmd/gocyclo' = 'latest'
'go:github.com/go-critic/go-critic/cmd/gocritic' = 'latest'
'go:github.com/mitranim/gow' = 'latest'
'go:github.com/BurntSushi/toml/cmd/tomlv' = 'latest'

[settings]
not_found_auto_install = true
experimental = true
95 changes: 95 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
---
# https://github.com/antonbabenko/pre-commit-terraform
# brew install pre-commit terraform-docs tflint tfsec trivy checkov terrascan infracost tfupdate minamijoyo/hcledit/hcledit jq

# https://github.com/pre-commit/pre-commit-hooks
# https://github.com/python-jsonschema/check-jsonschema/

# https://github.com/trufflesecurity/trufflehog

fail_fast: true

repos:
- repo: https://github.com/compilerla/conventional-pre-commit
rev: v3.6.0
hooks:
- id: conventional-pre-commit
name: Check Conventional Commit
stages: [commit-msg]
args: [--strict, --force-scope]

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-yaml
name: Check YAML
stages: [pre-commit]

- id: mixed-line-ending
name: Check Mixed Line Endings
stages: [pre-commit]
args: [--fix=lf]

- id: end-of-file-fixer
name: Check End of Files
stages: [pre-commit]

- id: trailing-whitespace
name: Check Trailing Whitespace
stages: [pre-commit]
args: [--markdown-linebreak-ext=md]

- id: check-merge-conflict
name: Check for Merge Conflicts
stages: [pre-commit]

- id: detect-private-key
name: Check Private Keys
stages: [pre-commit]

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.29.4
hooks:
- id: check-github-workflows
name: Check GitHub Workflows
stages: [pre-commit]
args: ["--verbose"]

- repo: https://github.com/dnephin/pre-commit-golang
rev: v0.5.1
hooks:
- id: go-fmt
name: GO Format

# - id: go-vet
- id: go-imports
name: GO Imports

- id: go-cyclo
name: GO Cyclomatic Complexity
args: [-over=15]

- id: validate-toml
name: GO Validate TOML

- id: no-go-testing
name: GO No Testing

# - id: golangci-lint

# - id: go-critic
# name: GO Critic

# - id: go-unit-tests

# - id: go-build

- id: go-mod-tidy
name: GO Mod Tidy

# - repo: https://github.com/jvstein/pre-commit-dotnet-format
# rev: 'v0.3'
# hooks:
# - id: dotnet-format
# name: .Net Format
# args: ['dotnet/dotnet-app-blueprint.sln']
109 changes: 82 additions & 27 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,53 @@
# https://stackoverflow.com/questions/67498836/docker-chown-changing-ownership-of-data-db-operation-not-permitted

services:

# --- Apps --------------------------------------------------------------------
app-golang:
build:
context: golang
context: ./golang
dockerfile: dockerfile
target: finall
container_name: app-golang
ports:
- 8080:8080
- 8080:8080 # API
depends_on:
- mongodb
- grafana
environment:
- APP_OTEL_HOST=opentelemetry
- APP_OTEL_PORT=4317
- APP_MONGO_HOST=mongodb
- APP_MONGO_PORT=27017
- APP_MONGO_USER=root
- APP_MONGO_PASS=Password123

app-dotnet:
build:
context: dotnet
context: ./dotnet
dockerfile: Dockerfile
container_name: app-dotnet
environment:
- OTLP_HOSTNAME=opentelemetry
ports:
- 8081:8080
depends_on:
- mongodb
- grafana

app-python:
build:
context: python
context: ./python
dockerfile: dockerfile
container_name: app-python
ports:
- 8082:8080
depends_on:
- mongodb
- grafana

# ---

# --- MongoDB -----------------------------------------------------------------
# https://github.com/mongodb/mongo
# https://hub.docker.com/_/mongo
# https://stackoverflow.com/questions/67498836/docker-chown-changing-ownership-of-data-db-operation-not-permitted
mongodb:
image: mongo:8.0.3
container_name: mongodb
Expand All @@ -37,17 +56,36 @@ services:
- MONGO_INITDB_ROOT_PASSWORD=Password123
- MONGO_INITDB_DATABASE=Data
ports:
- 27017
- 27017:27017 # mongodb
volumes:
- mongodb-data:/data/db
- ./docker-compose/mongo/mongo-init.js:/docker-entrypoint-initdb.d/mongo-init.js:ro

# https://github.com/mongo-express/mongo-express
# https://hub.docker.com/_/mongo-express/tags
mongo-express:
image: mongo-express:1.0.2
container_name: mongo-express
restart: unless-stopped
ports:
- 27018:8081 # mongo-express
environment:
- ME_CONFIG_MONGODB_URL=mongodb://root:Password123@mongodb:27017
- ME_CONFIG_MONGODB_ENABLE_ADMIN=true
- ME_CONFIG_MONGODB_ADMINUSERNAME=root
- ME_CONFIG_MONGODB_ADMINPASSWORD=Password123
depends_on:
- mongodb

# --- Grafana -----------------------------------------------------------------
# https://github.com/grafana/grafana
# https://hub.docker.com/r/grafana/grafana/tags
grafana:
image: grafana/grafana:11.3.0
image: grafana/grafana:11.3.1
container_name: grafana
restart: unless-stopped
ports:
- 3000:3000
- 3000:3000 # grafana http
environment:
- GF_AUTH_ANONYMOUS_ENABLED=true
- GF_AUTH_ANONYMOUS_ORG_ROLE=Admin
Expand All @@ -57,59 +95,76 @@ services:
volumes:
- ./docker-compose/grafana/grafana-datasources.yaml:/etc/grafana/provisioning/datasources/datasources.yaml

# --- LGTM --------------------------------------------------------------------
# https://github.com/prometheus/prometheus
# https://hub.docker.com/r/prom/prometheus/tags
prometheus:
image: prom/prometheus:v2.55.0
image: prom/prometheus:v3.0.1
container_name: prometheus
restart: unless-stopped
ports:
- 9090:9090
command: [ "--config.file=/etc/prometheus/prometheus.yaml" ]
- 9090:9090 # prometheus http
command:
- "--config.file=/etc/prometheus/prometheus.yaml"
- "--enable-feature=exemplar-storage"
- "--enable-feature=extra-scrape-metrics"
- "--enable-feature=promql-per-step-stats"
- "--web.enable-otlp-receiver"
depends_on:
- grafana
volumes:
- ./docker-compose/prometheus/prometheus.yaml:/etc/prometheus/prometheus.yaml

# https://github.com/grafana/tempo
# https://hub.docker.com/r/grafana/tempo/tags
tempo:
image: grafana/tempo:2.6.1
container_name: tempo
ports:
- 3200 # tempo http
- 3201 # tempo grpc
- 4317 # otlp grpc
- 4318 # otlp http
- 3200:3200 # tempo http
- 3201:3201 # tempo grpc
# - 4317 # otlp grpc
# - 4318 # otlp http
command: [ "-config.file=/etc/tempo.yaml" ]
depends_on:
- grafana
volumes:
- ./docker-compose/tempo/tempo.yaml:/etc/tempo.yaml

# https://github.com/grafana/loki
# https://hub.docker.com/r/grafana/loki/tags
loki:
image: grafana/loki:3.1.2
image: grafana/loki:3.3.0
container_name: loki
restart: unless-stopped
ports:
- 3100 # loki http
- 9095 # loki grpc
- 3100:3100 # loki http
- 9095:9095 # loki grpc
command: [ "-config.file=/etc/loki.yaml" ]
depends_on:
- grafana
volumes:
- ./docker-compose/loki/loki.yaml:/etc/loki.yaml

# ---

# --- OpenTelemetry -----------------------------------------------------------
# https://github.com/open-telemetry/opentelemetry-collector
# https://hub.docker.com/r/otel/opentelemetry-collector/tags
opentelemetry:
image: otel/opentelemetry-collector:0.112.0
image: otel/opentelemetry-collector:0.114.0
container_name: opentelemetry
restart: unless-stopped
ports:
- 4317 # otlp grpc
- 4318 # otlp http
- 4137:4317 # otlp grpc
- 4318:4318 # otlp http
command: --config=/etc/opentelemetry/config.yaml
depends_on:
- grafana
- loki
- tempo
- prometheus
volumes:
- ./docker-compose/opentelemetry/config.yaml:/etc/opentelemetry/config.yaml

# --- Volumes -----------------------------------------------------------------
volumes:
mongodb-data:
mongodb-data:
Loading

0 comments on commit 620d555

Please sign in to comment.