Skip to content

Commit 5ed8673

Browse files
Implement SloopStash AIA (AI Assistant) stack on Kubernetes
1 parent 73e9c56 commit 5ed8673

File tree

33 files changed

+1489
-2
lines changed

33 files changed

+1489
-2
lines changed

deployment/aia/app.yml

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: app
5+
spec:
6+
selector:
7+
matchLabels:
8+
service: app
9+
replicas: 2
10+
template:
11+
metadata:
12+
labels:
13+
service: app
14+
spec:
15+
affinity:
16+
nodeAffinity:
17+
requiredDuringSchedulingIgnoredDuringExecution:
18+
nodeSelectorTerms:
19+
- matchExpressions:
20+
- key: kubernetes.io/os
21+
operator: In
22+
values:
23+
- linux
24+
- key: node-role.kubernetes.io/worker
25+
operator: In
26+
values:
27+
- worker
28+
- key: type
29+
operator: In
30+
values:
31+
- on-premise
32+
- cloud
33+
- key: provider
34+
operator: In
35+
values:
36+
- host
37+
- aws
38+
- azure
39+
- key: service
40+
operator: In
41+
values:
42+
- virtualbox
43+
- ec2
44+
- eks
45+
- aks
46+
- key: region
47+
operator: In
48+
values:
49+
- local
50+
- ap-south-1
51+
- centralindia
52+
- key: availability_zone
53+
operator: In
54+
values:
55+
- local-c
56+
- ap-south-1a
57+
- zone-1
58+
containers:
59+
- name: main
60+
image: sloopstash/python:v${AIA_PYTHON_VERSION}
61+
imagePullPolicy: IfNotPresent
62+
command: ["/usr/bin/supervisord"]
63+
args: ["-c", "/etc/supervisord.conf"]
64+
env:
65+
- name: STATIC_ENDPOINT
66+
value: app-static.aia.${EXTERNAL_DOMAIN}:${AIA_NGINX_PORT}
67+
volumeMounts:
68+
- name: app-source
69+
mountPath: /opt/app/source
70+
- name: app-log
71+
mountPath: /opt/app/log
72+
- name: supervisor-server
73+
mountPath: /etc/supervisord.conf
74+
subPath: supervisor-server
75+
- name: app-supervisor
76+
mountPath: /opt/app/system/supervisor.ini
77+
subPath: app-supervisor
78+
ports:
79+
- containerPort: 2000
80+
livenessProbe:
81+
httpGet:
82+
scheme: HTTP
83+
path: /health
84+
port: 2000
85+
httpHeaders:
86+
- name: Host
87+
value: localhost
88+
initialDelaySeconds: 15
89+
periodSeconds: 20
90+
readinessProbe:
91+
exec:
92+
command:
93+
- "/usr/bin/supervisorctl"
94+
- "status"
95+
- "app"
96+
initialDelaySeconds: 5
97+
periodSeconds: 10
98+
volumes:
99+
- name: app-source
100+
hostPath:
101+
path: ${AIA_APP_SOURCE}
102+
type: Directory
103+
- name: app-log
104+
persistentVolumeClaim:
105+
claimName: sloopstash-${ENVIRONMENT}-aia-app-log
106+
- name: supervisor-server
107+
configMap:
108+
name: app
109+
- name: app-supervisor
110+
configMap:
111+
name: app

deployment/aia/nginx.yml

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: nginx
5+
spec:
6+
selector:
7+
matchLabels:
8+
service: nginx
9+
replicas: 1
10+
template:
11+
metadata:
12+
labels:
13+
service: nginx
14+
spec:
15+
affinity:
16+
nodeAffinity:
17+
requiredDuringSchedulingIgnoredDuringExecution:
18+
nodeSelectorTerms:
19+
- matchExpressions:
20+
- key: kubernetes.io/os
21+
operator: In
22+
values:
23+
- linux
24+
- key: node-role.kubernetes.io/worker
25+
operator: In
26+
values:
27+
- worker
28+
- key: type
29+
operator: In
30+
values:
31+
- on-premise
32+
- cloud
33+
- key: provider
34+
operator: In
35+
values:
36+
- host
37+
- aws
38+
- azure
39+
- key: service
40+
operator: In
41+
values:
42+
- virtualbox
43+
- ec2
44+
- eks
45+
- aks
46+
- key: region
47+
operator: In
48+
values:
49+
- local
50+
- ap-south-1
51+
- centralindia
52+
- key: availability_zone
53+
operator: In
54+
values:
55+
- local-b
56+
- ap-south-1b
57+
- zone-2
58+
containers:
59+
- name: main
60+
image: sloopstash/nginx:v${AIA_NGINX_VERSION}
61+
imagePullPolicy: IfNotPresent
62+
command: ["/usr/bin/supervisord"]
63+
args: ["-c", "/etc/supervisord.conf"]
64+
volumeMounts:
65+
- name: app-source
66+
mountPath: /opt/app/source
67+
- name: nginx-log
68+
mountPath: /opt/nginx/log
69+
- name: supervisor-server
70+
mountPath: /etc/supervisord.conf
71+
subPath: supervisor-server
72+
- name: nginx-supervisor
73+
mountPath: /opt/nginx/system/supervisor.ini
74+
subPath: supervisor.ini
75+
- name: nginx-server
76+
mountPath: /opt/nginx/conf/server.conf
77+
subPath: server.conf
78+
- name: nginx-app
79+
mountPath: /opt/nginx/conf/app.conf
80+
subPath: nginx-app
81+
ports:
82+
- containerPort: 80
83+
livenessProbe:
84+
httpGet:
85+
scheme: HTTP
86+
path: /
87+
port: 80
88+
httpHeaders:
89+
- name: Host
90+
value: localhost
91+
initialDelaySeconds: 15
92+
periodSeconds: 20
93+
readinessProbe:
94+
exec:
95+
command:
96+
- "/usr/bin/supervisorctl"
97+
- "status"
98+
- "nginx"
99+
initialDelaySeconds: 5
100+
periodSeconds: 10
101+
volumes:
102+
- name: app-source
103+
hostPath:
104+
path: ${AIA_APP_SOURCE}
105+
type: Directory
106+
- name: nginx-log
107+
persistentVolumeClaim:
108+
claimName: sloopstash-${ENVIRONMENT}-aia-nginx-log
109+
- name: supervisor-server
110+
configMap:
111+
name: nginx
112+
- name: nginx-supervisor
113+
configMap:
114+
name: nginx
115+
items:
116+
- key: supervisor.ini
117+
path: supervisor.ini
118+
- name: nginx-server
119+
configMap:
120+
name: nginx
121+
items:
122+
- key: server.conf
123+
path: server.conf
124+
- name: nginx-app
125+
configMap:
126+
name: nginx
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
apiVersion: v1
2+
kind: PersistentVolumeClaim
3+
metadata:
4+
name: sloopstash-${ENVIRONMENT}-aia-app-log
5+
spec:
6+
storageClassName: standard
7+
volumeName: sloopstash-${ENVIRONMENT}-aia-app-log
8+
volumeMode: Filesystem
9+
accessModes:
10+
- ReadWriteOnce
11+
resources:
12+
requests:
13+
storage: 2Gi
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
apiVersion: v1
2+
kind: PersistentVolumeClaim
3+
metadata:
4+
name: sloopstash-${ENVIRONMENT}-aia-nginx-log
5+
spec:
6+
storageClassName: standard
7+
volumeName: sloopstash-${ENVIRONMENT}-aia-nginx-log
8+
volumeMode: Filesystem
9+
accessModes:
10+
- ReadWriteOnce
11+
resources:
12+
requests:
13+
storage: 2Gi

persistent-volume/aia/app.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
apiVersion: v1
2+
kind: PersistentVolume
3+
metadata:
4+
name: sloopstash-${ENVIRONMENT}-aia-app-log
5+
spec:
6+
storageClassName: standard
7+
capacity:
8+
storage: 2Gi
9+
volumeMode: Filesystem
10+
accessModes:
11+
- ReadWriteOnce
12+
persistentVolumeReclaimPolicy: Retain
13+
local:
14+
path: /mnt/sloopstash/${ENVIRONMENT}/aia/app/log
15+
claimRef:
16+
namespace: sloopstash-${ENVIRONMENT}-aia
17+
name: sloopstash-${ENVIRONMENT}-aia-app-log
18+
nodeAffinity:
19+
required:
20+
nodeSelectorTerms:
21+
- matchExpressions:
22+
- key: kubernetes.io/os
23+
operator: In
24+
values:
25+
- linux
26+
- key: node-role.kubernetes.io/worker
27+
operator: In
28+
values:
29+
- worker
30+
- key: type
31+
operator: In
32+
values:
33+
- on-premise
34+
- cloud
35+
- key: provider
36+
operator: In
37+
values:
38+
- host
39+
- aws
40+
- azure
41+
- key: service
42+
operator: In
43+
values:
44+
- virtualbox
45+
- ec2
46+
- eks
47+
- aks
48+
- key: region
49+
operator: In
50+
values:
51+
- local
52+
- ap-south-1
53+
- centralindia
54+
- key: availability_zone
55+
operator: In
56+
values:
57+
- local-c
58+
- ap-south-1a
59+
- zone-1

0 commit comments

Comments
 (0)