-
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.
- Loading branch information
1 parent
882ad20
commit f0b0ed4
Showing
27 changed files
with
365 additions
and
72 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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
defaultBaseImage: ghcr.io/carverauto/eventrunner-base:v2 | ||
builds: | ||
- id: api-admin | ||
main: . | ||
platforms: | ||
- linux/amd64 |
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,30 @@ | ||
# Start from a minimal Alpine image to set up our directory structure | ||
FROM --platform=linux/amd64 alpine:3.14 AS builder | ||
|
||
# Create necessary directories | ||
WORKDIR /app | ||
RUN mkdir -p /app/configs /app/migrations | ||
|
||
# Copy migrations and configs | ||
COPY migrations/ /app/migrations/ | ||
COPY configs/.env /app/configs/.env | ||
COPY configs/.staging.env /app/configs/.staging.env | ||
|
||
# Now, create our final image based on distroless | ||
FROM --platform=linux/amd64 cgr.dev/chainguard/go:latest | ||
# debug using a container with a shell | ||
#FROM --platform=linux/amd64 alpine:3.14 | ||
|
||
# Copy the directory structure from the builder stage | ||
COPY --from=builder /app /app | ||
|
||
# Set working directory | ||
WORKDIR /app | ||
|
||
# Set environment variables | ||
ENV APP_ENV=staging | ||
ENV GOFR_MIGRATIONS_DIR=/app/migrations | ||
|
||
# The ko-built binary will be added as "app" in the container | ||
# We don't set an ENTRYPOINT here as ko will do that for us | ||
ENTRYPOINT ["sh"] |
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,22 @@ | ||
# Define variables | ||
KO_DOCKER_REPO := ghcr.io/carverauto/api-admin | ||
VERSION := v0.0.01 | ||
|
||
# Default target | ||
all: build | ||
|
||
# Build the binary locally | ||
build: | ||
go build -o api-admin . | ||
|
||
# Build and push the container image using ko | ||
ko-build: | ||
@export KO_DOCKER_REPO=$(KO_DOCKER_REPO) && \ | ||
export VERSION=$(VERSION) && \ | ||
ko build --bare --tags $(VERSION) ./ | ||
|
||
# Clean up | ||
clean: | ||
rm -f api-admin | ||
|
||
.PHONY: all build ko-build clean |
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
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,30 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: api-admin-config | ||
namespace: eventrunner | ||
data: | ||
.env: | | ||
APP_NAME=api-admin | ||
HTTP_PORT=8200 | ||
LOG_LEVEL=DEBUG | ||
ORY_PROJECT_URL=http://hydra-admin.auth:4445 | ||
DB_HOST=localhost | ||
DB_USER=root | ||
DB_PASSWORD=password | ||
DB_NAME=eventrunner | ||
DB_PORT=2001 | ||
DB_DIALECT=mongo | ||
DB_URL=mongodb://er-mongodb.svc.cluster.local:27017 | ||
.staging.env: | | ||
LOG_LEVEL=DEBUG | ||
APP_NAME=api-admin | ||
HTTP_PORT=8200 | ||
ORY_PROJECT_URL=http://hydra-admin.auth:4445 | ||
DB_HOST=localhost | ||
DB_USER=root | ||
DB_PASSWORD=password | ||
DB_NAME=eventrunner | ||
DB_PORT=2001 | ||
DB_DIALECT=mongo | ||
DB_URL=mongodb://er-mongodb.svc.cluster.local:27017 |
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,9 @@ | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: eventrunner-db-credentials | ||
namespace: eventrunner | ||
type: Opaque | ||
stringData: | ||
username: eventrunner | ||
password: changeme |
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,57 @@ | ||
apiVersion: networking.k8s.io/v1 | ||
kind: Ingress | ||
metadata: | ||
name: api-admin-health | ||
namespace: eventrunner | ||
annotations: | ||
cert-manager.io/cluster-issuer: threadr-issuer | ||
nginx.ingress.kubernetes.io/auth-response-headers: X-User,X-Tenant-ID,X-Request-Id,Authorization | ||
nginx.ingress.kubernetes.io/auth-snippet: | | ||
proxy_set_header X-Original-Uri $request_uri; | ||
nginx.ingress.kubernetes.io/auth-url: http://oathkeeper-proxy.auth.svc.cluster.local:4455/decisions/health | ||
nginx.ingress.kubernetes.io/ssl-redirect: "true" | ||
spec: | ||
ingressClassName: nginx | ||
rules: | ||
- host: api-admin.tunnel.threadr.ai | ||
http: | ||
paths: | ||
- path: /.well-known/health | ||
pathType: ImplementationSpecific | ||
backend: | ||
service: | ||
name: api-admin | ||
port: | ||
number: 8200 | ||
tls: | ||
- hosts: | ||
- api-admin.tunnel.threadr.ai | ||
secretName: eventrunner-api-tls | ||
--- | ||
apiVersion: networking.k8s.io/v1 | ||
kind: Ingress | ||
metadata: | ||
name: api-admin-alive | ||
namespace: eventrunner | ||
annotations: | ||
cert-manager.io/cluster-issuer: threadr-issuer | ||
nginx.ingress.kubernetes.io/auth-response-headers: X-User,X-Tenant-ID,X-Request-Id,Authorization | ||
nginx.ingress.kubernetes.io/auth-url: http://oathkeeper-proxy.auth.svc.cluster.local:4455/decisions/alive | ||
nginx.ingress.kubernetes.io/ssl-redirect: "true" | ||
spec: | ||
ingressClassName: nginx | ||
rules: | ||
- host: api-admin.tunnel.threadr.ai | ||
http: | ||
paths: | ||
- path: /.well-known/alive | ||
pathType: ImplementationSpecific | ||
backend: | ||
service: | ||
name: api-admin | ||
port: | ||
number: 8200 | ||
tls: | ||
- hosts: | ||
- api-admin.tunnel.threadr.ai | ||
secretName: eventrunner-api-tls |
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,25 @@ | ||
# ingress-api.yaml | ||
apiVersion: networking.k8s.io/v1 | ||
kind: Ingress | ||
metadata: | ||
name: api-admin | ||
namespace: eventrunner | ||
annotations: | ||
cert-manager.io/cluster-issuer: threadr-issuer | ||
spec: | ||
ingressClassName: nginx | ||
tls: | ||
- hosts: | ||
- api-admin.tunnel.threadr.ai | ||
secretName: eventrunner-api-tls | ||
rules: | ||
- host: api-admin.tunnel.threadr.ai | ||
http: | ||
paths: | ||
- path: /api-admin | ||
pathType: Prefix | ||
backend: | ||
service: | ||
name: oathkeeper-proxy | ||
port: | ||
number: 4455 |
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,28 @@ | ||
# ingress-callback.yaml | ||
apiVersion: networking.k8s.io/v1 | ||
kind: Ingress | ||
metadata: | ||
name: api-admin-callback | ||
namespace: eventrunner | ||
annotations: | ||
cert-manager.io/cluster-issuer: threadr-issuer | ||
nginx.ingress.kubernetes.io/use-regex: "true" | ||
nginx.ingress.kubernetes.io/proxy-pass-params: "on" | ||
nginx.ingress.kubernetes.io/rewrite-target: /callback$1 | ||
spec: | ||
ingressClassName: nginx | ||
tls: | ||
- hosts: | ||
- api-admin.tunnel.threadr.ai | ||
secretName: eventrunner-api-tls | ||
rules: | ||
- host: api-admin.tunnel.threadr.ai | ||
http: | ||
paths: | ||
- path: /callback(.*) | ||
pathType: ImplementationSpecific | ||
backend: | ||
service: | ||
name: api-admin | ||
port: | ||
number: 8200 |
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,33 @@ | ||
apiVersion: networking.k8s.io/v1 | ||
kind: Ingress | ||
metadata: | ||
name: api-admin | ||
namespace: eventrunner | ||
annotations: | ||
cert-manager.io/cluster-issuer: threadr-issuer | ||
nginx.ingress.kubernetes.io/rewrite-target: /$2 | ||
nginx.ingress.kubernetes.io/use-regex: "true" | ||
spec: | ||
ingressClassName: nginx | ||
tls: | ||
- hosts: | ||
- api-admin.tunnel.threadr.ai | ||
secretName: eventrunner-api-tls | ||
rules: | ||
- host: api-admin.tunnel.threadr.ai | ||
http: | ||
paths: | ||
- path: /callback(/|$)(.*) | ||
pathType: ImplementationSpecific | ||
backend: | ||
service: | ||
name: api-admin | ||
port: | ||
number: 8200 | ||
- path: /api | ||
pathType: Prefix | ||
backend: | ||
service: | ||
name: oathkeeper-proxy | ||
port: | ||
number: 4455 |
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
File renamed without changes.
Oops, something went wrong.