From cdbf31d6af5458786805128c295204e4fb082233 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20Groothuis?= Date: Tue, 17 Mar 2026 10:58:12 +0100 Subject: [PATCH] feat(grainlab): Added Staging environment to ArgoCD. --- .../grainlab-production/app-deployment.yaml | 57 +++++++++++++++++++ .../grainlab-production/app-ingress.yaml | 25 ++++++++ .../grainlab-production/app-service.yaml | 11 ++++ .../grainlab-production/namespace.yaml | 4 ++ .../grainlab-production/postgres-cluster.yaml | 24 ++++++++ .../grainlab-production/www-redirect.yaml | 26 +++++++++ 6 files changed, 147 insertions(+) create mode 100644 manifests/artemis/grainlab-production/app-deployment.yaml create mode 100644 manifests/artemis/grainlab-production/app-ingress.yaml create mode 100644 manifests/artemis/grainlab-production/app-service.yaml create mode 100644 manifests/artemis/grainlab-production/namespace.yaml create mode 100644 manifests/artemis/grainlab-production/postgres-cluster.yaml create mode 100644 manifests/artemis/grainlab-production/www-redirect.yaml diff --git a/manifests/artemis/grainlab-production/app-deployment.yaml b/manifests/artemis/grainlab-production/app-deployment.yaml new file mode 100644 index 0000000..8cf3d44 --- /dev/null +++ b/manifests/artemis/grainlab-production/app-deployment.yaml @@ -0,0 +1,57 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: grainlab + namespace: grainlab-production +spec: + replicas: 1 + selector: + matchLabels: + app: grainlab + template: + metadata: + labels: + app: grainlab + spec: + imagePullSecrets: + - name: ghcr-cred + containers: + - name: grainlab + image: ghcr.io/daniel-luke/grainlab:1.0.0 + imagePullPolicy: Always + + ports: + - containerPort: 3000 + env: + - name: NODE_ENV + value: "production" + - name: PORT + value: "3000" + - name: HOST + value: "0.0.0.0" + envFrom: + - secretRef: + name: grainlab-app + - secretRef: + name: grainlab-database + - secretRef: + name: grainlab-s3 + readinessProbe: + httpGet: + path: / + port: 3000 + initialDelaySeconds: 10 + periodSeconds: 5 + failureThreshold: 6 + livenessProbe: + httpGet: + path: / + port: 3000 + initialDelaySeconds: 30 + periodSeconds: 10 + resources: + requests: + cpu: 100m + memory: 256Mi + limits: + memory: 512Mi diff --git a/manifests/artemis/grainlab-production/app-ingress.yaml b/manifests/artemis/grainlab-production/app-ingress.yaml new file mode 100644 index 0000000..1b79052 --- /dev/null +++ b/manifests/artemis/grainlab-production/app-ingress.yaml @@ -0,0 +1,25 @@ +--- +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: grainlab + namespace: grainlab-production + annotations: + cert-manager.io/cluster-issuer: letsencrypt +spec: + rules: + - host: www.grainlab.app + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: grainlab + port: + number: 80 + tls: + - hosts: + - www.grainlab.app + - grainlab.app + secretName: letsencrypt diff --git a/manifests/artemis/grainlab-production/app-service.yaml b/manifests/artemis/grainlab-production/app-service.yaml new file mode 100644 index 0000000..568209e --- /dev/null +++ b/manifests/artemis/grainlab-production/app-service.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: Service +metadata: + name: grainlab + namespace: grainlab-production +spec: + selector: + app: grainlab + ports: + - port: 80 + targetPort: 3000 diff --git a/manifests/artemis/grainlab-production/namespace.yaml b/manifests/artemis/grainlab-production/namespace.yaml new file mode 100644 index 0000000..d7acb0d --- /dev/null +++ b/manifests/artemis/grainlab-production/namespace.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: grainlab-production diff --git a/manifests/artemis/grainlab-production/postgres-cluster.yaml b/manifests/artemis/grainlab-production/postgres-cluster.yaml new file mode 100644 index 0000000..82a42ce --- /dev/null +++ b/manifests/artemis/grainlab-production/postgres-cluster.yaml @@ -0,0 +1,24 @@ +apiVersion: postgresql.cnpg.io/v1 +kind: Cluster +metadata: + name: grainlab-db + namespace: grainlab-production +spec: + instances: 1 + + bootstrap: + initdb: + database: grainlab + owner: grainlab + secret: + name: grainlab-db-credentials + + storage: + size: 10Gi + + resources: + requests: + cpu: 100m + memory: 256Mi + limits: + memory: 512Mi diff --git a/manifests/artemis/grainlab-production/www-redirect.yaml b/manifests/artemis/grainlab-production/www-redirect.yaml new file mode 100644 index 0000000..e87a582 --- /dev/null +++ b/manifests/artemis/grainlab-production/www-redirect.yaml @@ -0,0 +1,26 @@ +--- +apiVersion: traefik.io/v1alpha1 +kind: IngressRoute +metadata: + name: www-redirect +spec: + entryPoints: + - websecure + routes: + - kind: Rule + match: Host(`grainlab.app`) + middlewares: + - name: redirect-to-www + services: + - kind: TraefikService + name: noop@internal +--- +apiVersion: traefik.io/v1alpha1 +kind: Middleware +metadata: + name: redirect-to-www +spec: + redirectRegex: + permanent: true + regex: "^https?://(?:www\\.)?(.+)" + replacement: "https://www.${1}"