Skip to content
Snippets Groups Projects
Commit 8b790a21 authored by Sebastian Karius's avatar Sebastian Karius
Browse files

add nginx-cors

parent 601ee264
No related branches found
No related tags found
No related merge requests found
......@@ -39,11 +39,13 @@ helm-package:
- helm dep build helm/ti-coder
- helm package helm/ti-coder
- helm package helm/ti-lamp
- helm package helm/nginx-cors
artifacts:
paths:
- vdo-ninja-0.1.2.tgz
- ti-coder-0.2.6.tgz
- ti-lamp-0.1.2.tgz
- nginx-cors-0.1.0.tgz
expire_in: 1 hour
helm-publish:
......@@ -60,6 +62,7 @@ helm-publish:
- 'curl --request POST --user gitlab-ci-token:$CI_JOB_TOKEN --form "chart=@vdo-ninja-0.1.2.tgz" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/helm/api/stable/charts"'
- 'curl --request POST --user gitlab-ci-token:$CI_JOB_TOKEN --form "chart=@ti-coder-0.2.6.tgz" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/helm/api/stable/charts"'
- 'curl --request POST --user gitlab-ci-token:$CI_JOB_TOKEN --form "chart=@ti-lamp-0.1.2.tgz" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/helm/api/stable/charts"'
- 'curl --request POST --user gitlab-ci-token:$CI_JOB_TOKEN --form "chart=@nginx-cors-0.1.0.tgz" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/helm/api/stable/charts"'
stages:
- build
......
......@@ -37,4 +37,12 @@ services:
dockerfile: Dockerfile
context: ./docker/php-fpm_83
cache_from:
- ${CI_REGISTRY}/studio-r215/containerize/php-fpm:83
\ No newline at end of file
- ${CI_REGISTRY}/studio-r215/containerize/php-fpm:83
nginx-cors:
image: ${CI_REGISTRY}/studio-r215/containerize/nginx-cors:1.0.0
build:
dockerfile: Dockerfile
context: ./docker/nginx-cors
cache_from:
- ${CI_REGISTRY}/studio-r215/containerize/nginx-cors:1.0.0
\ No newline at end of file
FROM nginx:alpine
COPY nginx.conf.template nginx.conf.template
CMD [ "/bin/sh" , "-c" , "envsubst < /nginx.conf.template > /etc/nginx/nginx.conf && exec nginx -g 'daemon off;'" ]
\ No newline at end of file
upstream api {
# Could be host.docker.internal - Docker for Mac/Windows - the host itself
# Could be your API in a appropriate domain
# Could be other container in the same network, like container_name:port
server ${API_URL};
}
server {
listen 80;
server_name localhost;
location / {
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Headers' 'Authorization,Accept,Origin,DNT,X-CustomHeader,Keep-Alive,User-Agent,
X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range';
add_header 'Access-Control-Allow-Methods' 'GET,POST,OPTIONS,PUT,DELETE,PATCH';
add_header 'Content-Type' 'application/json';
add_header 'Content-Length' 0;
return 204;
}
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Headers' 'Authorization,Accept,Origin,DNT,X-CustomHeader,Keep-Alive,User-Agent,
X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range';
add_header 'Access-Control-Allow-Methods' 'GET,POST,OPTIONS,PUT,DELETE,PATCH';
proxy_pass http://api/;
}
}
\ No newline at end of file
# 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/
apiVersion: v2
name: nginx-cors
description: Nginx reverse proxy with cors set to *
# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.0.0"
Installed nginx cors * reverse proxy.
https://{{ .Values.url }}
\ No newline at end of file
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-cors
labels:
app: nginx-cors
spec:
replicas: 1
selector:
matchLabels:
app: nginx-cors
template:
metadata:
name: nginx-cors
labels:
app: nginx-cors
spec:
containers:
- name: nginx-cors
image: "mcr.informatik.uni-halle.de/studio-r215/containerize/nginx-cors:{{ .Chart.AppVersion }}"
resources:
requests:
memory: "64Mi"
cpu: "50m"
limits:
memory: "128Mi"
cpu: "100m"
env:
- name: API_URL
value: {{ .Values.api }}
ports:
- containerPort: 80
readinessProbe:
httpGet:
port: 80
initialDelaySeconds: 10
periodSeconds: 20
restartPolicy: Always
\ No newline at end of file
{{- if .Values.url }}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: nginx-cors-ingress
labels:
app: nginx-cors
spec:
rules:
- host: "{{ .Values.url }}.tikube.informatik.uni-halle.de"
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: nginx-cors-service
port:
number: 80
{{- end }}
\ No newline at end of file
apiVersion: v1
kind: Service
metadata:
name: nginx-cors-service
labels:
app: nginx-cors
spec:
selector:
app: nginx-cors
ports:
- protocol: TCP
port: 80
targetPort: 80
type: ClusterIP
\ No newline at end of file
# url definiert den URL Prefix für die Anwendung. Wenn url nicht definiert ist, wird der Ingress nicht erstellt.
url: ~
api: ~
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment