Skip to content

Commit c657597

Browse files
committed
feat: Add Centurion ERP base
ref:
1 parent 23570fc commit c657597

11 files changed

Lines changed: 369 additions & 0 deletions
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
---
2+
3+
apiVersion: apps/v1
4+
kind: Deployment
5+
metadata:
6+
labels:
7+
app.kubernetes.io/name: centurion
8+
app.kubernetes.io/part-of: centurion-erp
9+
name: api
10+
spec:
11+
selector:
12+
matchLabels:
13+
app.kubernetes.io/name: centurion
14+
app.kubernetes.io/part-of: centurion-erp
15+
replicas: 1
16+
minReadySeconds: 10
17+
template:
18+
metadata:
19+
labels:
20+
app.kubernetes.io/name: centurion
21+
app.kubernetes.io/part-of: centurion-erp
22+
spec:
23+
terminationGracePeriodSeconds: 10
24+
affinity: {}
25+
containers:
26+
27+
- name: web
28+
image: nofusscomputing/centurion-erp:dev
29+
env:
30+
- name: PROMETHEUS_MULTIPROC_DIR
31+
value: '/tmp/prometheus'
32+
resources:
33+
limits:
34+
cpu: 1
35+
memory: 2Gi
36+
requests:
37+
cpu: 400m
38+
memory: 800Mi
39+
40+
ports:
41+
- containerPort: 8000
42+
name: api
43+
- containerPort: 8080
44+
name: metrics
45+
46+
volumeMounts:
47+
48+
- name: celery-broker
49+
mountPath: /etc/itsm/celery-broker.py
50+
subPath: celery-broker.py
51+
readOnly: true
52+
53+
- name: configuration
54+
mountPath: /etc/itsm
55+
readOnly: true
56+
57+
- name: data
58+
mountPath: /data
59+
subPath: data
60+
61+
- name: database
62+
mountPath: /etc/itsm/database.py
63+
subPath: database.py
64+
readOnly: true
65+
66+
- mountPath: /var/log
67+
name: logs
68+
69+
- mountPath: /tmp
70+
name: tmp
71+
subPath: tmp
72+
73+
74+
- name: ui
75+
image: nofusscomputing/centurion-erp-ui:dev
76+
env: []
77+
resources:
78+
limits:
79+
cpu: 500m
80+
memory: 256Mi
81+
requests:
82+
cpu: 10m
83+
memory: 20Mi
84+
85+
ports:
86+
- containerPort: 80
87+
name: ui
88+
89+
volumeMounts: []
90+
91+
priorityClassName: cluster-low
92+
tolerations: []
93+
volumes:
94+
95+
- name: celery-broker
96+
secret:
97+
secretName: celery-broker
98+
items:
99+
- key: celery-broker.py
100+
path: celery-broker.py
101+
102+
- name: configuration
103+
configMap:
104+
name: configuration
105+
106+
- name: data
107+
persistentVolumeClaim:
108+
claimName: centurion
109+
110+
- name: database
111+
secret:
112+
secretName: database
113+
items:
114+
- key: database.py
115+
path: database.py
116+
117+
- name: logs
118+
hostPath:
119+
path: /opt/logs/centurion-api
120+
type: DirectoryOrCreate
121+
122+
- name: tmp
123+
emptyDir:
124+
medium: Memory
125+
# sizeLimit: 64Mi
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
---
2+
3+
apiVersion: apps/v1
4+
kind: Deployment
5+
metadata:
6+
labels:
7+
app.kubernetes.io/name: worker
8+
app.kubernetes.io/part-of: centurion-erp
9+
name: worker
10+
spec:
11+
selector:
12+
matchLabels:
13+
app.kubernetes.io/name: worker
14+
app.kubernetes.io/part-of: centurion-erp
15+
replicas: 1
16+
minReadySeconds: 10
17+
template:
18+
metadata:
19+
labels:
20+
app.kubernetes.io/name: worker
21+
app.kubernetes.io/part-of: centurion-erp
22+
spec:
23+
terminationGracePeriodSeconds: 10
24+
affinity: {}
25+
containers:
26+
- name: worker
27+
image: nofusscomputing/centurion-erp:dev
28+
env:
29+
- name: IS_WORKER
30+
value: "true"
31+
resources:
32+
limits:
33+
cpu: 800m
34+
memory: 200Mi
35+
requests:
36+
cpu: 10m
37+
memory: 20Mi
38+
39+
ports:
40+
- containerPort: 8080
41+
name: metrics
42+
43+
volumeMounts:
44+
45+
- name: celery-broker
46+
mountPath: /etc/itsm/celery-broker.py
47+
subPath: celery-broker.py
48+
readOnly: true
49+
50+
- name: configuration
51+
mountPath: /etc/itsm/settings.py
52+
subPath: settings.py
53+
readOnly: true
54+
55+
- name: database
56+
mountPath: /etc/itsm/database.py
57+
subPath: database.py
58+
readOnly: true
59+
60+
- mountPath: /var/log
61+
name: logs
62+
63+
- mountPath: /tmp
64+
name: tmp
65+
subPath: tmp
66+
67+
tolerations: []
68+
volumes:
69+
70+
- name: celery-broker
71+
secret:
72+
secretName: celery-broker
73+
items:
74+
- key: celery-broker.py
75+
path: celery-broker.py
76+
77+
- name: configuration
78+
configMap:
79+
name: configuration
80+
items:
81+
- key: settings.py
82+
path: settings.py
83+
84+
- name: database
85+
secret:
86+
secretName: database
87+
items:
88+
- key: database.py
89+
path: database.py
90+
91+
- name: logs
92+
hostPath:
93+
path: /opt/logs/centurion-worker
94+
type: DirectoryOrCreate
95+
96+
- name: tmp
97+
emptyDir:
98+
medium: Memory
99+
# sizeLimit: 64Mi
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
apiVersion: v1
3+
kind: PersistentVolumeClaim
4+
metadata:
5+
labels:
6+
app.kubernetes.io/name: centurion
7+
app.kubernetes.io/part-of: centurion-erp
8+
name: centurion
9+
spec:
10+
volumeMode: Filesystem
11+
accessModes:
12+
- ReadWriteOnce
13+
resources:
14+
requests:
15+
storage: 5Gi
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
apiVersion: v1
3+
kind: Service
4+
metadata:
5+
name: api
6+
labels:
7+
app.kubernetes.io/name: centurion
8+
app.kubernetes.io/part-of: centurion-erp
9+
spec:
10+
selector:
11+
app.kubernetes.io/name: centurion
12+
app.kubernetes.io/part-of: centurion-erp
13+
ports:
14+
- name: api
15+
port: 8000
16+
targetPort: api
17+
- name: metrics
18+
port: 8080
19+
targetPort: metrics
20+
- name: ui
21+
port: 80
22+
targetPort: ui
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# amqp://<username>:<password>@<rabbitmq cluster dns name>/<exchange name>
2+
CELERY_BROKER_URL = ''
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
SITE_URL = 'https://<domain.tld>'
2+
3+
TRUSTED_ORIGINS = [
4+
'https://<domain.tld>',
5+
'https://<sub-domain.domain.tld>',
6+
]
7+
8+
# SSL
9+
SECURE_SSL_HOST = '<domain.tld>'
10+
SECURE_SSL_REDIRECT = True
11+
SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")
12+
13+
USE_X_FORWARDED_HOST = True
14+
SESSION_COOKIE_SECURE = True
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
DATABASES = {
2+
'default': {
3+
'ENGINE': 'django_prometheus.db.backends.postgresql',
4+
'NAME': 'centurion', # Database name
5+
'USER': '', # PostgreSQL username
6+
'PASSWORD': '', # PostgreSQL password
7+
'HOST': '', # Database server
8+
'PORT': '', # Database port (leave blank for default)
9+
'CONN_MAX_AGE': 300, # Max database connection age
10+
}
11+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
---
2+
apiVersion: kustomize.config.k8s.io/v1beta1
3+
kind: Kustomization
4+
5+
configMapGenerator:
6+
- name: configuration
7+
files:
8+
- csrf.py
9+
- settings.py
10+
- ui-redirect.py
11+
12+
generatorOptions:
13+
disableNameSuffixHash: true
14+
15+
# patches:
16+
# - patch: |-
17+
# apiVersion: apps/v1
18+
# kind: Deployment
19+
# metadata:
20+
# name: api
21+
# spec:
22+
# template:
23+
# spec:
24+
# containers:
25+
# - name: ui
26+
# env:
27+
# - name: API_URL
28+
# value: https://<domain.tld>/api/v2
29+
30+
# target:
31+
# kind: Deployment
32+
# name: api
33+
# version: v1
34+
35+
resources:
36+
- PVC-centurion.yaml
37+
- Deployment-api.yaml
38+
- Deployment-worker.yaml
39+
- Service-api.yaml
40+
41+
secretGenerator:
42+
- name: secret_key
43+
files:
44+
- secret_key.py
45+
46+
- name: celery-broker
47+
files:
48+
- celery-broker.py
49+
50+
- name: database
51+
files:
52+
- database.py
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Add your secret key here
2+
SECRET_KEY = ''
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
DEBUG = False
2+
3+
# FEATURE_FLAG_OVERRIDES = [
4+
# {'disable_downloading': False},
5+
# ]
6+
7+
METRICS_ENABLED = True
8+
# PROMETHEUS_EXPORT_MIGRATIONS = True
9+
10+
AUTH_PASSWORD_VALIDATORS = []
11+
12+
SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")
13+
SECURE_SSL_REDIRECT = True
14+
15+
USE_X_FORWARDED_HOST = True
16+
17+
LOG_FILES = {
18+
"catch_all":"/var/log/catch-all.log",
19+
"centurion_trace": "/var/log/trace.log",
20+
"centurion": "/var/log/centurion.log",
21+
"error": "/var/log/error.log",
22+
"gunicorn": "/var/log/gunicorn.log",
23+
"rest_api": "/var/log/rest_api.log",
24+
"weblog": "/var/log/weblog.log",
25+
}

0 commit comments

Comments
 (0)