forked from alfredfrancis/ai-chatbot-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add ready endpoint * update gunicorn error op * Add config for helm * add helm chart * update nginx conf to handle upstream unavilability while using k8 * add migration in docker-compose * update Documenation
- Loading branch information
1 parent
5db8e73
commit 2993350
Showing
15 changed files
with
346 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,20 @@ | ||
|
||
|
||
|
||
server { | ||
|
||
listen 80; | ||
|
||
sendfile on; | ||
|
||
default_type application/octet-stream; | ||
|
||
|
||
gzip on; | ||
gzip_http_version 1.1; | ||
gzip_disable "MSIE [1-6]\."; | ||
gzip_min_length 256; | ||
gzip_vary on; | ||
gzip_proxied expired no-cache no-store private auth; | ||
gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript; | ||
gzip_comp_level 9; | ||
|
||
|
||
root /usr/share/nginx/html; | ||
resolver 127.0.0.11 valid=30s; | ||
|
||
set $backend http://iky_backend; | ||
|
||
location / { | ||
try_files $uri $uri/ /index.html =404; | ||
} | ||
location /gateway { | ||
proxy_pass http://iky_backend:8080/; | ||
|
||
location /gateway/ { | ||
rewrite ^/gateway/?(.*)$ /$1 break; | ||
proxy_pass $backend; | ||
proxy_set_header Host $host; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
charts/* | ||
Chart.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Patterns to ignore when building packages. | ||
# This supports shell glob matching, relative path matching, and | ||
# negation (prefixed with !). Only one pattern per line. | ||
.DS_Store | ||
# Common VCS dirs | ||
.git/ | ||
.gitignore | ||
.bzr/ | ||
.bzrignore | ||
.hg/ | ||
.hgignore | ||
.svn/ | ||
# Common backup files | ||
*.swp | ||
*.bak | ||
*.tmp | ||
*.orig | ||
*~ | ||
# Various IDEs | ||
.project | ||
.idea/ | ||
*.tmproj | ||
.vscode/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
apiVersion: v2 | ||
name: ai-chatbot-framework | ||
description: A python chatbot framework with Natural Language Understanding and Artificial Intelligence. | ||
type: application | ||
version: 0.1.0 | ||
appVersion: "1.0.0" | ||
dependencies: | ||
- name: mongodb | ||
version: 10.3.3 | ||
repository: "https://charts.bitnami.com/bitnami" | ||
alias: mongodb | ||
condition: mongodb.enabled | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "ai-chatbot-framework.name" -}} | ||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create a default fully qualified app name. | ||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). | ||
If release name contains chart name it will be used as a full name. | ||
*/}} | ||
{{- define "ai-chatbot-framework.fullname" -}} | ||
{{- if .Values.fullnameOverride }} | ||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} | ||
{{- else }} | ||
{{- $name := default .Chart.Name .Values.nameOverride }} | ||
{{- if contains $name .Release.Name }} | ||
{{- .Release.Name | trunc 63 | trimSuffix "-" }} | ||
{{- else }} | ||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create chart name and version as used by the chart label. | ||
*/}} | ||
{{- define "ai-chatbot-framework.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
|
||
{{/* | ||
Common labels | ||
*/}} | ||
{{- define "ai-chatbot-framework.labels" -}} | ||
helm.sh/chart: {{ include "ai-chatbot-framework.chart" . }} | ||
{{ include "ai-chatbot-framework.selectorLabels" . }} | ||
{{- if .Chart.AppVersion }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
{{- end }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
{{- end }} | ||
|
||
{{/* | ||
Selector labels | ||
*/}} | ||
{{- define "ai-chatbot-framework.selectorLabels" -}} | ||
app.kubernetes.io/name: {{ include "ai-chatbot-framework.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create the name of the service account to use | ||
*/}} | ||
{{- define "ai-chatbot-framework.serviceAccountName" -}} | ||
{{- if .Values.serviceAccount.create }} | ||
{{- default (include "ai-chatbot-framework.fullname" .) .Values.serviceAccount.name }} | ||
{{- else }} | ||
{{- default "default" .Values.serviceAccount.name }} | ||
{{- end }} | ||
{{- end }} |
56 changes: 56 additions & 0 deletions
56
helm/ai-chatbot-framework/templates/deployment-backend.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ include "ai-chatbot-framework.fullname" . }}-backend | ||
labels: | ||
app: "ai-chatbot-framework" | ||
name: "ai-chatbot-framework-backend" | ||
{{- include "ai-chatbot-framework.labels" . | nindent 4 }} | ||
spec: | ||
replicas: {{ .Values.replicaCount }} | ||
selector: | ||
matchLabels: | ||
app: "ai-chatbot-framework" | ||
name: "ai-chatbot-framework-backend" | ||
template: | ||
metadata: | ||
labels: | ||
app: "ai-chatbot-framework" | ||
name: "ai-chatbot-framework-backend" | ||
spec: | ||
initContainers: | ||
- name: {{ .Chart.Name }}-init | ||
image: "{{ .Values.image.backend.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" | ||
imagePullPolicy: {{ .Values.image.pullPolicy }} | ||
command: ["python","manage.py","migrate"] | ||
env: | ||
- name: MONGO_URL | ||
value: {{.Values.mongodb.uri}} | ||
- name: APPLICATION_ENV | ||
value: 'Helm' | ||
containers: | ||
- name: {{ .Chart.Name }} | ||
image: "{{ .Values.image.backend.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" | ||
imagePullPolicy: {{ .Values.image.pullPolicy }} | ||
command: ["gunicorn", "run:app" ,"--log-level=debug", "--timeout", "90","--bind", "0.0.0.0:80" ] | ||
env: | ||
- name: MONGO_URL | ||
value: {{.Values.mongodb.uri}} | ||
- name: APPLICATION_ENV | ||
value: 'Helm' | ||
ports: | ||
- name: http | ||
containerPort: 80 | ||
protocol: TCP | ||
livenessProbe: | ||
initialDelaySeconds: 120 | ||
httpGet: | ||
path: /ready | ||
port: http | ||
readinessProbe: | ||
initialDelaySeconds: 120 | ||
httpGet: | ||
path: /ready | ||
port: http | ||
resources: | ||
{{- toYaml .Values.resources.backend | nindent 12 }} |
33 changes: 33 additions & 0 deletions
33
helm/ai-chatbot-framework/templates/deployment-frontend.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ include "ai-chatbot-framework.fullname" . }}-frontend | ||
labels: | ||
app: "ai-chatbot-framework" | ||
name: "ai-chatbot-framework-frontend" | ||
{{- include "ai-chatbot-framework.labels" . | nindent 4 }} | ||
spec: | ||
replicas: {{ .Values.replicaCount }} | ||
selector: | ||
matchLabels: | ||
app: "ai-chatbot-framework" | ||
name: "ai-chatbot-framework-frontend" | ||
template: | ||
metadata: | ||
{{- with .Values.podAnnotations }} | ||
{{- end }} | ||
labels: | ||
app: "ai-chatbot-framework" | ||
name: "ai-chatbot-framework-frontend" | ||
spec: | ||
containers: | ||
- name: {{ .Chart.Name }} | ||
image: "{{ .Values.image.frontend.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" | ||
imagePullPolicy: {{ .Values.image.pullPolicy }} | ||
command: ["nginx", "-g", "daemon off;"] | ||
ports: | ||
- name: http | ||
containerPort: 80 | ||
protocol: TCP | ||
resources: | ||
{{- toYaml .Values.resources.frontend | nindent 12 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
apiVersion: networking.k8s.io/v1 | ||
kind: Ingress | ||
metadata: | ||
name: {{ include "ai-chatbot-framework.fullname" . }} | ||
annotations: | ||
nginx.ingress.kubernetes.io/rewrite-target: /$1 | ||
labels: | ||
app: "ai-chatbot-framework" | ||
name: "ai-chatbot-framework-ingress" | ||
{{- include "ai-chatbot-framework.labels" . | nindent 4 }} | ||
spec: | ||
ingressClassName: nginx | ||
rules: | ||
- http: | ||
paths: | ||
- pathType: Prefix | ||
path: /(.*) | ||
backend: | ||
service: | ||
name: {{ include "ai-chatbot-framework.fullname" . }}-frontend | ||
port: | ||
number: 80 | ||
- pathType: Prefix | ||
path: /gateway/(.*) | ||
backend: | ||
service: | ||
name: {{ include "ai-chatbot-framework.fullname" . }}-backend | ||
port: | ||
number: 80 |
Oops, something went wrong.