-
-
Notifications
You must be signed in to change notification settings - Fork 396
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Kubernetes configuration for the frontend.Aadd Kubernetes configu…
…ration for the frontend.
- Loading branch information
Showing
6 changed files
with
167 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
kind: PersistentVolumeClaim | ||
apiVersion: v1 | ||
metadata: | ||
name: po-data | ||
labels: | ||
app: po | ||
spec: | ||
accessModes: | ||
- ReadWriteMany | ||
resources: | ||
requests: | ||
storage: 1Gi |
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,67 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: po-frontend-config | ||
labels: | ||
app: po | ||
component: frontend | ||
data: | ||
nginx.conf: | | ||
server { | ||
listen 80; | ||
listen [::]:80; | ||
# Product Opener needs a root domain + a wildcard for all subdomains | ||
server_name po.992d6328c7ec48169146.westeurope.aksapp.io *.po.992d6328c7ec48169146.westeurope.aksapp.io; | ||
root /opt/product-opener/html/; | ||
gzip on; | ||
gzip_min_length 1000; | ||
# Add index.php to the list if you are using PHP | ||
index index.html index.htm index.nginx-debian.html; | ||
location ~* \.(eot|ttf|woff|woff2)$ { | ||
add_header Access-Control-Allow-Origin *; | ||
} | ||
location ~ ^/images/products/ { | ||
add_header Link "<https://creativecommons.org/licenses/by-sa/3.0/>; rel='license'; title='CC-BY-SA 3.0'"; | ||
} | ||
location ~ ^/(favicon.ico) { | ||
# First attempt to serve request as file, then | ||
# as directory, then fall back to displaying a 404. | ||
try_files $uri $uri/ =404; | ||
} | ||
# Static files are served directly by NGINX | ||
location ~ ^/(.well-known|images|js|css|rss|data|files|resources|foundation|bower_components)/ { | ||
# First attempt to serve request as file, then | ||
# as directory, then fall back to displaying a 404. | ||
try_files $uri $uri/ =404; | ||
} | ||
location = /robots.txt { | ||
try_files $uri $uri/ =404; | ||
} | ||
# Dynamically generated files and CGI scripts are passed | ||
# to the Apache + mod_perl server running on the backend container | ||
location / { | ||
proxy_set_header Host $host; | ||
proxy_set_header X-Real-IP $remote_addr; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
proxy_pass http://example.org/cgi/display.pl?; | ||
} | ||
location /cgi/ { | ||
proxy_set_header Host $host; | ||
proxy_set_header X-Real-IP $remote_addr; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
proxy_pass http://example.org; | ||
} | ||
} |
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,42 @@ | ||
apiVersion: extensions/v1beta1 | ||
kind: Deployment | ||
metadata: | ||
name: po-frontend | ||
labels: | ||
app: po | ||
component: frontend | ||
spec: | ||
replicas: 1 | ||
template: | ||
metadata: | ||
labels: | ||
app: po | ||
component: frontend | ||
spec: | ||
containers: | ||
- name: po-frontend | ||
image: openfoodfacts/productopener-frontend | ||
lifecycle: | ||
postStart: | ||
exec: | ||
command: | ||
- '/bin/sh' | ||
- '-c' | ||
- > | ||
cp -Lrf /tmp/nginx.conf /etc/nginx/conf.d/default.conf; | ||
nginx -s reload; touch /var/log/nginx/conf.done | ||
ports: | ||
- containerPort: 80 | ||
volumeMounts: | ||
- name: frontend-config | ||
mountPath: "/tmp/nginx.conf" | ||
subPath: nginx.conf | ||
- name: product-images | ||
mountPath: "/opt/product-opener/html/images/products/" | ||
volumes: | ||
- name: frontend-config | ||
configMap: | ||
name: po-frontend-config | ||
- name: product-images | ||
persistentVolumeClaim: | ||
claimName: po-images |
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,16 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: po-frontend | ||
labels: | ||
app: po | ||
component: frontend | ||
spec: | ||
type: LoadBalancer | ||
ports: | ||
- port: 80 | ||
protocol: TCP | ||
name: http | ||
selector: | ||
app: po | ||
component: frontend |
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,12 @@ | ||
kind: PersistentVolumeClaim | ||
apiVersion: v1 | ||
metadata: | ||
name: po-images | ||
labels: | ||
app: po | ||
spec: | ||
accessModes: | ||
- ReadWriteMany | ||
resources: | ||
requests: | ||
storage: 1Gi |
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,18 @@ | ||
apiVersion: extensions/v1beta1 | ||
kind: Ingress | ||
metadata: | ||
name: po | ||
labels: | ||
app: po | ||
spec: | ||
backend: | ||
serviceName: po-frontend | ||
servicePort: 80 | ||
rules: | ||
- host: "*.po.992d6328c7ec48169146.westeurope.aksapp.io" | ||
http: | ||
paths: | ||
- path: / | ||
backend: | ||
serviceName: po-frontend | ||
servicePort: 80 |