refactor
This commit is contained in:
parent
d0ea6e9eec
commit
2967f1a5af
31 changed files with 469 additions and 165 deletions
66
Makefile
66
Makefile
|
|
@ -32,7 +32,7 @@ VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo
|
|||
COMMIT ?= $(shell git rev-parse --short HEAD 2>/dev/null || echo unknown)
|
||||
BUILD_DATE ?= $(shell date -u +%Y-%m-%dT%H:%M:%SZ)
|
||||
|
||||
REGISTRY ?= nexus.urpi.be
|
||||
REGISTRY ?= nexus.urpi.be/docker-hosted
|
||||
IMAGE_NAME ?= $(REGISTRY)/$(BINARY)
|
||||
IMAGE_TAG ?= $(VERSION)
|
||||
PLATFORM ?= linux/amd64,linux/arm64
|
||||
|
|
@ -127,12 +127,13 @@ dev: ## Run the API with hot reload (Ctrl-C to stop)
|
|||
air -c .air.toml
|
||||
|
||||
.PHONY: dev-api
|
||||
dev-api: ## Run only the API server, no frontend
|
||||
dev-api: ## Run the API (no SPA); Vite serves the UI, this serves the runtime SDK
|
||||
@BANANAS_ENVIRONMENT=development \
|
||||
BANANAS_AUTH_MODE=dev \
|
||||
BANANAS_HTTP_ADDR=:8080 \
|
||||
BANANAS_DATABASE_PATH=./data/go-bananas.db \
|
||||
BANANAS_STATIC_DIR= BANANAS_SDK_DIR= \
|
||||
BANANAS_STATIC_DIR= \
|
||||
BANANAS_SDK_DIR=$(SDK_DIR)/dist \
|
||||
$(GO) run -ldflags "$(LDFLAGS)" $(CMD)
|
||||
|
||||
.PHONY: dev-web
|
||||
|
|
@ -140,7 +141,7 @@ dev-web: ## Run the Vite dev server for the admin UI, proxying the API
|
|||
cd $(WEB_DIR) && $(NPM) run dev
|
||||
|
||||
.PHONY: dev-all
|
||||
dev-all: ## Run the API and the frontend dev server together
|
||||
dev-all: build-sdk ## Run the API and the frontend dev server together
|
||||
@echo "API on http://localhost:8080, admin UI on http://localhost:5173"
|
||||
@trap 'kill 0' EXIT; \
|
||||
$(MAKE) dev-api & \
|
||||
|
|
@ -375,7 +376,7 @@ helm-template: ## Render the chart with the default values
|
|||
helm-template-auth: ## Render the chart configured for OIDC
|
||||
$(HELM) template go-bananas deploy/helm/go-bananas \
|
||||
--set identity.mode=oidc \
|
||||
--set identity.oidc.issuer=https://auth-dev.urpi.be/realms/urpi \
|
||||
--set identity.oidc.issuer=https://auth.lcl-urpi.be/realms/urpi \
|
||||
--set identity.oidc.clientId=go-bananas \
|
||||
--set identity.oidc.generateSecret=false \
|
||||
--set identity.oidc.existingSecret=go-bananas-oidc \
|
||||
|
|
@ -392,6 +393,61 @@ helm-install: ## Install the chart into the current kube context ##@destructive
|
|||
helm-uninstall: ## Remove the release ##@destructive
|
||||
$(HELM) uninstall go-bananas --namespace go-bananas
|
||||
|
||||
##@ Local (lcl)
|
||||
|
||||
# The lcl environment is the developer's local k3s cluster with a registry at
|
||||
# localhost:5000 and a TLS edge serving *.intern-urpi.be. go-* apps deploy into the
|
||||
# shared `go-insane-lcl` namespace. These targets use values-lcl.yaml.
|
||||
#
|
||||
# KUBECONFIG — the lcl kubeconfig. On this box the `local` kubecontext goes through a
|
||||
# Rancher proxy that can 502; the direct k3s config is /etc/rancher/k3s/k3s.yaml.
|
||||
# Set it to deploy without depending on the proxy: KUBECONFIG=/etc/rancher/k3s/k3s.yaml make deploy-lcl
|
||||
# LCL_TAG — image tag. Defaults to a timestamp so a rebuild is always re-pulled;
|
||||
# `IfNotPresent` would otherwise serve a stale `0.0.1` from the node cache.
|
||||
|
||||
LCL_REGISTRY ?= localhost:5000
|
||||
LCL_REPO ?= go-bananas
|
||||
LCL_TAG ?= $(shell date -u +%Y%m%d%H%M%S)
|
||||
LCL_NAMESPACE ?= go-insane-lcl
|
||||
LCL_VALUES = deploy/helm/go-bananas/values-lcl.yaml
|
||||
|
||||
.PHONY: image-lcl
|
||||
image-lcl: ## Build and push the image to the local registry ##@destructive
|
||||
$(DOCKER) buildx build \
|
||||
--build-arg VERSION=$(VERSION) \
|
||||
--build-arg COMMIT=$(COMMIT) \
|
||||
--build-arg BUILD_DATE=$(BUILD_DATE) \
|
||||
--tag $(LCL_REGISTRY)/$(LCL_REPO):$(LCL_TAG) \
|
||||
--push \
|
||||
.
|
||||
|
||||
.PHONY: helm-template-lcl
|
||||
helm-template-lcl: ## Render the lcl Helm manifest
|
||||
$(HELM) template go-bananas deploy/helm/go-bananas \
|
||||
--namespace $(LCL_NAMESPACE) \
|
||||
--values $(LCL_VALUES) \
|
||||
--set-string image.tag=$(LCL_TAG)
|
||||
|
||||
.PHONY: helm-install-lcl
|
||||
helm-install-lcl: ## Deploy go-bananas to the local (lcl) environment ##@destructive
|
||||
$(HELM) upgrade --install go-bananas deploy/helm/go-bananas \
|
||||
--namespace $(LCL_NAMESPACE) --create-namespace \
|
||||
--values $(LCL_VALUES) \
|
||||
--set-string image.tag=$(LCL_TAG) \
|
||||
--wait --timeout 5m
|
||||
|
||||
.PHONY: helm-uninstall-lcl
|
||||
helm-uninstall-lcl: ## Remove the lcl release ##@destructive
|
||||
$(HELM) uninstall go-bananas --namespace $(LCL_NAMESPACE)
|
||||
|
||||
.PHONY: deploy-lcl
|
||||
deploy-lcl: image-lcl helm-install-lcl ## Build, push, deploy to lcl, then verify ##@destructive
|
||||
@echo "waiting for rollout ($(LCL_NAMESPACE)/go-bananas)..."
|
||||
@kubectl -n $(LCL_NAMESPACE) rollout status deploy/go-bananas --timeout=120s
|
||||
@echo "=== runtime manifest through the TLS edge ==="
|
||||
@curl -sk https://bananas-lcl.intern-urpi.be/rt/v1/manifest.json -o /dev/null -w 'manifest.json -> %{http_code}\n' || true
|
||||
@echo "deployed image: $(LCL_REGISTRY)/$(LCL_REPO):$(LCL_TAG)"
|
||||
|
||||
##@ Docs
|
||||
|
||||
.PHONY: docs-serve
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue