Skip to content

Commit 84a4291

Browse files
authored
Merge pull request #76 from dminkovski/aks
Added AKS Support with AZD
2 parents 4a0a04a + 106ce73 commit 84a4291

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+2669
-4
lines changed

.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,4 +148,9 @@ cython_debug/
148148
# NPM
149149
npm-debug.log*
150150
node_modules
151-
static/
151+
static/
152+
153+
# Generated manifests
154+
app/backend/manifests/azd-env-configmap.yml
155+
deploy/aks/easyauth/config-output.md
156+
deploy/aks/easyauth/easyauth-ingress.yaml

app/backend/Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ COPY pom.xml .
99
COPY src src
1010

1111
RUN chmod +x ./mvnw
12+
# Convert CRLF to LF
13+
RUN sed -i 's/\r$//' ./mvnw
1214
RUN ./mvnw package -DskipTests
1315
RUN mkdir -p target/dependency && (cd target/dependency; jar -xf ../*.jar)
1416

@@ -23,4 +25,6 @@ COPY --from=build ${DEPENDENCY}/BOOT-INF/classes /app
2325
RUN curl -LJ -o /app/applicationinsights-agent-3.4.19.jar https://github.com/microsoft/ApplicationInsights-Java/releases/download/3.4.19/applicationinsights-agent-3.4.19.jar
2426
COPY applicationinsights.json /app
2527

28+
EXPOSE 8080
29+
2630
ENTRYPOINT ["java","-javaagent:/app/applicationinsights-agent-3.4.19.jar","-noverify", "-XX:MaxRAMPercentage=70", "-XX:+UseParallelGC", "-XX:ActiveProcessorCount=2", "-cp","app:app/lib/*","com.microsoft.openai.samples.rag.Application"]
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: backend-deployment
5+
namespace: azure-open-ai
6+
labels:
7+
app: backend
8+
spec:
9+
replicas: 1
10+
selector:
11+
matchLabels:
12+
app: backend
13+
template:
14+
metadata:
15+
labels:
16+
app: backend
17+
spec:
18+
containers:
19+
- name: backend
20+
image: {{.Env.SERVICE_API_IMAGE_NAME}}
21+
imagePullPolicy: IfNotPresent
22+
ports:
23+
- containerPort: 8080
24+
envFrom:
25+
- configMapRef:
26+
name: azd-env-configmap
27+
resources:
28+
requests:
29+
memory: "2Gi"
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: backend-service
5+
namespace: azure-open-ai
6+
spec:
7+
type: ClusterIP
8+
ports:
9+
- protocol: TCP
10+
port: 80
11+
targetPort: 8080
12+
selector:
13+
app: backend

app/backend/manifests/ingress.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
apiVersion: networking.k8s.io/v1
2+
kind: Ingress
3+
metadata:
4+
name: ingress-api
5+
namespace: azure-open-ai
6+
# annotations:
7+
# nginx.ingress.kubernetes.io/use-regex: "true"
8+
# nginx.ingress.kubernetes.io/rewrite-target: /$2
9+
spec:
10+
ingressClassName: webapprouting.kubernetes.azure.com
11+
rules:
12+
- http:
13+
paths:
14+
- path: /api
15+
pathType: Prefix
16+
backend:
17+
service:
18+
name: backend-service
19+
port:
20+
number: 80
21+
- path: /
22+
pathType: Prefix
23+
backend:
24+
service:
25+
name: frontend-service
26+
port:
27+
number: 80

app/frontend/.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
manifests

app/frontend/Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,3 @@ COPY --from=build /app/nginx/nginx.conf.template /etc/nginx/conf.d
1919
EXPOSE 80
2020

2121
CMD ["/bin/sh", "-c", "envsubst < /etc/nginx/conf.d/nginx.conf.template > /etc/nginx/conf.d/default.conf && nginx -g \"daemon off;\""]
22-
#CMD ["/bin/sh", "-c", "nginx -g \"daemon off;\""]

app/frontend/Dockerfile-aks

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
FROM node:18-alpine AS build
2+
3+
# make the 'app' folder the current working directory
4+
WORKDIR /app
5+
6+
COPY . .
7+
8+
9+
# install project dependencies
10+
RUN npm install
11+
RUN npm run build
12+
13+
FROM nginx:alpine
14+
15+
WORKDIR /usr/share/nginx/html
16+
COPY --from=build /app/build .
17+
18+
EXPOSE 80
19+
20+
CMD ["/bin/sh", "-c", "nginx -g \"daemon off;\""]
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: frontend-deployment
5+
namespace: azure-open-ai
6+
labels:
7+
app: frontend
8+
spec:
9+
replicas: 1
10+
selector:
11+
matchLabels:
12+
app: frontend
13+
template:
14+
metadata:
15+
labels:
16+
app: frontend
17+
spec:
18+
containers:
19+
- name: frontend
20+
image: {{.Env.SERVICE_FRONTEND_IMAGE_NAME}}
21+
imagePullPolicy: IfNotPresent
22+
ports:
23+
- containerPort: 80
24+
envFrom:
25+
- configMapRef:
26+
name: azd-env-configmap
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: frontend-service
5+
namespace: azure-open-ai
6+
spec:
7+
type: ClusterIP
8+
ports:
9+
- protocol: TCP
10+
port: 80
11+
targetPort: 80
12+
selector:
13+
app: frontend

0 commit comments

Comments
 (0)