mirror of https://github.com/msgbyte/tailchat
chore: add simple k8s config
parent
fc19096e33
commit
8818c039e1
@ -0,0 +1,45 @@
|
|||||||
|
Its doc will tell you how to deploy `Tailchat` in kubeneters.
|
||||||
|
|
||||||
|
## One Command
|
||||||
|
|
||||||
|
```bash
|
||||||
|
kubectl apply -f namespace.yml -f pv.yml -f mongo.yml -f minio.yml -f redis.yml -f tailchat.yml
|
||||||
|
```
|
||||||
|
|
||||||
|
## Setup one by one
|
||||||
|
|
||||||
|
### Create Namespace
|
||||||
|
|
||||||
|
```bash
|
||||||
|
kubectl apply -f namespace.yml
|
||||||
|
```
|
||||||
|
|
||||||
|
### Create Persistent Volume
|
||||||
|
|
||||||
|
```bash
|
||||||
|
kubectl apply -f pv.yml
|
||||||
|
```
|
||||||
|
|
||||||
|
### Create Mongodb
|
||||||
|
|
||||||
|
```bash
|
||||||
|
kubectl apply -f mongo.yml
|
||||||
|
```
|
||||||
|
|
||||||
|
### Create Minio
|
||||||
|
|
||||||
|
```bash
|
||||||
|
kubectl apply -f minio.yml
|
||||||
|
```
|
||||||
|
|
||||||
|
### Create Redis
|
||||||
|
|
||||||
|
```bash
|
||||||
|
kubectl apply -f redis.yml
|
||||||
|
```
|
||||||
|
|
||||||
|
### Create Tailchat
|
||||||
|
|
||||||
|
```bash
|
||||||
|
kubectl apply -f tailchat.yml
|
||||||
|
```
|
@ -0,0 +1,55 @@
|
|||||||
|
apiVersion: apps/v1
|
||||||
|
kind: StatefulSet
|
||||||
|
metadata:
|
||||||
|
name: minio
|
||||||
|
namespace: tailchat
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: minio
|
||||||
|
serviceName: minio
|
||||||
|
replicas: 1
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: minio
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: minio
|
||||||
|
image: minio/minio
|
||||||
|
imagePullPolicy: IfNotPresent
|
||||||
|
env:
|
||||||
|
- name: MINIO_ROOT_USER
|
||||||
|
value: tailchat
|
||||||
|
- name: MINIO_ROOT_PASSWORD
|
||||||
|
value: com.msgbyte.tailchat
|
||||||
|
command:
|
||||||
|
- minio
|
||||||
|
- server
|
||||||
|
- /data/storage
|
||||||
|
- '--console-address'
|
||||||
|
- ':9001'
|
||||||
|
ports:
|
||||||
|
- containerPort: 9000
|
||||||
|
- containerPort: 9001
|
||||||
|
volumeMounts:
|
||||||
|
- name: minio-persistent-storage
|
||||||
|
mountPath: /data/tailchat/storage
|
||||||
|
volumes:
|
||||||
|
- name: minio-persistent-storage
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: minio-pvc
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: minio-service
|
||||||
|
namespace: tailchat
|
||||||
|
spec:
|
||||||
|
type: ClusterIP
|
||||||
|
selector:
|
||||||
|
app: minio
|
||||||
|
ports:
|
||||||
|
- protocol: TCP
|
||||||
|
port: 9000
|
||||||
|
targetPort: 9000
|
@ -0,0 +1,43 @@
|
|||||||
|
apiVersion: apps/v1
|
||||||
|
kind: StatefulSet
|
||||||
|
metadata:
|
||||||
|
name: mongo
|
||||||
|
namespace: tailchat
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: mongo
|
||||||
|
serviceName: mongo
|
||||||
|
replicas: 1
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: mongo
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: mongo
|
||||||
|
image: mongo:4
|
||||||
|
imagePullPolicy: IfNotPresent
|
||||||
|
ports:
|
||||||
|
- containerPort: 27017
|
||||||
|
volumeMounts:
|
||||||
|
- name: mongo-persistent-storage
|
||||||
|
mountPath: /data/tailchat/db
|
||||||
|
volumes:
|
||||||
|
- name: mongo-persistent-storage
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: mongo-pvc
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: mongo-service
|
||||||
|
namespace: tailchat
|
||||||
|
spec:
|
||||||
|
type: ClusterIP
|
||||||
|
selector:
|
||||||
|
app: mongo
|
||||||
|
ports:
|
||||||
|
- protocol: TCP
|
||||||
|
port: 27017
|
||||||
|
targetPort: 27017
|
@ -0,0 +1,4 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Namespace
|
||||||
|
metadata:
|
||||||
|
name: tailchat
|
@ -0,0 +1,51 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolume
|
||||||
|
metadata:
|
||||||
|
name: mongo-pv
|
||||||
|
spec:
|
||||||
|
storageClassName: tailchat-db
|
||||||
|
capacity:
|
||||||
|
storage: 5Gi
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
hostPath:
|
||||||
|
path: /data/tailchat/db
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
metadata:
|
||||||
|
name: mongo-pvc
|
||||||
|
namespace: tailchat
|
||||||
|
spec:
|
||||||
|
storageClassName: tailchat-db
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 5Gi
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolume
|
||||||
|
metadata:
|
||||||
|
name: minio-pv
|
||||||
|
spec:
|
||||||
|
storageClassName: tailchat-storage
|
||||||
|
capacity:
|
||||||
|
storage: 5Gi
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
hostPath:
|
||||||
|
path: /data/tailchat/storage
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
metadata:
|
||||||
|
name: minio-pvc
|
||||||
|
namespace: tailchat
|
||||||
|
spec:
|
||||||
|
storageClassName: tailchat-storage
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 5Gi
|
@ -0,0 +1,36 @@
|
|||||||
|
apiVersion: apps/v1
|
||||||
|
kind: StatefulSet
|
||||||
|
metadata:
|
||||||
|
name: redis
|
||||||
|
namespace: tailchat
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: redis
|
||||||
|
serviceName: redis
|
||||||
|
replicas: 1
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: redis
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: redis
|
||||||
|
image: redis:alpine
|
||||||
|
imagePullPolicy: IfNotPresent
|
||||||
|
ports:
|
||||||
|
- containerPort: 6379
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: redis-service
|
||||||
|
namespace: tailchat
|
||||||
|
spec:
|
||||||
|
type: ClusterIP
|
||||||
|
selector:
|
||||||
|
app: redis
|
||||||
|
ports:
|
||||||
|
- protocol: TCP
|
||||||
|
port: 6379
|
||||||
|
targetPort: 6379
|
@ -0,0 +1,59 @@
|
|||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: tailchat
|
||||||
|
namespace: tailchat
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: tailchat
|
||||||
|
replicas: 3
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: tailchat
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: tailchat
|
||||||
|
image: moonrailgun/tailchat
|
||||||
|
imagePullPolicy: Always
|
||||||
|
env:
|
||||||
|
- name: SERVICEDIR
|
||||||
|
value: services
|
||||||
|
- name: TRANSPORTER
|
||||||
|
value: redis://redis-service:6379
|
||||||
|
- name: REDIS_URL
|
||||||
|
value: redis://redis-service:6379
|
||||||
|
- name: MONGO_URL
|
||||||
|
value: mongodb://mongo-service/tailchat
|
||||||
|
- name: SECRET
|
||||||
|
value: any-secret-keywords
|
||||||
|
- name: MINIO_URL
|
||||||
|
value: minio-service:9000
|
||||||
|
- name: MINIO_USER
|
||||||
|
value: tailchat
|
||||||
|
- name: MINIO_PASS
|
||||||
|
value: com.msgbyte.tailchat
|
||||||
|
ports:
|
||||||
|
- containerPort: 11000
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: 50m
|
||||||
|
memory: 51Mi
|
||||||
|
limits:
|
||||||
|
cpu: 500m
|
||||||
|
memory: 256Mi
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: tailchat-service
|
||||||
|
namespace: tailchat
|
||||||
|
spec:
|
||||||
|
type: ClusterIP
|
||||||
|
selector:
|
||||||
|
app: tailchat
|
||||||
|
ports:
|
||||||
|
- protocol: TCP
|
||||||
|
port: 11000
|
||||||
|
targetPort: 11000
|
Loading…
Reference in New Issue