-
-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Frontend + Backend Integrated Deployment (K8s only) #45
Merged
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,3 +21,4 @@ | |
.idea/ | ||
*.tmproj | ||
.vscode/ | ||
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
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 |
---|---|---|
@@ -0,0 +1,99 @@ | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ .Values.name }}-frontend | ||
namespace: {{ .Release.Namespace }} | ||
|
||
spec: | ||
selector: | ||
matchLabels: | ||
app: {{ .Values.name }} | ||
role: frontend | ||
replicas: 1 | ||
template: | ||
metadata: | ||
labels: | ||
app: {{ .Values.name }} | ||
role: frontend | ||
|
||
annotations: | ||
# force helm to update the deployment each time | ||
{{- if not .Values.backend_only }} | ||
"helm.update": {{ randAlphaNum 5 | quote }} | ||
{{- end }} | ||
|
||
|
||
spec: | ||
volumes: | ||
- name: nginx-resolver | ||
emptyDir: {} | ||
|
||
initContainers: | ||
- name: init-nginx | ||
image: {{ .Values.nginx_image }} | ||
command: ["/bin/sh"] | ||
args: ["-c", "echo resolver $(awk 'BEGIN{ORS=\" \"} $1==\"nameserver\" {print $2}' /etc/resolv.conf) valid=30s \";\" > /etc/nginx/resolvers/resolvers.conf"] | ||
volumeMounts: | ||
- name: nginx-resolver | ||
mountPath: /etc/nginx/resolvers/ | ||
|
||
|
||
containers: | ||
- name: nginx | ||
image: {{ .Values.nginx_image }} | ||
imagePullPolicy: {{ .Values.nginx_pull_policy }} | ||
volumeMounts: | ||
- name: nginx-resolver | ||
mountPath: /etc/nginx/resolvers/ | ||
readOnly: true | ||
|
||
resources: | ||
limits: | ||
cpu: {{ .Values.nginx_limit_cpu }} | ||
|
||
requests: | ||
cpu: {{ .Values.nginx_requests_cpu }} | ||
|
||
readinessProbe: | ||
httpGet: | ||
path: /healthz | ||
port: 80 | ||
|
||
--- | ||
|
||
apiVersion: v1 | ||
kind: Service | ||
|
||
metadata: | ||
namespace: {{ .Release.Namespace }} | ||
name: {{ .Values.name }}-frontend | ||
labels: | ||
app: {{ .Values.name }} | ||
role: frontend | ||
|
||
{{- if .Values.service }} | ||
{{- if .Values.service.annotations }} | ||
annotations: | ||
{{- range $key, $val := .Values.service.annotations }} | ||
{{ $key }}: {{ $val | quote }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
spec: | ||
selector: | ||
app: {{ .Values.name }} | ||
role: frontend | ||
|
||
{{- if .Values.service }} | ||
{{- if .Values.service.type }} | ||
type: {{ .Values.service.type | quote }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
ports: | ||
- protocol: TCP | ||
port: 80 | ||
name: 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
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,6 @@ | ||
FROM nginx | ||
|
||
COPY ./index.html /usr/share/nginx/html | ||
COPY ./dist/main.js /usr/share/nginx/html | ||
COPY ./nginx.conf /etc/nginx/nginx.conf | ||
|
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,78 @@ | ||
worker_processes 1; | ||
error_log stderr; | ||
pid /var/run/nginx.pid; | ||
events { | ||
worker_connections 1024; | ||
} | ||
|
||
http { | ||
include /etc/nginx/mime.types; | ||
default_type application/octet-stream; | ||
log_format main '$remote_addr - $remote_user [$time_local] "$request" ' | ||
'$status $body_bytes_sent "$http_referer" ' | ||
'"$http_user_agent" "$http_x_forwarded_for"'; | ||
access_log /dev/stdout; | ||
sendfile on; | ||
keepalive_timeout 65; | ||
include ./resolvers/resolvers.conf; | ||
server { | ||
listen 80 default_server; | ||
server_name _; | ||
proxy_buffering off; | ||
proxy_buffers 16 64k; | ||
proxy_buffer_size 64k; | ||
root /usr/share/nginx/html; | ||
index index.html index.htm; | ||
|
||
error_page 500 501 502 503 504 /50x.html; | ||
|
||
merge_slashes off; | ||
location = /50x.html { | ||
root /usr/share/nginx/html; | ||
} | ||
|
||
# fallback to index for any page | ||
error_page 404 /index.html; | ||
|
||
location ~* /watch/([^/]+)/([^/]+)/ws { | ||
set $archive $1; | ||
set $crawl $2; | ||
#auth_request /authcheck; | ||
|
||
proxy_pass http://$2.crawlers.svc.cluster.local:9037/ws; | ||
proxy_set_header Host "localhost"; | ||
|
||
proxy_http_version 1.1; | ||
proxy_set_header Upgrade $http_upgrade; | ||
proxy_set_header Connection $http_connection; | ||
} | ||
|
||
location ~* /watch/([^/]+)/([^/]+)/ { | ||
set $archive $1; | ||
set $crawl $2; | ||
#auth_request /authcheck; | ||
|
||
proxy_pass http://$2.crawlers.svc.cluster.local:9037/; | ||
proxy_set_header Host "localhost"; | ||
} | ||
|
||
location = /authcheck { | ||
internal; | ||
proxy_pass http://localhost:8000/archives/$archive/crawls/$crawl; | ||
proxy_pass_request_body off; | ||
proxy_set_header Content-Length ""; | ||
} | ||
|
||
location /healthz { | ||
return 200; | ||
} | ||
|
||
location / { | ||
#proxy_pass http://localhost:8000/; | ||
#proxy_set_header Host $host; | ||
root /usr/share/nginx/html; | ||
index index.html index.htm; | ||
} | ||
} | ||
} | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#46