diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b493792..f1da660 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,15 +1,9 @@ name: build-and-deploy-prod on: - workflow_dispatch: - inputs: - job_id: - description: 'The unique ID for tracking' - required: true + push: branches: - master - -run-name: build-and-deploy-prod:${{ inputs.job_id }} jobs: docker: runs-on: ubuntu-latest diff --git a/.k8s/base/cert-manager-issuer.yml b/.k8s/base/cert-manager-issuer.yml deleted file mode 100644 index 72463f3..0000000 --- a/.k8s/base/cert-manager-issuer.yml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: cert-manager.io/v1 -kind: Issuer -metadata: - name: letsencrypt-louper -spec: - acme: - email: ezynda@mark3labs.com - server: https://acme-v02.api.letsencrypt.org/directory - privateKeySecretRef: - name: letsencrypt-louper-private-key - solvers: - # Use the HTTP-01 challenge provider - - http01: - ingress: - class: nginx diff --git a/.k8s/base/deployment.yml b/.k8s/base/deployment.yml deleted file mode 100644 index b3f5cdd..0000000 --- a/.k8s/base/deployment.yml +++ /dev/null @@ -1,41 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: louper-deployment - labels: - app: louper -spec: - replicas: 1 - selector: - matchLabels: - app: louper - template: - metadata: - labels: - app: louper - spec: - containers: - - name: louper-container - image: mark3labs/louper-web:latest - ports: - - name: http - containerPort: 3000 - volumeMounts: - - mountPath: '/app/data' - name: volume - imagePullPolicy: Always - volumes: - - name: volume - persistentVolumeClaim: - claimName: louper-db ---- -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - name: louper-db -spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 1Gi diff --git a/.k8s/base/ingress.yml b/.k8s/base/ingress.yml deleted file mode 100644 index cf36284..0000000 --- a/.k8s/base/ingress.yml +++ /dev/null @@ -1,24 +0,0 @@ -apiVersion: networking.k8s.io/v1 -kind: Ingress -metadata: - name: louper-ingress - annotations: - cert-manager.io/issuer: letsencrypt-louper - nginx.ingress.kubernetes.io/enable-cors: 'true' -spec: - tls: - - hosts: - - louper.dev - secretName: letsencrypt-louper - rules: - - host: louper.dev - http: - paths: - - path: / - pathType: Prefix - backend: - service: - name: louper-service - port: - number: 3000 - ingressClassName: nginx diff --git a/.k8s/base/kustomization.yml b/.k8s/base/kustomization.yml deleted file mode 100644 index 4bf4610..0000000 --- a/.k8s/base/kustomization.yml +++ /dev/null @@ -1,8 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization - -resources: - - deployment.yml - - service.yml - - ingress.yml - - cert-manager-issuer.yml diff --git a/.k8s/base/service.yml b/.k8s/base/service.yml deleted file mode 100644 index 4d3d7eb..0000000 --- a/.k8s/base/service.yml +++ /dev/null @@ -1,13 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: louper-service -spec: - type: ClusterIP - ports: - - name: http - port: 80 - targetPort: 3000 - protocol: TCP - selector: - app: louper diff --git a/.k8s/prod/application.yml b/.k8s/prod/application.yml deleted file mode 100644 index c4822ae..0000000 --- a/.k8s/prod/application.yml +++ /dev/null @@ -1,22 +0,0 @@ -apiVersion: argoproj.io/v1alpha1 -kind: Application -metadata: - name: louper - namespace: argocd - annotations: - argocd-image-updater.argoproj.io/image-list: louper=mark3labs/louper-web:latest - argocd-image-updater.argoproj.io/louper.update-strategy: digest - finalizers: - - resources-finalizer.argocd.argoproj.io -spec: - project: default - source: - repoURL: 'https://github.com/mark3labs/louper-v3.git' - path: .k8s/prod - targetRevision: master - destination: - server: 'https://kubernetes.default.svc' - syncPolicy: - automated: - prune: true - selfHeal: true diff --git a/.k8s/prod/jobs.yml b/.k8s/prod/jobs.yml deleted file mode 100644 index 9a2bdc6..0000000 --- a/.k8s/prod/jobs.yml +++ /dev/null @@ -1,40 +0,0 @@ -apiVersion: batch/v1 -kind: Job -metadata: - name: github-ci - generatedName: build-image-and-push- - annotations: - argocd.argoproj.io/hook: PreSync - argocd.argoproj.io/hook-delete-policy: HookSucceeded -spec: - template: - spec: - containers: - - name: github-ci - image: pkgxdev/pkgx:latest - imagePullPolicy: Always - env: - - name: GITHUB_TOKEN - valueFrom: - secretKeyRef: - name: gh - key: token - command: - - /bin/bash - - -c - - | - apt update && apt install -y ca-certificates - pkgx install gh - pkgx install jq - pkgx install uuidgen - gh auth login - export JOB_ID=$(uuidgen) - echo "{\"job_id\": \"$JOB_ID\" }" | gh workflow run build-and-deploy-prod --repo mark3labs/louper-v3 --ref dev --json - STATUS="starting" - while [[ "$STATUS" != "completed" && "$STATUS" != "failure" ]] - do - STATUS=$(gh run list --workflow=build-and-deploy-prod --repo mark3labs/louper-v3 --json "status,name" | jq --arg i "build-and-deploy-prod:$JOB_ID" '.[] | select(.name == $i)' | jq -r '.status') - echo "Job Status: $STATUS" - sleep 1 - done - restartPolicy: Never diff --git a/.k8s/prod/kustomization.yml b/.k8s/prod/kustomization.yml deleted file mode 100644 index 099e6d8..0000000 --- a/.k8s/prod/kustomization.yml +++ /dev/null @@ -1,16 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization - -resources: - - ../base - - namespace.yml - - application.yml - - jobs.yml -transformers: - - |- - apiVersion: builtin - kind: NamespaceTransformer - metadata: - name: nsTransform - namespace: louper - unsetOnly: true diff --git a/.k8s/prod/namespace.yml b/.k8s/prod/namespace.yml deleted file mode 100644 index 2762d84..0000000 --- a/.k8s/prod/namespace.yml +++ /dev/null @@ -1,4 +0,0 @@ -apiVersion: v1 -kind: Namespace -metadata: - name: louper diff --git a/.k8s/staging/application.yml b/.k8s/staging/application.yml deleted file mode 100644 index 007127b..0000000 --- a/.k8s/staging/application.yml +++ /dev/null @@ -1,24 +0,0 @@ -apiVersion: argoproj.io/v1alpha1 -kind: Application -metadata: - name: louper - namespace: argocd - annotations: - argocd-image-updater.argoproj.io/image-list: louper=mark3labs/louper-web:staging-latest - argocd-image-updater.argoproj.io/louper.update-strategy: digest - finalizers: - - resources-finalizer.argocd.argoproj.io -spec: - project: default - source: - repoURL: 'https://github.com/mark3labs/louper-v3.git' - path: .k8s/staging - targetRevision: dev - destination: - server: 'https://kubernetes.default.svc' - syncPolicy: - automated: - prune: true - selfHeal: true - syncOptions: - - ApplyOutOfSyncOnly=true diff --git a/.k8s/staging/deployment-patch.yml b/.k8s/staging/deployment-patch.yml deleted file mode 100644 index a5b524c..0000000 --- a/.k8s/staging/deployment-patch.yml +++ /dev/null @@ -1,43 +0,0 @@ -# apiVersion: apps/v1 -# kind: Deployment -# metadata: -# name: louper-deployment -# namespace: louper -# labels: -# app: louper -# spec: -# replicas: 1 -# selector: -# matchLabels: -# app: louper -# template: -# metadata: -# labels: -# app: louper -# spec: -# containers: -# - name: louper-container-staging -# image: mark3labs/louper-web:latest -# volumeMounts: -# - mountPath: '/app/data' -# name: volume -# imagePullPolicy: Always -# volumes: -# - name: volume -# persistentVolumeClaim: -# claimName: louper-db -# --- -# apiVersion: v1 -# kind: PersistentVolumeClaim -# metadata: -# namespace: louper -# name: louper-db -# spec: -# accessModes: -# - ReadWriteOnce -# resources: -# requests: -# storage: 1Gi -- op: replace - path: /spec/template/spec/containers/0/image - value: mark3labs/louper-web:staging-latest diff --git a/.k8s/staging/ingress-patch.yml b/.k8s/staging/ingress-patch.yml deleted file mode 100644 index 45977f4..0000000 --- a/.k8s/staging/ingress-patch.yml +++ /dev/null @@ -1,35 +0,0 @@ -# apiVersion: networking.k8s.io/v1 -# kind: Ingress -# metadata: -# name: louper-ingress -# annotations: -# cert-manager.io/issuer: letsencrypt-louper -# spec: -# tls: -# - hosts: -# - louper.dev -# secretName: letsencrypt-louper -# rules: -# - host: louper.dev -# http: -# paths: -# - path: / -# pathType: Prefix -# backend: -# service: -# name: louper-service -# port: -# number: 3000 -# ingressClassName: nginx -- op: replace - path: /spec/rules/0/host - value: staging.louper.dev -- op: replace - path: /spec/rules/0/http/paths/0/backend/service/name - value: louper-service-staging -- op: replace - path: '/metadata/annotations/cert-manager.io~1issuer' - value: letsencrypt-louper-staging -- op: replace - path: /spec/tls/0/hosts/0 - value: staging.louper.dev diff --git a/.k8s/staging/jobs.yml b/.k8s/staging/jobs.yml deleted file mode 100644 index 0003496..0000000 --- a/.k8s/staging/jobs.yml +++ /dev/null @@ -1,40 +0,0 @@ -apiVersion: batch/v1 -kind: Job -metadata: - name: github-ci - generatedName: build-image-and-push- - annotations: - argocd.argoproj.io/hook: PreSync - argocd.argoproj.io/hook-delete-policy: HookSucceeded -spec: - template: - spec: - containers: - - name: github-ci - image: pkgxdev/pkgx:latest - imagePullPolicy: Always - env: - - name: GITHUB_TOKEN - valueFrom: - secretKeyRef: - name: gh - key: token - command: - - /bin/bash - - -c - - | - apt update && apt install -y ca-certificates - pkgx install gh - pkgx install jq - pkgx install uuidgen - gh auth login - export JOB_ID=$(uuidgen) - echo "{\"job_id\": \"$JOB_ID\" }" | gh workflow run build-and-deploy-staging --repo mark3labs/louper-v3 --ref dev --json - STATUS="starting" - while [[ "$STATUS" != "completed" && "$STATUS" != "failure" ]] - do - STATUS=$(gh run list --workflow=build-and-deploy-staging --repo mark3labs/louper-v3 --json "status,name" | jq --arg i "build-and-deploy-staging:$JOB_ID" '.[] | select(.name == $i)' | jq -r '.status') - echo "Job Status: $STATUS" - sleep 1 - done - restartPolicy: Never diff --git a/.k8s/staging/kustomization.yml b/.k8s/staging/kustomization.yml deleted file mode 100644 index eead715..0000000 --- a/.k8s/staging/kustomization.yml +++ /dev/null @@ -1,28 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization - -resources: - - ../base - - namespace.yml - - application.yml - - jobs.yml -patches: - - target: - kind: Deployment - name: louper-deployment - path: deployment-patch.yml - - target: - kind: Ingress - name: louper-ingress - path: ingress-patch.yml -transformers: - - |- - apiVersion: builtin - kind: NamespaceTransformer - metadata: - name: nsTransform - namespace: louper-staging - unsetOnly: true -nameSuffix: -staging -commonLabels: - app: louper-staging diff --git a/.k8s/staging/namespace.yml b/.k8s/staging/namespace.yml deleted file mode 100644 index 74c2a7d..0000000 --- a/.k8s/staging/namespace.yml +++ /dev/null @@ -1,4 +0,0 @@ -apiVersion: v1 -kind: Namespace -metadata: - name: louper-staging