Skip to content

Commit 3a16328

Browse files
committed
Added ingress, shell script predeploy, aks readme, adjusted nginx conf for frontend
1 parent 12458f1 commit 3a16328

File tree

7 files changed

+478
-13
lines changed

7 files changed

+478
-13
lines changed

app/backend/manifests/ingress.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,17 @@ spec:
1111
rules:
1212
- http:
1313
paths:
14+
- path: /api
15+
pathType: Prefix
16+
backend:
17+
service:
18+
name: backend-service
19+
port:
20+
number: 80
1421
- path: /
1522
pathType: Prefix
1623
backend:
1724
service:
1825
name: frontend-service
1926
port:
20-
number: 80
27+
number: 80

app/frontend/Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ FROM nginx:alpine
1414

1515
WORKDIR /usr/share/nginx/html
1616
COPY --from=build /app/build .
17-
COPY --from=build /app/nginx/nginx.conf.template /etc/nginx/conf.d
17+
COPY --from=build /app/nginx/default.conf /etc/nginx/conf.d
1818

1919
EXPOSE 80
2020

21-
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;\""]
21+
#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/manifests/frontend-deployment.tmpl.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,3 @@ spec:
2424
envFrom:
2525
- configMapRef:
2626
name: azd-env-configmap
27-
env:
28-
- name: REACT_APP_API_BASE_URL
29-
value: "http://backend-service"

app/frontend/nginx/nginx.conf.template renamed to app/frontend/nginx/default.conf

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,4 @@ server {
88
root /usr/share/nginx/html;
99
index index.html index.htm;
1010
}
11-
12-
location /api {
13-
proxy_ssl_server_name on;
14-
proxy_http_version 1.1;
15-
proxy_pass $REACT_APP_API_BASE_URL;
16-
}
1711
}

deploy/aks/scripts/predeploy.sh

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/bin/bash
2+
3+
# Displaying the initial message
4+
echo "Loading azd .env file from current environment"
5+
6+
# Retrieve environment variables from the `.env` file using `azd env get-values`
7+
envData=$(azd env get-values)
8+
9+
# Create a temporary file to store environment variables
10+
tempEnvFile="temp_env_file"
11+
echo "$envData" > "$tempEnvFile"
12+
13+
# Get the current date in the required format
14+
date=$(date +"%Y-%m-%d %H:%M:%S")
15+
16+
# Start building the ConfigMap YAML content
17+
configMapContent="# Updated $date
18+
apiVersion: v1
19+
kind: ConfigMap
20+
metadata:
21+
name: azd-env-configmap
22+
data:
23+
"
24+
25+
# Read each line from the temp file and process it
26+
while IFS= read -r line; do
27+
if [[ $line =~ ^([^=]+)=(.*)$ ]]; then
28+
key="${BASH_REMATCH[1]}"
29+
value="${BASH_REMATCH[2]}"
30+
# Trim quotes from value
31+
trimmedValue="${value%\"}"
32+
trimmedValue="${trimmedValue#\"}"
33+
# Append to the ConfigMap content
34+
configMapContent+=" ${key}: \"${trimmedValue}\""$'\n'
35+
fi
36+
done < "$tempEnvFile"
37+
38+
# Specify the output file path for the ConfigMap
39+
outputFilePath="../../../app/backend/manifests/azd-env-configmap.yml"
40+
41+
# Check if the output file exists and remove it before creating a new one
42+
if [ -f "$outputFilePath" ]; then
43+
rm -f "$outputFilePath"
44+
fi
45+
46+
# Write the ConfigMap content to the file
47+
echo -e "$configMapContent" > "$outputFilePath"
48+
49+
# Cleaning up temporary files
50+
rm -f "$tempEnvFile"
51+
52+
echo "ConfigMap generated at $outputFilePath"

docs/aks/README-AKS.md

Lines changed: 415 additions & 0 deletions
Large diffs are not rendered by default.

docs/aks/aks-hla.png

216 KB
Loading

0 commit comments

Comments
 (0)