From 3073758327f8c2bcfdcbc01b30e52deefd6e3707 Mon Sep 17 00:00:00 2001 From: Jon Date: Tue, 26 May 2026 17:49:45 +0930 Subject: [PATCH 1/9] feat: Add Centurion ERP base ref: #22 #1 --- .../centurion_erp/base/Deployment-api.yaml | 125 ++++++++++++++++++ .../centurion_erp/base/Deployment-worker.yaml | 99 ++++++++++++++ .../centurion_erp/base/PVC-centurion.yaml | 15 +++ manifests/centurion_erp/base/Service-api.yaml | 22 +++ manifests/centurion_erp/base/celery-broker.py | 2 + manifests/centurion_erp/base/csrf.py | 14 ++ manifests/centurion_erp/base/database.py | 11 ++ .../centurion_erp/base/kustomization.yaml | 52 ++++++++ manifests/centurion_erp/base/secret_key.py | 2 + manifests/centurion_erp/base/settings.py | 25 ++++ manifests/centurion_erp/base/ui-redirect.py | 2 + 11 files changed, 369 insertions(+) create mode 100644 manifests/centurion_erp/base/Deployment-api.yaml create mode 100644 manifests/centurion_erp/base/Deployment-worker.yaml create mode 100644 manifests/centurion_erp/base/PVC-centurion.yaml create mode 100644 manifests/centurion_erp/base/Service-api.yaml create mode 100644 manifests/centurion_erp/base/celery-broker.py create mode 100644 manifests/centurion_erp/base/csrf.py create mode 100644 manifests/centurion_erp/base/database.py create mode 100644 manifests/centurion_erp/base/kustomization.yaml create mode 100644 manifests/centurion_erp/base/secret_key.py create mode 100644 manifests/centurion_erp/base/settings.py create mode 100644 manifests/centurion_erp/base/ui-redirect.py diff --git a/manifests/centurion_erp/base/Deployment-api.yaml b/manifests/centurion_erp/base/Deployment-api.yaml new file mode 100644 index 0000000..124faa5 --- /dev/null +++ b/manifests/centurion_erp/base/Deployment-api.yaml @@ -0,0 +1,125 @@ +--- + +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app.kubernetes.io/name: centurion + app.kubernetes.io/part-of: centurion-erp + name: api +spec: + selector: + matchLabels: + app.kubernetes.io/name: centurion + app.kubernetes.io/part-of: centurion-erp + replicas: 1 + minReadySeconds: 10 + template: + metadata: + labels: + app.kubernetes.io/name: centurion + app.kubernetes.io/part-of: centurion-erp + spec: + terminationGracePeriodSeconds: 10 + affinity: {} + containers: + + - name: web + image: nofusscomputing/centurion-erp:dev + env: + - name: PROMETHEUS_MULTIPROC_DIR + value: '/tmp/prometheus' + resources: + limits: + cpu: 1 + memory: 2Gi + requests: + cpu: 400m + memory: 800Mi + + ports: + - containerPort: 8000 + name: api + - containerPort: 8080 + name: metrics + + volumeMounts: + + - name: celery-broker + mountPath: /etc/itsm/celery-broker.py + subPath: celery-broker.py + readOnly: true + + - name: configuration + mountPath: /etc/itsm + readOnly: true + + - name: data + mountPath: /data + subPath: data + + - name: database + mountPath: /etc/itsm/database.py + subPath: database.py + readOnly: true + + - mountPath: /var/log + name: logs + + - mountPath: /tmp + name: tmp + subPath: tmp + + + - name: ui + image: nofusscomputing/centurion-erp-ui:dev + env: [] + resources: + limits: + cpu: 500m + memory: 256Mi + requests: + cpu: 10m + memory: 20Mi + + ports: + - containerPort: 80 + name: ui + + volumeMounts: [] + + priorityClassName: cluster-low + tolerations: [] + volumes: + + - name: celery-broker + secret: + secretName: celery-broker + items: + - key: celery-broker.py + path: celery-broker.py + + - name: configuration + configMap: + name: configuration + + - name: data + persistentVolumeClaim: + claimName: centurion + + - name: database + secret: + secretName: database + items: + - key: database.py + path: database.py + + - name: logs + hostPath: + path: /opt/logs/centurion-api + type: DirectoryOrCreate + + - name: tmp + emptyDir: + medium: Memory + # sizeLimit: 64Mi diff --git a/manifests/centurion_erp/base/Deployment-worker.yaml b/manifests/centurion_erp/base/Deployment-worker.yaml new file mode 100644 index 0000000..20c8f34 --- /dev/null +++ b/manifests/centurion_erp/base/Deployment-worker.yaml @@ -0,0 +1,99 @@ +--- + +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app.kubernetes.io/name: worker + app.kubernetes.io/part-of: centurion-erp + name: worker +spec: + selector: + matchLabels: + app.kubernetes.io/name: worker + app.kubernetes.io/part-of: centurion-erp + replicas: 1 + minReadySeconds: 10 + template: + metadata: + labels: + app.kubernetes.io/name: worker + app.kubernetes.io/part-of: centurion-erp + spec: + terminationGracePeriodSeconds: 10 + affinity: {} + containers: + - name: worker + image: nofusscomputing/centurion-erp:dev + env: + - name: IS_WORKER + value: "true" + resources: + limits: + cpu: 800m + memory: 200Mi + requests: + cpu: 10m + memory: 20Mi + + ports: + - containerPort: 8080 + name: metrics + + volumeMounts: + + - name: celery-broker + mountPath: /etc/itsm/celery-broker.py + subPath: celery-broker.py + readOnly: true + + - name: configuration + mountPath: /etc/itsm/settings.py + subPath: settings.py + readOnly: true + + - name: database + mountPath: /etc/itsm/database.py + subPath: database.py + readOnly: true + + - mountPath: /var/log + name: logs + + - mountPath: /tmp + name: tmp + subPath: tmp + + tolerations: [] + volumes: + + - name: celery-broker + secret: + secretName: celery-broker + items: + - key: celery-broker.py + path: celery-broker.py + + - name: configuration + configMap: + name: configuration + items: + - key: settings.py + path: settings.py + + - name: database + secret: + secretName: database + items: + - key: database.py + path: database.py + + - name: logs + hostPath: + path: /opt/logs/centurion-worker + type: DirectoryOrCreate + + - name: tmp + emptyDir: + medium: Memory + # sizeLimit: 64Mi diff --git a/manifests/centurion_erp/base/PVC-centurion.yaml b/manifests/centurion_erp/base/PVC-centurion.yaml new file mode 100644 index 0000000..6efbc7b --- /dev/null +++ b/manifests/centurion_erp/base/PVC-centurion.yaml @@ -0,0 +1,15 @@ +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + labels: + app.kubernetes.io/name: centurion + app.kubernetes.io/part-of: centurion-erp + name: centurion +spec: + volumeMode: Filesystem + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 5Gi diff --git a/manifests/centurion_erp/base/Service-api.yaml b/manifests/centurion_erp/base/Service-api.yaml new file mode 100644 index 0000000..5737ae1 --- /dev/null +++ b/manifests/centurion_erp/base/Service-api.yaml @@ -0,0 +1,22 @@ +--- +apiVersion: v1 +kind: Service +metadata: + name: api + labels: + app.kubernetes.io/name: centurion + app.kubernetes.io/part-of: centurion-erp +spec: + selector: + app.kubernetes.io/name: centurion + app.kubernetes.io/part-of: centurion-erp + ports: + - name: api + port: 8000 + targetPort: api + - name: metrics + port: 8080 + targetPort: metrics + - name: ui + port: 80 + targetPort: ui diff --git a/manifests/centurion_erp/base/celery-broker.py b/manifests/centurion_erp/base/celery-broker.py new file mode 100644 index 0000000..0974739 --- /dev/null +++ b/manifests/centurion_erp/base/celery-broker.py @@ -0,0 +1,2 @@ +# amqp://:@/ +CELERY_BROKER_URL = '' diff --git a/manifests/centurion_erp/base/csrf.py b/manifests/centurion_erp/base/csrf.py new file mode 100644 index 0000000..7aa4176 --- /dev/null +++ b/manifests/centurion_erp/base/csrf.py @@ -0,0 +1,14 @@ +SITE_URL = 'https://' + +TRUSTED_ORIGINS = [ + 'https://', + 'https://', +] + +# SSL +SECURE_SSL_HOST = '' +SECURE_SSL_REDIRECT = True +SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https") + +USE_X_FORWARDED_HOST = True +SESSION_COOKIE_SECURE = True diff --git a/manifests/centurion_erp/base/database.py b/manifests/centurion_erp/base/database.py new file mode 100644 index 0000000..4720e13 --- /dev/null +++ b/manifests/centurion_erp/base/database.py @@ -0,0 +1,11 @@ +DATABASES = { + 'default': { + 'ENGINE': 'django_prometheus.db.backends.postgresql', + 'NAME': 'centurion', # Database name + 'USER': '', # PostgreSQL username + 'PASSWORD': '', # PostgreSQL password + 'HOST': '', # Database server + 'PORT': '', # Database port (leave blank for default) + 'CONN_MAX_AGE': 300, # Max database connection age + } +} diff --git a/manifests/centurion_erp/base/kustomization.yaml b/manifests/centurion_erp/base/kustomization.yaml new file mode 100644 index 0000000..772011f --- /dev/null +++ b/manifests/centurion_erp/base/kustomization.yaml @@ -0,0 +1,52 @@ +--- +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +configMapGenerator: + - name: configuration + files: + - csrf.py + - settings.py + - ui-redirect.py + +generatorOptions: + disableNameSuffixHash: true + +# patches: +# - patch: |- +# apiVersion: apps/v1 +# kind: Deployment +# metadata: +# name: api +# spec: +# template: +# spec: +# containers: +# - name: ui +# env: +# - name: API_URL +# value: https:///api/v2 + +# target: +# kind: Deployment +# name: api +# version: v1 + +resources: + - PVC-centurion.yaml + - Deployment-api.yaml + - Deployment-worker.yaml + - Service-api.yaml + +secretGenerator: + - name: secret_key + files: + - secret_key.py + + - name: celery-broker + files: + - celery-broker.py + + - name: database + files: + - database.py diff --git a/manifests/centurion_erp/base/secret_key.py b/manifests/centurion_erp/base/secret_key.py new file mode 100644 index 0000000..5444868 --- /dev/null +++ b/manifests/centurion_erp/base/secret_key.py @@ -0,0 +1,2 @@ +# Add your secret key here +SECRET_KEY = '' diff --git a/manifests/centurion_erp/base/settings.py b/manifests/centurion_erp/base/settings.py new file mode 100644 index 0000000..20264b7 --- /dev/null +++ b/manifests/centurion_erp/base/settings.py @@ -0,0 +1,25 @@ +DEBUG = False + +# FEATURE_FLAG_OVERRIDES = [ +# {'disable_downloading': False}, +# ] + +METRICS_ENABLED = True +# PROMETHEUS_EXPORT_MIGRATIONS = True + +AUTH_PASSWORD_VALIDATORS = [] + +SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https") +SECURE_SSL_REDIRECT = True + +USE_X_FORWARDED_HOST = True + +LOG_FILES = { + "catch_all":"/var/log/catch-all.log", + "centurion_trace": "/var/log/trace.log", + "centurion": "/var/log/centurion.log", + "error": "/var/log/error.log", + "gunicorn": "/var/log/gunicorn.log", + "rest_api": "/var/log/rest_api.log", + "weblog": "/var/log/weblog.log", +} diff --git a/manifests/centurion_erp/base/ui-redirect.py b/manifests/centurion_erp/base/ui-redirect.py new file mode 100644 index 0000000..0aacb64 --- /dev/null +++ b/manifests/centurion_erp/base/ui-redirect.py @@ -0,0 +1,2 @@ +LOGIN_REDIRECT_URL = "/" +LOGOUT_REDIRECT_URL = "login" \ No newline at end of file From dc207da8023528cd9f37e1bb71d5b14117f49ffe Mon Sep 17 00:00:00 2001 From: Jon Date: Tue, 26 May 2026 18:07:37 +0930 Subject: [PATCH 2/9] feat(centurion_erp): Add Keycloak SSO component ref: #22 #1 --- .../sso-keycloak/kustomization.yaml | 40 +++++++++++++++++++ .../sso-keycloak/social_auth_keycloak.py | 15 +++++++ 2 files changed, 55 insertions(+) create mode 100644 manifests/centurion_erp/components/sso-keycloak/kustomization.yaml create mode 100644 manifests/centurion_erp/components/sso-keycloak/social_auth_keycloak.py diff --git a/manifests/centurion_erp/components/sso-keycloak/kustomization.yaml b/manifests/centurion_erp/components/sso-keycloak/kustomization.yaml new file mode 100644 index 0000000..4b8963a --- /dev/null +++ b/manifests/centurion_erp/components/sso-keycloak/kustomization.yaml @@ -0,0 +1,40 @@ +--- + +apiVersion: kustomize.config.k8s.io/v1alpha1 +kind: Component + +generatorOptions: + disableNameSuffixHash: true + +namespace: centurion + +secretGenerator: + - name: social_auth_keycloak + files: + - social_auth_keycloak.py + +patches: + + - patch: |- + - op: add + path: /spec/template/spec/containers/0/volumeMounts/- + value: + name: social-auth-keycloak + mountPath: /etc/itsm/social_auth_keycloak.py + subPath: social_auth_keycloak.py + readOnly: true + + - op: add + path: /spec/template/spec/volumes/- + value: + name: social-auth-keycloak + configMap: + name: social-auth-keycloak + items: + - key: social_auth_keycloak.py + path: social_auth_keycloak.py + + target: + kind: Deployment + name: api + version: v1 diff --git a/manifests/centurion_erp/components/sso-keycloak/social_auth_keycloak.py b/manifests/centurion_erp/components/sso-keycloak/social_auth_keycloak.py new file mode 100644 index 0000000..999e9d8 --- /dev/null +++ b/manifests/centurion_erp/components/sso-keycloak/social_auth_keycloak.py @@ -0,0 +1,15 @@ +LOGIN_URL = '/sso/login/keycloak/' +LOGOUT_REDIRECT_URL = "/sso/login/keycloak/" + +SOCIAL_AUTH_KEYCLOAK_KEY = '' # Keycloak oidc id +SOCIAL_AUTH_KEYCLOAK_SECRET = '' # oidc secret key +SOCIAL_AUTH_KEYCLOAK_PUBLIC_KEY = '' # public key +SOCIAL_AUTH_KEYCLOAK_AUTHORIZATION_URL = 'https:///realms//protocol/openid-connect/auth' +SOCIAL_AUTH_KEYCLOAK_ACCESS_TOKEN_URL = 'https:///realms//protocol/openid-connect/token' + +SSO_ENABLED = True + +SSO_BACKENDS = ( + "social_core.backends.keycloak.KeycloakOAuth2", + # "social_core.backends.open_id_connect.OpenIdConnectAuth", +) From 20b204680f2c469320ab3df559a2d6af65726176 Mon Sep 17 00:00:00 2001 From: Jon Date: Tue, 26 May 2026 18:08:37 +0930 Subject: [PATCH 3/9] feat(centurion_erp): Add Service Monitor component ref: #22 #1 --- .../service-monitor/Service-worker.yaml | 17 +++++++++++++++ .../service-monitor/ServiceMonitor-api.yaml | 20 ++++++++++++++++++ .../ServiceMonitor-worker.yaml | 21 +++++++++++++++++++ .../service-monitor/kustomization.yaml | 8 +++++++ 4 files changed, 66 insertions(+) create mode 100644 manifests/centurion_erp/components/service-monitor/Service-worker.yaml create mode 100644 manifests/centurion_erp/components/service-monitor/ServiceMonitor-api.yaml create mode 100644 manifests/centurion_erp/components/service-monitor/ServiceMonitor-worker.yaml create mode 100644 manifests/centurion_erp/components/service-monitor/kustomization.yaml diff --git a/manifests/centurion_erp/components/service-monitor/Service-worker.yaml b/manifests/centurion_erp/components/service-monitor/Service-worker.yaml new file mode 100644 index 0000000..5ea3f71 --- /dev/null +++ b/manifests/centurion_erp/components/service-monitor/Service-worker.yaml @@ -0,0 +1,17 @@ +--- +apiVersion: v1 +kind: Service +metadata: + labels: + app.kubernetes.io/component: service-monitor + app.kubernetes.io/name: worker + app.kubernetes.io/part-of: centurion-erp + name: worker +spec: + selector: + app.kubernetes.io/name: worker + app.kubernetes.io/part-of: centurion-erp + ports: + - name: metrics + port: 8080 + targetPort: metrics diff --git a/manifests/centurion_erp/components/service-monitor/ServiceMonitor-api.yaml b/manifests/centurion_erp/components/service-monitor/ServiceMonitor-api.yaml new file mode 100644 index 0000000..3233eb6 --- /dev/null +++ b/manifests/centurion_erp/components/service-monitor/ServiceMonitor-api.yaml @@ -0,0 +1,20 @@ +--- +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + labels: + app.kubernetes.io/component: service-monitor + app.kubernetes.io/name: centurion + app.kubernetes.io/part-of: centurion-erp + name: api +spec: + endpoints: + - interval: 30s + port: metrics + relabelings: + - targetLabel: "job" + replacement: "django" + selector: + matchLabels: + app.kubernetes.io/name: centurion + app.kubernetes.io/part-of: centurion-erp diff --git a/manifests/centurion_erp/components/service-monitor/ServiceMonitor-worker.yaml b/manifests/centurion_erp/components/service-monitor/ServiceMonitor-worker.yaml new file mode 100644 index 0000000..db35148 --- /dev/null +++ b/manifests/centurion_erp/components/service-monitor/ServiceMonitor-worker.yaml @@ -0,0 +1,21 @@ +--- +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + labels: + app.kubernetes.io/component: service-monitor + app.kubernetes.io/name: worker + app.kubernetes.io/part-of: centurion-erp + name: worker +spec: + endpoints: + - interval: 30s + port: metrics + relabelings: + - targetLabel: "job" + replacement: "django" + selector: + matchLabels: + app.kubernetes.io/component: service-monitor + app.kubernetes.io/name: worker + app.kubernetes.io/part-of: centurion-erp diff --git a/manifests/centurion_erp/components/service-monitor/kustomization.yaml b/manifests/centurion_erp/components/service-monitor/kustomization.yaml new file mode 100644 index 0000000..097108c --- /dev/null +++ b/manifests/centurion_erp/components/service-monitor/kustomization.yaml @@ -0,0 +1,8 @@ +--- +apiVersion: kustomize.config.k8s.io/v1alpha1 +kind: Component + +resources: + - Service-worker.yaml + - ServiceMonitor-api.yaml + - ServiceMonitor-worker.yaml From 5f43f2db3b5d590f39b3b4cd06a2982a30fede84 Mon Sep 17 00:00:00 2001 From: Jon Date: Tue, 26 May 2026 18:41:05 +0930 Subject: [PATCH 4/9] feat(centurion_erp): Add RabbitMQ Setup component ref: #22 #1 --- .../RabbitMQ-Permission-Centurion.yaml | 20 +++++++++++++++++ .../RabbitMQ-Queue-Centurion.yaml | 18 +++++++++++++++ .../RabbitMQ-User-Centurion.yaml | 17 ++++++++++++++ .../RabbitMQ-VHost-Centurion.yaml | 15 +++++++++++++ .../rabbitmq-setup/kustomization.yaml | 22 +++++++++++++++++++ .../rabbitmq-setup/user-centurion.env | 2 ++ 6 files changed, 94 insertions(+) create mode 100644 manifests/centurion_erp/components/rabbitmq-setup/RabbitMQ-Permission-Centurion.yaml create mode 100644 manifests/centurion_erp/components/rabbitmq-setup/RabbitMQ-Queue-Centurion.yaml create mode 100644 manifests/centurion_erp/components/rabbitmq-setup/RabbitMQ-User-Centurion.yaml create mode 100644 manifests/centurion_erp/components/rabbitmq-setup/RabbitMQ-VHost-Centurion.yaml create mode 100644 manifests/centurion_erp/components/rabbitmq-setup/kustomization.yaml create mode 100644 manifests/centurion_erp/components/rabbitmq-setup/user-centurion.env diff --git a/manifests/centurion_erp/components/rabbitmq-setup/RabbitMQ-Permission-Centurion.yaml b/manifests/centurion_erp/components/rabbitmq-setup/RabbitMQ-Permission-Centurion.yaml new file mode 100644 index 0000000..5238b80 --- /dev/null +++ b/manifests/centurion_erp/components/rabbitmq-setup/RabbitMQ-Permission-Centurion.yaml @@ -0,0 +1,20 @@ +--- + +apiVersion: rabbitmq.com/v1beta1 +kind: Permission +metadata: + labels: + app.kubernetes.io/component: message-queuing + app.kubernetes.io/name: rabbitmq + app.kubernetes.io/part-of: centurion-erp + name: permission-centurion +spec: + vhost: "centurion" + user: "centurion" + permissions: + write: ".*" + configure: ".*" + read: ".*" + rabbitmqClusterReference: + name: main + namespace: rabbitmq diff --git a/manifests/centurion_erp/components/rabbitmq-setup/RabbitMQ-Queue-Centurion.yaml b/manifests/centurion_erp/components/rabbitmq-setup/RabbitMQ-Queue-Centurion.yaml new file mode 100644 index 0000000..0b9eb20 --- /dev/null +++ b/manifests/centurion_erp/components/rabbitmq-setup/RabbitMQ-Queue-Centurion.yaml @@ -0,0 +1,18 @@ +--- + +apiVersion: rabbitmq.com/v1beta1 +kind: Queue +metadata: + labels: + app.kubernetes.io/component: message-queuing + app.kubernetes.io/name: rabbitmq + app.kubernetes.io/part-of: centurion-erp + name: queue-centurion +spec: + name: centurion + autoDelete: false + durable: true + rabbitmqClusterReference: + name: main + namespace: rabbitmq + vhost: centurion diff --git a/manifests/centurion_erp/components/rabbitmq-setup/RabbitMQ-User-Centurion.yaml b/manifests/centurion_erp/components/rabbitmq-setup/RabbitMQ-User-Centurion.yaml new file mode 100644 index 0000000..1dde7b7 --- /dev/null +++ b/manifests/centurion_erp/components/rabbitmq-setup/RabbitMQ-User-Centurion.yaml @@ -0,0 +1,17 @@ +--- +apiVersion: rabbitmq.com/v1beta1 +kind: User +metadata: + labels: + app.kubernetes.io/component: message-queuing + app.kubernetes.io/name: rabbitmq + app.kubernetes.io/part-of: centurion-erp + name: centurion +spec: + importCredentialsSecret: + name: user-centurion + tags: + - policymaker + rabbitmqClusterReference: + name: main + namespace: rabbitmq diff --git a/manifests/centurion_erp/components/rabbitmq-setup/RabbitMQ-VHost-Centurion.yaml b/manifests/centurion_erp/components/rabbitmq-setup/RabbitMQ-VHost-Centurion.yaml new file mode 100644 index 0000000..cedf6b6 --- /dev/null +++ b/manifests/centurion_erp/components/rabbitmq-setup/RabbitMQ-VHost-Centurion.yaml @@ -0,0 +1,15 @@ +--- + +apiVersion: rabbitmq.com/v1beta1 +kind: Vhost +metadata: + labels: + app.kubernetes.io/component: message-queuing + app.kubernetes.io/name: rabbitmq + app.kubernetes.io/part-of: centurion-erp + name: vhost-centurion +spec: + name: centurion + rabbitmqClusterReference: + name: main + namespace: rabbitmq diff --git a/manifests/centurion_erp/components/rabbitmq-setup/kustomization.yaml b/manifests/centurion_erp/components/rabbitmq-setup/kustomization.yaml new file mode 100644 index 0000000..d44362d --- /dev/null +++ b/manifests/centurion_erp/components/rabbitmq-setup/kustomization.yaml @@ -0,0 +1,22 @@ +--- +apiVersion: kustomize.config.k8s.io/v1alpha1 +kind: Component + +generatorOptions: + disableNameSuffixHash: true + +resources: + - RabbitMQ-Permission-Centurion.yaml + - RabbitMQ-Queue-Centurion.yaml + - RabbitMQ-User-Centurion.yaml + - RabbitMQ-VHost-Centurion.yaml + +secretGenerator: + - name: user-centurion + options: + labels: + app.kubernetes.io/component: message-queuing + app.kubernetes.io/name: rabbitmq + app.kubernetes.io/part-of: centurion-erp + envs: + - user-centurion.env diff --git a/manifests/centurion_erp/components/rabbitmq-setup/user-centurion.env b/manifests/centurion_erp/components/rabbitmq-setup/user-centurion.env new file mode 100644 index 0000000..bfa41bc --- /dev/null +++ b/manifests/centurion_erp/components/rabbitmq-setup/user-centurion.env @@ -0,0 +1,2 @@ +username= +password= From 346e75e61ca19621b480a225e6b6e5f3507af2df Mon Sep 17 00:00:00 2001 From: Jon Date: Tue, 26 May 2026 19:00:07 +0930 Subject: [PATCH 5/9] refactor(centurion_erp): Service name changed to match app name ref: #22 #1 --- manifests/centurion_erp/base/Service-api.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/centurion_erp/base/Service-api.yaml b/manifests/centurion_erp/base/Service-api.yaml index 5737ae1..20daadb 100644 --- a/manifests/centurion_erp/base/Service-api.yaml +++ b/manifests/centurion_erp/base/Service-api.yaml @@ -2,7 +2,7 @@ apiVersion: v1 kind: Service metadata: - name: api + name: centurion labels: app.kubernetes.io/name: centurion app.kubernetes.io/part-of: centurion-erp From 6e385a73c070f277eb26abdb86af42bb2edb2b63 Mon Sep 17 00:00:00 2001 From: Jon Date: Tue, 26 May 2026 19:01:24 +0930 Subject: [PATCH 6/9] feat(centurion_erp): Add Ingress component ref: #22 #1 --- .../components/ingress/Ingress-centurion.yaml | 79 +++++++++++++++++++ .../components/ingress/kustomization.yaml | 30 +++++++ 2 files changed, 109 insertions(+) create mode 100644 manifests/centurion_erp/components/ingress/Ingress-centurion.yaml create mode 100644 manifests/centurion_erp/components/ingress/kustomization.yaml diff --git a/manifests/centurion_erp/components/ingress/Ingress-centurion.yaml b/manifests/centurion_erp/components/ingress/Ingress-centurion.yaml new file mode 100644 index 0000000..70a2f7f --- /dev/null +++ b/manifests/centurion_erp/components/ingress/Ingress-centurion.yaml @@ -0,0 +1,79 @@ +--- + +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + annotations: + cert-manager.io/common-name: example.com + cert-manager.io/duration: 2160h + cert-manager.io/private-key-algorithm: ECDSA + cert-manager.io/private-key-rotation-policy: Always + cert-manager.io/private-key-size: "384" + cert-manager.io/subject-countries: N/A + cert-manager.io/subject-organizationalunits: N/A + cert-manager.io/subject-organizations: N/A + cert-manager.io/subject-provinces: N/A + labels: + app.kubernetes.io/component: Ingress + app.kubernetes.io/name: centurion + app.kubernetes.io/part-of: centurion-erp + name: centurion +spec: + ingressClassName: nginx + rules: + - host: example.com + http: + paths: + - backend: + service: + name: centurion + port: + name: api + path: /account/ + pathType: Prefix + - backend: + service: + name: centurion + port: + name: api + path: /admin + pathType: Prefix + - backend: + service: + name: centurion + port: + name: api + path: /api + pathType: Prefix + - backend: + service: + name: centurion + port: + name: api + path: /sso/ + pathType: Prefix + - backend: + service: + name: centurion + port: + name: api + path: /static/ + pathType: Prefix + - backend: + service: + name: centurion + port: + name: api + path: /robots.txt + pathType: Exact + - backend: + service: + name: centurion + port: + name: ui + path: / + pathType: Prefix + tls: + - hosts: + - example.com + secretName: certificate-tls-centurion diff --git a/manifests/centurion_erp/components/ingress/kustomization.yaml b/manifests/centurion_erp/components/ingress/kustomization.yaml new file mode 100644 index 0000000..a2fdf57 --- /dev/null +++ b/manifests/centurion_erp/components/ingress/kustomization.yaml @@ -0,0 +1,30 @@ +--- +apiVersion: kustomize.config.k8s.io/v1alpha1 +kind: Component + +# patches: + +# - patch: |- + +# - op: replace +# path: /metadata/annotations/cert-manager.io~1cluster-issuer +# value: cluster + +# - op: replace +# path: /metadata/annotations/cert-manager.io~1common-name +# value: + +# - op: replace +# path: /spec/rules/0/host +# value: + +# - op: replace +# path: /spec/tls/0/hosts/0 +# value: +# target: +# kind: Ingress +# name: centurion +# version: v1 + +resources: + - Ingress-centurion.yaml From 4a9ed06bbf46c4fa1f3a9dc54fab420fd82bc788 Mon Sep 17 00:00:00 2001 From: Jon Date: Tue, 26 May 2026 19:17:21 +0930 Subject: [PATCH 7/9] feat(centurion_erp): Only enable metrics if metrics component is deployed ref: #22 #1 --- .../centurion_erp/base/Deployment-api.yaml | 2 - manifests/centurion_erp/base/Service-api.yaml | 3 - manifests/centurion_erp/base/settings.py | 2 +- .../service-monitor/99.enable-metrics.py | 1 + .../service-monitor/kustomization.yaml | 58 +++++++++++++++++++ 5 files changed, 60 insertions(+), 6 deletions(-) create mode 100644 manifests/centurion_erp/components/service-monitor/99.enable-metrics.py diff --git a/manifests/centurion_erp/base/Deployment-api.yaml b/manifests/centurion_erp/base/Deployment-api.yaml index 124faa5..5f296fb 100644 --- a/manifests/centurion_erp/base/Deployment-api.yaml +++ b/manifests/centurion_erp/base/Deployment-api.yaml @@ -40,8 +40,6 @@ spec: ports: - containerPort: 8000 name: api - - containerPort: 8080 - name: metrics volumeMounts: diff --git a/manifests/centurion_erp/base/Service-api.yaml b/manifests/centurion_erp/base/Service-api.yaml index 20daadb..a31a7e0 100644 --- a/manifests/centurion_erp/base/Service-api.yaml +++ b/manifests/centurion_erp/base/Service-api.yaml @@ -14,9 +14,6 @@ spec: - name: api port: 8000 targetPort: api - - name: metrics - port: 8080 - targetPort: metrics - name: ui port: 80 targetPort: ui diff --git a/manifests/centurion_erp/base/settings.py b/manifests/centurion_erp/base/settings.py index 20264b7..5471bfc 100644 --- a/manifests/centurion_erp/base/settings.py +++ b/manifests/centurion_erp/base/settings.py @@ -4,7 +4,7 @@ # {'disable_downloading': False}, # ] -METRICS_ENABLED = True +METRICS_ENABLED = False # PROMETHEUS_EXPORT_MIGRATIONS = True AUTH_PASSWORD_VALIDATORS = [] diff --git a/manifests/centurion_erp/components/service-monitor/99.enable-metrics.py b/manifests/centurion_erp/components/service-monitor/99.enable-metrics.py new file mode 100644 index 0000000..743511d --- /dev/null +++ b/manifests/centurion_erp/components/service-monitor/99.enable-metrics.py @@ -0,0 +1 @@ +METRICS_ENABLED = True diff --git a/manifests/centurion_erp/components/service-monitor/kustomization.yaml b/manifests/centurion_erp/components/service-monitor/kustomization.yaml index 097108c..c99319a 100644 --- a/manifests/centurion_erp/components/service-monitor/kustomization.yaml +++ b/manifests/centurion_erp/components/service-monitor/kustomization.yaml @@ -2,7 +2,65 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component +configMapGenerator: + - name: configuration + behavior: merge + files: + - 99.enable-metrics.py + resources: - Service-worker.yaml - ServiceMonitor-api.yaml - ServiceMonitor-worker.yaml + +patches: + - patch: |- + apiVersion: apps/v1 + kind: Deployment + metadata: + name: api + spec: + template: + spec: + containers: + - name: web + ports: + - containerPort: 8080 + name: metrics + target: + kind: Deployment + name: api + version: v1 + + - patch: |- + apiVersion: apps/v1 + kind: Deployment + metadata: + name: worker + spec: + template: + spec: + containers: + - name: worker + ports: + - containerPort: 8080 + name: metrics + target: + kind: Deployment + name: worker + version: v1 + + - patch: |- + apiVersion: v1 + kind: Service + metadata: + name: centurion + spec: + ports: + - name: metrics + port: 8080 + targetPort: metrics + target: + kind: Service + name: centurion + version: v1 From eda7ad097349d24a9f3b25fa7b8d383c5d1fe775 Mon Sep 17 00:00:00 2001 From: Jon Date: Tue, 26 May 2026 19:28:03 +0930 Subject: [PATCH 8/9] feat(centurion_erp): Add numerical prefix to settings files intent is that the lower ones open first so override settings would be p[laced in a higher numbered file. ref: #22 #1 --- .../base/{settings.py => 00.settings.py} | 0 .../{celery-broker.py => 10.celery-broker.py} | 0 .../{ui-redirect.py => 15.ui-redirect.py} | 0 .../base/{database.py => 20.database.py} | 0 .../base/{csrf.py => 80.csrf.py} | 0 .../base/{secret_key.py => 90.secret_key.py} | 0 .../centurion_erp/base/Deployment-api.yaml | 16 ++++++------- .../centurion_erp/base/Deployment-worker.yaml | 24 +++++++++---------- .../centurion_erp/base/kustomization.yaml | 12 +++++----- ...keycloak.py => 70.social_auth_keycloak.py} | 0 .../sso-keycloak/kustomization.yaml | 2 +- 11 files changed, 27 insertions(+), 27 deletions(-) rename manifests/centurion_erp/base/{settings.py => 00.settings.py} (100%) rename manifests/centurion_erp/base/{celery-broker.py => 10.celery-broker.py} (100%) rename manifests/centurion_erp/base/{ui-redirect.py => 15.ui-redirect.py} (100%) rename manifests/centurion_erp/base/{database.py => 20.database.py} (100%) rename manifests/centurion_erp/base/{csrf.py => 80.csrf.py} (100%) rename manifests/centurion_erp/base/{secret_key.py => 90.secret_key.py} (100%) rename manifests/centurion_erp/components/sso-keycloak/{social_auth_keycloak.py => 70.social_auth_keycloak.py} (100%) diff --git a/manifests/centurion_erp/base/settings.py b/manifests/centurion_erp/base/00.settings.py similarity index 100% rename from manifests/centurion_erp/base/settings.py rename to manifests/centurion_erp/base/00.settings.py diff --git a/manifests/centurion_erp/base/celery-broker.py b/manifests/centurion_erp/base/10.celery-broker.py similarity index 100% rename from manifests/centurion_erp/base/celery-broker.py rename to manifests/centurion_erp/base/10.celery-broker.py diff --git a/manifests/centurion_erp/base/ui-redirect.py b/manifests/centurion_erp/base/15.ui-redirect.py similarity index 100% rename from manifests/centurion_erp/base/ui-redirect.py rename to manifests/centurion_erp/base/15.ui-redirect.py diff --git a/manifests/centurion_erp/base/database.py b/manifests/centurion_erp/base/20.database.py similarity index 100% rename from manifests/centurion_erp/base/database.py rename to manifests/centurion_erp/base/20.database.py diff --git a/manifests/centurion_erp/base/csrf.py b/manifests/centurion_erp/base/80.csrf.py similarity index 100% rename from manifests/centurion_erp/base/csrf.py rename to manifests/centurion_erp/base/80.csrf.py diff --git a/manifests/centurion_erp/base/secret_key.py b/manifests/centurion_erp/base/90.secret_key.py similarity index 100% rename from manifests/centurion_erp/base/secret_key.py rename to manifests/centurion_erp/base/90.secret_key.py diff --git a/manifests/centurion_erp/base/Deployment-api.yaml b/manifests/centurion_erp/base/Deployment-api.yaml index 5f296fb..8723aa7 100644 --- a/manifests/centurion_erp/base/Deployment-api.yaml +++ b/manifests/centurion_erp/base/Deployment-api.yaml @@ -44,8 +44,8 @@ spec: volumeMounts: - name: celery-broker - mountPath: /etc/itsm/celery-broker.py - subPath: celery-broker.py + mountPath: /etc/itsm/10.celery-broker.py + subPath: 10.celery-broker.py readOnly: true - name: configuration @@ -57,8 +57,8 @@ spec: subPath: data - name: database - mountPath: /etc/itsm/database.py - subPath: database.py + mountPath: /etc/itsm/20.database.py + subPath: 20.database.py readOnly: true - mountPath: /var/log @@ -94,8 +94,8 @@ spec: secret: secretName: celery-broker items: - - key: celery-broker.py - path: celery-broker.py + - key: 10.celery-broker.py + path: 10.celery-broker.py - name: configuration configMap: @@ -109,8 +109,8 @@ spec: secret: secretName: database items: - - key: database.py - path: database.py + - key: 20.database.py + path: 20.database.py - name: logs hostPath: diff --git a/manifests/centurion_erp/base/Deployment-worker.yaml b/manifests/centurion_erp/base/Deployment-worker.yaml index 20c8f34..0331879 100644 --- a/manifests/centurion_erp/base/Deployment-worker.yaml +++ b/manifests/centurion_erp/base/Deployment-worker.yaml @@ -43,18 +43,18 @@ spec: volumeMounts: - name: celery-broker - mountPath: /etc/itsm/celery-broker.py - subPath: celery-broker.py + mountPath: /etc/itsm/10.celery-broker.py + subPath: 10.celery-broker.py readOnly: true - name: configuration - mountPath: /etc/itsm/settings.py - subPath: settings.py + mountPath: /etc/itsm/00.settings.py + subPath: 00.settings.py readOnly: true - name: database - mountPath: /etc/itsm/database.py - subPath: database.py + mountPath: /etc/itsm/20.database.py + subPath: 20.database.py readOnly: true - mountPath: /var/log @@ -71,22 +71,22 @@ spec: secret: secretName: celery-broker items: - - key: celery-broker.py - path: celery-broker.py + - key: 10.celery-broker.py + path: 10.celery-broker.py - name: configuration configMap: name: configuration items: - - key: settings.py - path: settings.py + - key: 00.settings.py + path: 00.settings.py - name: database secret: secretName: database items: - - key: database.py - path: database.py + - key: 20.database.py + path: 20.database.py - name: logs hostPath: diff --git a/manifests/centurion_erp/base/kustomization.yaml b/manifests/centurion_erp/base/kustomization.yaml index 772011f..1970f0e 100644 --- a/manifests/centurion_erp/base/kustomization.yaml +++ b/manifests/centurion_erp/base/kustomization.yaml @@ -5,9 +5,9 @@ kind: Kustomization configMapGenerator: - name: configuration files: - - csrf.py - - settings.py - - ui-redirect.py + - 80.csrf.py + - 00.settings.py + - 15.ui-redirect.py generatorOptions: disableNameSuffixHash: true @@ -41,12 +41,12 @@ resources: secretGenerator: - name: secret_key files: - - secret_key.py + - 90.secret_key.py - name: celery-broker files: - - celery-broker.py + - 10.celery-broker.py - name: database files: - - database.py + - 20.database.py diff --git a/manifests/centurion_erp/components/sso-keycloak/social_auth_keycloak.py b/manifests/centurion_erp/components/sso-keycloak/70.social_auth_keycloak.py similarity index 100% rename from manifests/centurion_erp/components/sso-keycloak/social_auth_keycloak.py rename to manifests/centurion_erp/components/sso-keycloak/70.social_auth_keycloak.py diff --git a/manifests/centurion_erp/components/sso-keycloak/kustomization.yaml b/manifests/centurion_erp/components/sso-keycloak/kustomization.yaml index 4b8963a..ca60df3 100644 --- a/manifests/centurion_erp/components/sso-keycloak/kustomization.yaml +++ b/manifests/centurion_erp/components/sso-keycloak/kustomization.yaml @@ -11,7 +11,7 @@ namespace: centurion secretGenerator: - name: social_auth_keycloak files: - - social_auth_keycloak.py + - 70.social_auth_keycloak.py patches: From 3d01515d6c98a026c8f606161d5519985f78580c Mon Sep 17 00:00:00 2001 From: Jon Date: Sun, 7 Jun 2026 19:18:08 +0930 Subject: [PATCH 9/9] fix(centurion_erp): Use projected/sources for mounting cm/secrets for configuration ref: #22 #1 --- .../centurion_erp/base/Deployment-api.yaml | 51 ++++++++----------- .../centurion_erp/base/Deployment-worker.yaml | 49 +++++++----------- .../centurion_erp/base/kustomization.yaml | 4 +- .../service-monitor/kustomization.yaml | 22 ++++++++ .../sso-keycloak/kustomization.yaml | 18 ++----- 5 files changed, 66 insertions(+), 78 deletions(-) diff --git a/manifests/centurion_erp/base/Deployment-api.yaml b/manifests/centurion_erp/base/Deployment-api.yaml index 8723aa7..6f4c4e6 100644 --- a/manifests/centurion_erp/base/Deployment-api.yaml +++ b/manifests/centurion_erp/base/Deployment-api.yaml @@ -26,9 +26,6 @@ spec: - name: web image: nofusscomputing/centurion-erp:dev - env: - - name: PROMETHEUS_MULTIPROC_DIR - value: '/tmp/prometheus' resources: limits: cpu: 1 @@ -43,11 +40,6 @@ spec: volumeMounts: - - name: celery-broker - mountPath: /etc/itsm/10.celery-broker.py - subPath: 10.celery-broker.py - readOnly: true - - name: configuration mountPath: /etc/itsm readOnly: true @@ -56,11 +48,6 @@ spec: mountPath: /data subPath: data - - name: database - mountPath: /etc/itsm/20.database.py - subPath: 20.database.py - readOnly: true - - mountPath: /var/log name: logs @@ -86,32 +73,36 @@ spec: volumeMounts: [] - priorityClassName: cluster-low tolerations: [] volumes: - - name: celery-broker - secret: - secretName: celery-broker - items: - - key: 10.celery-broker.py - path: 10.celery-broker.py - - name: configuration - configMap: - name: configuration + projected: + sources: + - configMap: + name: configuration + items: + - key: 00.settings.py + path: 00.settings.py + - key: 15.ui-redirect.py + path: 15.ui-redirect.py + - key: 80.csrf.py + path: 80.csrf.py + - secret: + name: celery-broker + items: + - key: 10.celery-broker.py + path: 10.celery-broker.py + - secret: + name: database + items: + - key: 20.database.py + path: 20.database.py - name: data persistentVolumeClaim: claimName: centurion - - name: database - secret: - secretName: database - items: - - key: 20.database.py - path: 20.database.py - - name: logs hostPath: path: /opt/logs/centurion-api diff --git a/manifests/centurion_erp/base/Deployment-worker.yaml b/manifests/centurion_erp/base/Deployment-worker.yaml index 0331879..e5391c0 100644 --- a/manifests/centurion_erp/base/Deployment-worker.yaml +++ b/manifests/centurion_erp/base/Deployment-worker.yaml @@ -42,19 +42,8 @@ spec: volumeMounts: - - name: celery-broker - mountPath: /etc/itsm/10.celery-broker.py - subPath: 10.celery-broker.py - readOnly: true - - name: configuration - mountPath: /etc/itsm/00.settings.py - subPath: 00.settings.py - readOnly: true - - - name: database - mountPath: /etc/itsm/20.database.py - subPath: 20.database.py + mountPath: /etc/itsm readOnly: true - mountPath: /var/log @@ -67,26 +56,24 @@ spec: tolerations: [] volumes: - - name: celery-broker - secret: - secretName: celery-broker - items: - - key: 10.celery-broker.py - path: 10.celery-broker.py - - name: configuration - configMap: - name: configuration - items: - - key: 00.settings.py - path: 00.settings.py - - - name: database - secret: - secretName: database - items: - - key: 20.database.py - path: 20.database.py + projected: + sources: + - configMap: + name: configuration + items: + - key: 00.settings.py + path: 00.settings.py + - secret: + name: celery-broker + items: + - key: 10.celery-broker.py + path: 10.celery-broker.py + - secret: + name: database + items: + - key: 20.database.py + path: 20.database.py - name: logs hostPath: diff --git a/manifests/centurion_erp/base/kustomization.yaml b/manifests/centurion_erp/base/kustomization.yaml index 1970f0e..0650bdb 100644 --- a/manifests/centurion_erp/base/kustomization.yaml +++ b/manifests/centurion_erp/base/kustomization.yaml @@ -5,9 +5,9 @@ kind: Kustomization configMapGenerator: - name: configuration files: - - 80.csrf.py - 00.settings.py - 15.ui-redirect.py + - 80.csrf.py generatorOptions: disableNameSuffixHash: true @@ -39,7 +39,7 @@ resources: - Service-api.yaml secretGenerator: - - name: secret_key + - name: secret-key files: - 90.secret_key.py diff --git a/manifests/centurion_erp/components/service-monitor/kustomization.yaml b/manifests/centurion_erp/components/service-monitor/kustomization.yaml index c99319a..3fa06b6 100644 --- a/manifests/centurion_erp/components/service-monitor/kustomization.yaml +++ b/manifests/centurion_erp/components/service-monitor/kustomization.yaml @@ -32,6 +32,28 @@ patches: name: api version: v1 + - patch: |- + - op: add + path: /spec/template/spec/volumes/0/projected/sources/0/configMap/items/- + value: + key: 99.enable-metrics.py + path: 99.enable-metrics.py + target: + kind: Deployment + name: api + version: v1 + + - patch: |- + - op: add + path: /spec/template/spec/volumes/0/projected/sources/0/configMap/items/- + value: + key: 99.enable-metrics.py + path: 99.enable-metrics.py + target: + kind: Deployment + name: worker + version: v1 + - patch: |- apiVersion: apps/v1 kind: Deployment diff --git a/manifests/centurion_erp/components/sso-keycloak/kustomization.yaml b/manifests/centurion_erp/components/sso-keycloak/kustomization.yaml index ca60df3..a459a09 100644 --- a/manifests/centurion_erp/components/sso-keycloak/kustomization.yaml +++ b/manifests/centurion_erp/components/sso-keycloak/kustomization.yaml @@ -9,7 +9,7 @@ generatorOptions: namespace: centurion secretGenerator: - - name: social_auth_keycloak + - name: social-auth-keycloak files: - 70.social_auth_keycloak.py @@ -17,22 +17,10 @@ patches: - patch: |- - op: add - path: /spec/template/spec/containers/0/volumeMounts/- + path: /spec/template/spec/volumes/0/projected/sources/- value: - name: social-auth-keycloak - mountPath: /etc/itsm/social_auth_keycloak.py - subPath: social_auth_keycloak.py - readOnly: true - - - op: add - path: /spec/template/spec/volumes/- - value: - name: social-auth-keycloak - configMap: + secret: name: social-auth-keycloak - items: - - key: social_auth_keycloak.py - path: social_auth_keycloak.py target: kind: Deployment