-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added SSL with cert-manager and ingress
- Loading branch information
Showing
11 changed files
with
117 additions
and
36 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,51 @@ | ||
export NAME=deejai.${1-teticio.co.uk} | ||
export KOPS_STATE_STORE=s3://clusters.${1-teticio.co.uk} | ||
export AWS_REGION=${2-us-east-1} | ||
export AWS_ACCESS_KEY_ID=$(aws configure get default.aws_access_key_id) | ||
export AWS_SECRET_ACCESS_KEY=$(aws configure get default.aws_secret_access_key) | ||
|
||
kops create cluster \ | ||
--zones=us-east-1a \ | ||
--node-count=2 \ | ||
--node-size="t3.large" \ | ||
${NAME} | ||
--zones=${AWS_REGION}a \ | ||
--node-count=2 \ | ||
--node-size="t3.large" \ | ||
${NAME} | ||
kops update cluster ${NAME} --yes --admin | ||
kops validate cluster --wait 10m | ||
kops validate cluster ${NAME} --wait 20m | ||
|
||
# install ingress-nginx | ||
helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx | ||
helm repo update | ||
helm upgrade \ | ||
--install nginx ingress-nginx/ingress-nginx \ | ||
--create-namespace \ | ||
--namespace deejai \ | ||
--version 4.0.1 | ||
|
||
# install cert-manager | ||
helm repo add jetstack https://charts.jetstack.io | ||
helm repo update | ||
helm upgrade \ | ||
--install cert-manager jetstack/cert-manager \ | ||
--create-namespace \ | ||
--namespace cert-manager \ | ||
--version v1.5.3 \ | ||
--set installCRDs=true | ||
|
||
# install deejai chart | ||
helm upgrade \ | ||
--install deejai helm-chart/deejai \ | ||
--create-namespace \ | ||
--namespace deejai \ | ||
--values helm-chart/deejai/values.yaml \ | ||
--set service.type=LoadBalancer \ | ||
--set service.port=80 \ | ||
--set domain=${1-teticio.co.uk} \ | ||
--set url=https://${1-teticio.co.uk} \ | ||
--set ingress.enabled=true \ | ||
--set letsencrypt.enabled=true \ | ||
--set [email protected] \ | ||
--set image.pullPolicy=Always \ | ||
--set autoscaling.enabled=true | ||
# install dashboard | ||
|
||
# install dashboard and metrics-server | ||
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.5/aio/deploy/recommended.yaml | ||
kubectl apply -f https://raw.githubusercontent.com/kubernetes/kops/master/addons/metrics-server/v1.16.x.yaml | ||
kubectl create serviceaccount dashboard -n default | ||
|
@@ -25,6 +54,9 @@ kubectl get secret $(kubectl get serviceaccount dashboard -o jsonpath="{.secrets | |
echo | ||
echo "kubectl proxy" | ||
echo "http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/#/login#" | ||
# kops delete cluster --name ${NAME} --yes | ||
# while true; do curl -X 'GET' `http://${NAME}/api/v1/search?string=a&max_items=100` -H 'accept: application/json'; done | ||
# while true; do curl -X 'GET' `http://${NAME}/api/v1/search_similar?url=https%3A%2F%2Fp.scdn.co%2Fmp3-preview%2Fb8879c1f8a68d43439c969069590013ec8447abb%3Fcid%3D1a7897e3c69d4684aa4d8e90d5911594&max_items=10`; done | ||
|
||
# load tests | ||
# while true; do curl -X 'GET' 'https://teticio.co.uk/api/v1/search?string=a&max_items=100' -H 'accept: application/json'; done | ||
# while true; do curl -X 'GET' 'https://teticio.co.uk/api/v1/search_similar?url=https%3A%2F%2Fp.scdn.co%2Fmp3-preview%2Fb8879c1f8a68d43439c969069590013ec8447abb%3Fcid%3D1a7897e3c69d4684aa4d8e90d5911594&max_items=10'; done | ||
|
||
# kops delete cluster --name ${NAME} --yes |
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{{- if .Values.letsencrypt.enabled }} | ||
apiVersion: cert-manager.io/v1 | ||
kind: Issuer | ||
metadata: | ||
name: letsencrypt | ||
spec: | ||
acme: | ||
server: https://acme-v02.api.letsencrypt.org/directory | ||
# server: https://acme-staging-v02.api.letsencrypt.org/directory | ||
email: {{ .Values.letsencrypt.email }} | ||
privateKeySecretRef: | ||
name: letsencrypt | ||
solvers: | ||
- http01: | ||
ingress: | ||
class: nginx | ||
--- | ||
apiVersion: cert-manager.io/v1 | ||
kind: Certificate | ||
metadata: | ||
name: {{ .Chart.Name }} | ||
spec: | ||
secretName: {{ .Chart.Name }}-tls | ||
issuerRef: | ||
name: letsencrypt | ||
dnsNames: {{ .Values.letsencrypt.dnsNames }} | ||
{{- end }} |
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 |
---|---|---|
|
@@ -4,13 +4,17 @@ | |
|
||
replicaCount: 1 | ||
|
||
app: | ||
domain: &domain teticio.co.uk | ||
url: &url https://teticio.co.uk | ||
|
||
image: | ||
repository: teticio/deejai | ||
pullPolicy: IfNotPresent | ||
# Overrides the image tag whose default is the chart appVersion. | ||
tag: "" | ||
ports: | ||
- containerPort: http | ||
- containerPort: http | ||
|
||
imagePullSecrets: [] | ||
nameOverride: "" | ||
|
@@ -27,10 +31,12 @@ serviceAccount: | |
|
||
podAnnotations: {} | ||
|
||
podSecurityContext: {} | ||
podSecurityContext: | ||
{} | ||
# fsGroup: 2000 | ||
|
||
securityContext: {} | ||
securityContext: | ||
{} | ||
# capabilities: | ||
# drop: | ||
# - ALL | ||
|
@@ -44,20 +50,21 @@ service: | |
|
||
ingress: | ||
enabled: false | ||
annotations: {} | ||
# kubernetes.io/ingress.class: nginx | ||
# kubernetes.io/tls-acme: "true" | ||
annotations: | ||
kubernetes.io/ingress.class: nginx | ||
cert-manager.io/cluster-issuer: letsencrypt | ||
kubernetes.io/tls-acme: "true" | ||
hosts: | ||
- host: chart-example.local | ||
- host: *domain | ||
paths: | ||
- path: / | ||
backend: | ||
serviceName: chart-example.local | ||
servicePort: 80 | ||
tls: [] | ||
# - secretName: chart-example-tls | ||
# hosts: | ||
# - chart-example.local | ||
- path: / | ||
backend: | ||
serviceName: deejai | ||
servicePort: 80 | ||
tls: | ||
- secretName: deejai-tls | ||
hosts: | ||
- *domain | ||
|
||
resources: | ||
# We usually recommend not to specify default resources and to leave this as a conscious | ||
|
@@ -91,7 +98,7 @@ deployment: | |
port: http | ||
initialDelaySeconds: 0 | ||
periodSeconds: 5 | ||
failureThreshold: 1000 # we rely on the liveness probe to resolve issues if needed | ||
failureThreshold: 1000 # we rely on the liveness probe to resolve issues if needed | ||
timeoutSeconds: 3 | ||
livenessProbe: | ||
enabled: true | ||
|
@@ -101,3 +108,9 @@ deployment: | |
periodSeconds: 5 | ||
failureThreshold: 3 | ||
timeoutSeconds: 10 | ||
|
||
letsencrypt: | ||
enabled: false | ||
email: [email protected] | ||
dnsNames: | ||
- *domain |
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,17 +1,16 @@ | ||
FROM python:3.8 | ||
ARG APP_URL | ||
ENV APP_URL $APP_URL | ||
# ARG APP_URL | ||
# ENV SPOTIFY_REDIRECT_URI $APP_URL/api/v1/callback | ||
# ENV REACT_APP_API_URL $APP_URL/api/v1 | ||
ENV CUDA_VISIBLE_DEVICES "" | ||
COPY . /deej-ai.online-app | ||
WORKDIR "/deej-ai.online-app" | ||
RUN sed -i "s|\(http\)[^/]*/[^/]*/[^/]*/|${APP_URL}/|g" .env.production && \ | ||
sed -i "s|\(http\)[^/]*/[^/]*/[^/]*/|${APP_URL}/|g" backend/credentials.py | ||
RUN apt update && \ | ||
apt install ffmpeg libsndfile-dev nodejs npm -y | ||
RUN npm install --global yarn && \ | ||
rm -rf node_modules deejai.db && \ | ||
yarn install && \ | ||
yarn build && \ | ||
pip install -r requirements-lock.txt | ||
CMD ["uvicorn", "backend.main:app", "--reload", "--host=0.0.0.0"] | ||
CMD yarn build && uvicorn backend.main:app --host=0.0.0.0 | ||
EXPOSE 8000 |
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