Skip to content

Commit

Permalink
Working on documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
efumagal committed Aug 8, 2023
1 parent 298689f commit 675af96
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 2 deletions.
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,24 @@
A simple HTTP client to serve APIs to calculate distance between 3D points.
Implemented using [Fiber](https://gofiber.io) and instrumented using [OpenTelemetry](https://opentelemetry.io).

## CI/CD

### GitHub action
When pushing to main the [Publish Docker image to GHCR](.github/workflows/ghcr-build-push.yml) is triggered:
- Build the Docker image and push it to ghcr.io registry
- Scan the docker image using [Snyk](https://snyk.io)
- Update [kustomization.yaml](kustomize/kustomization.yaml) with the newly generated Docker image

In order to keep everything in one repo the K8S manifests are kept in (kustomize)[kustomize/] folder, unless using a monorepo they should probably be decoupled as the app code should be agnostic to the way is deployed.
### K8s manifest Kustomize
For this example I'm using [Kustomize](https://kustomize.io) to build the K8s manifest, this is different than what I'm currently doing on real projects where I use [Helm Charts](https://helm.sh/docs/topics/charts/).
In order to keep everything in one repo the K8S manifests are kept in [kustomize](kustomize/) folder, unless using a monorepo they should probably be decoupled as the app code should be agnostic to the way is deployed.
Similarly the files used by [Flux](https://fluxcd.io) are stored in [fluxCD](fluxCD/).

### Flux
Flux is deployed on a local K8s cluster, and changes in the [kustomize](kustomize/) folder in this repo will trigger the reconciliation.
On a real project there may be different variants for each env (deployment, staging, production).

## Run
## Run Locally

```shell
go run main.go
Expand All @@ -33,6 +43,7 @@ k6 run load_distance.js
## TO DOs

- For a real app consider structuring the Go code using DDD Hexagonal pattern
- Run Docker build and push only on related code changes
- Add unit tests and run them on PRs
- Generate OpenAPI specs

Expand Down
17 changes: 17 additions & 0 deletions fluxCD/geo3d-kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: geo-3d-otel
namespace: flux-system
spec:
interval: 30m0s
path: ./kustomize
prune: true
retryInterval: 2m0s
sourceRef:
kind: GitRepository
name: geo-3d-otel
targetNamespace: test-apps
timeout: 3m0s
wait: true
11 changes: 11 additions & 0 deletions fluxCD/geo3d-source.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
apiVersion: source.toolkit.fluxcd.io/v1
kind: GitRepository
metadata:
name: geo-3d-otel
namespace: flux-system
spec:
interval: 1m0s
ref:
branch: main
url: https://github.com/efumagal/geo-3d-otel

0 comments on commit 675af96

Please sign in to comment.