-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Django required to collect the static and service with a HTTP server. We add an Nginx container in the pods and add an init container to collect this statics. And use an ephemeral volume for static instead of a persistent one.
- Loading branch information
Showing
7 changed files
with
146 additions
and
53 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,90 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: "{{ template "jenny.fullname" . }}-nginx" | ||
data: | ||
config: | | ||
# nginx.conf | ||
user nobody nogroup; | ||
# 'user nobody nobody;' for systems with 'nobody' as a group instead | ||
error_log /var/log/nginx/error.log warn; | ||
pid /var/run/nginx.pid; | ||
events { | ||
worker_connections 1024; # increase if you have lots of clients | ||
accept_mutex off; # set to 'on' if nginx worker_processes > 1 | ||
# 'use epoll;' to enable for Linux 2.6+ | ||
# 'use kqueue;' to enable for FreeBSD, OSX | ||
} | ||
http { | ||
upstream django_app { | ||
server localhost:{{ .Values.django.port }}; | ||
} | ||
server { | ||
listen {{ .Values.nginx.port }}; | ||
root /usr/share/nginx; | ||
location / { | ||
# checks for static file, if not found proxy to app | ||
try_files $uri @proxy_to_app; | ||
} | ||
location @proxy_to_app { | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
proxy_set_header Host $host; | ||
proxy_redirect off; | ||
proxy_pass http://django_app; | ||
} | ||
} | ||
types { | ||
text/html html htm shtml; | ||
text/css css; | ||
text/xml xml rss; | ||
image/gif gif; | ||
image/jpeg jpeg jpg; | ||
application/x-javascript js; | ||
text/plain txt; | ||
text/x-component htc; | ||
text/mathml mml; | ||
image/png png; | ||
image/x-icon ico; | ||
image/x-jng jng; | ||
image/vnd.wap.wbmp wbmp; | ||
application/java-archive jar war ear; | ||
application/mac-binhex40 hqx; | ||
application/pdf pdf; | ||
application/x-cocoa cco; | ||
application/x-java-archive-diff jardiff; | ||
application/x-java-jnlp-file jnlp; | ||
application/x-makeself run; | ||
application/x-perl pl pm; | ||
application/x-pilot prc pdb; | ||
application/x-rar-compressed rar; | ||
application/x-redhat-package-manager rpm; | ||
application/x-sea sea; | ||
application/x-shockwave-flash swf; | ||
application/x-stuffit sit; | ||
application/x-tcl tcl tk; | ||
application/x-x509-ca-cert der pem crt; | ||
application/x-xpinstall xpi; | ||
application/zip zip; | ||
application/octet-stream deb; | ||
application/octet-stream bin exe dll; | ||
application/octet-stream dmg; | ||
application/octet-stream eot; | ||
application/octet-stream iso img; | ||
application/octet-stream msi msp msm; | ||
audio/mpeg mp3; | ||
audio/x-realaudio ra; | ||
video/mpeg mpeg mpg; | ||
video/quicktime mov; | ||
video/x-flv flv; | ||
video/x-msvideo avi; | ||
video/x-ms-wmv wmv; | ||
video/x-ms-asf asx asf; | ||
video/x-mng mng; | ||
} | ||
} |
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
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