Initial commit with Woodpecker CI
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
33
CLAUDE.md
Normal file
33
CLAUDE.md
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
# CLAUDE.md
|
||||||
|
|
||||||
|
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
||||||
|
|
||||||
|
## Project Overview
|
||||||
|
|
||||||
|
A minimal cloud-native Go web application using the Gin framework. Serves a greeting endpoint on port 8000 and exposes Prometheus metrics on port 8080. All application logic lives in `cmd/main.go`.
|
||||||
|
|
||||||
|
## Build & Run Commands
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Build locally (requires Go 1.23+, toolchain 1.24.11)
|
||||||
|
go build -tags netgo -ldflags "-linkmode 'external' -extldflags '-static'" -o server ./cmd
|
||||||
|
|
||||||
|
# Run locally
|
||||||
|
GIN_MODE=release ./server
|
||||||
|
|
||||||
|
# Build and run via Docker Compose (ports 8000 + 8080)
|
||||||
|
docker-compose up --build
|
||||||
|
|
||||||
|
# Kubernetes deployment
|
||||||
|
kubectl apply -f deployment.yaml
|
||||||
|
```
|
||||||
|
|
||||||
|
## Architecture
|
||||||
|
|
||||||
|
- **Single-file app** (`cmd/main.go`): Dual Gin routers — app router on `:8000`, metrics router on `:8080`
|
||||||
|
- **Environment variables**: `USERNAME`, `MY_POD_NAME` (used in greeting response)
|
||||||
|
- **Metrics**: gin-metrics library exposes Prometheus metrics at `/metrics` on the metrics router
|
||||||
|
- **Deployment**: Multi-stage Dockerfile producing a scratch-based static binary; Kubernetes manifests with Traefik ingress and PodMonitor
|
||||||
|
- **CI/CD**: Woodpecker CI (`.woodpecker.yaml`) builds with Kaniko and pushes to `git.codemowers.io` registry
|
||||||
|
- **No tests, no database, no linter configuration**
|
||||||
|
- `templates/` and `static/` directories exist but are not currently wired up in the router
|
||||||
@@ -18,7 +18,7 @@ spec:
|
|||||||
- name: imgcred
|
- name: imgcred
|
||||||
containers:
|
containers:
|
||||||
- name: hello-gin
|
- name: hello-gin
|
||||||
image: git.codemowers.io/laurivosandi/hello-gin
|
image: git.codemowers.io/itumi/hello-gin
|
||||||
env:
|
env:
|
||||||
- name: USERNAME
|
- name: USERNAME
|
||||||
value: world
|
value: world
|
||||||
@@ -46,6 +46,19 @@ spec:
|
|||||||
port: 8000
|
port: 8000
|
||||||
name: http
|
name: http
|
||||||
---
|
---
|
||||||
|
apiVersion: cert-manager.io/v1
|
||||||
|
kind: Certificate
|
||||||
|
metadata:
|
||||||
|
name: gin-jake
|
||||||
|
namespace: memelord-jake
|
||||||
|
spec:
|
||||||
|
secretName: gin-jake-tls
|
||||||
|
dnsNames:
|
||||||
|
- hello-itumi.ee-lte-1.codemowers.io # ← Changed from gin-jake to hello-itumi
|
||||||
|
issuerRef:
|
||||||
|
name: letsencrypt
|
||||||
|
kind: ClusterIssuer
|
||||||
|
---
|
||||||
apiVersion: networking.k8s.io/v1
|
apiVersion: networking.k8s.io/v1
|
||||||
kind: Ingress
|
kind: Ingress
|
||||||
metadata:
|
metadata:
|
||||||
@@ -55,7 +68,7 @@ metadata:
|
|||||||
traefik.ingress.kubernetes.io/router.tls.certresolver: letsencrypt
|
traefik.ingress.kubernetes.io/router.tls.certresolver: letsencrypt
|
||||||
spec:
|
spec:
|
||||||
rules:
|
rules:
|
||||||
- host: hello-lauri.ee-lte-1.codemowers.io
|
- host: hello-itumi.ee-lte-1.codemowers.io
|
||||||
http:
|
http:
|
||||||
paths:
|
paths:
|
||||||
- pathType: Prefix
|
- pathType: Prefix
|
||||||
@@ -65,6 +78,10 @@ spec:
|
|||||||
name: hello-gin
|
name: hello-gin
|
||||||
port:
|
port:
|
||||||
name: http
|
name: http
|
||||||
|
tls:
|
||||||
|
- secretName: gin-jake-tls
|
||||||
|
hosts: # ← Add this
|
||||||
|
- hello-itumi.ee-lte-1.codemowers.io
|
||||||
---
|
---
|
||||||
apiVersion: monitoring.coreos.com/v1
|
apiVersion: monitoring.coreos.com/v1
|
||||||
kind: PodMonitor
|
kind: PodMonitor
|
||||||
@@ -76,3 +93,4 @@ spec:
|
|||||||
app: hello-gin
|
app: hello-gin
|
||||||
podMetricsEndpoints:
|
podMetricsEndpoints:
|
||||||
- port: metrics
|
- port: metrics
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,8 @@ metadata:
|
|||||||
name: hello-gin
|
name: hello-gin
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
kubectl: {}
|
kubectl:
|
||||||
|
defaultNamespace: memelord-jake
|
||||||
|
|
||||||
manifests:
|
manifests:
|
||||||
rawYaml:
|
rawYaml:
|
||||||
@@ -14,7 +15,7 @@ manifests:
|
|||||||
# kubectl create secret docker-registry imgcred --docker-server=https://git.codemowers.io --docker-username=__token__ --docker-password=...
|
# kubectl create secret docker-registry imgcred --docker-server=https://git.codemowers.io --docker-username=__token__ --docker-password=...
|
||||||
build:
|
build:
|
||||||
artifacts:
|
artifacts:
|
||||||
- image: git.codemowers.io/laurivosandi/hello-gin
|
- image: git.codemowers.io/itumi/hello-gin
|
||||||
|
|
||||||
# Comment following lines below to build locally
|
# Comment following lines below to build locally
|
||||||
# cluster:
|
# cluster:
|
||||||
|
|||||||
Reference in New Issue
Block a user