Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

puppet: Also move avatars to the same nginx include file.

Alex Vandiver93f3b41811da
diff --git a/puppet/zulip/files/nginx/zulip-include-maybe/uploads-internal.conf b/puppet/zulip/files/nginx/zulip-include-maybe/uploads-internal.conf
index add9e1fbc62..ca5c966f38b 100644
--- a/puppet/zulip/files/nginx/zulip-include-maybe/uploads-internal.conf
+++ b/puppet/zulip/files/nginx/zulip-include-maybe/uploads-internal.conf
@@ -5,3 +5,10 @@ location /serve_uploads {
include /etc/nginx/zulip-include/uploads.types;
alias /home/zulip/uploads/files;
}
+
+location /user_avatars {
+ include /etc/nginx/zulip-include/headers;
+ add_header Content-Security-Policy "default-src 'none' img-src 'self'";
+ include /etc/nginx/zulip-include/uploads.types;
+ alias /home/zulip/uploads/avatars;
+}
diff --git a/puppet/zulip/manifests/nginx.pp b/puppet/zulip/manifests/nginx.pp
index 418fdd87000..ad380248f14 100644
--- a/puppet/zulip/manifests/nginx.pp
+++ b/puppet/zulip/manifests/nginx.pp
@@ -29,15 +29,16 @@ class zulip::nginx {
notify => Service['nginx'],
}
- # Configuration for how uploaded files are served. The default is
- # to serve uploaded files using using the `nginx` `internal`
- # feature via django-sendfile2, which basically does an internal
- # redirect and returns the file content from nginx in an
- # HttpResponse that would otherwise have been a redirect.
+ # Configuration for how uploaded files and profile pictures are
+ # served. The default is to serve uploads using using the `nginx`
+ # `internal` feature via django-sendfile2, which basically does an
+ # internal redirect and returns the file content from nginx in an
+ # HttpResponse that would otherwise have been a redirect. Profile
+ # pictures are served directly off disk.
#
# For installations using S3 to serve uploaded files, we want Django
- # to handle the /serve_uploads route, so that it can do authentication
- # and serve a redirect.
+ # to handle the /serve_uploads and /user_avatars routes, so that it
+ # can serve a redirect (after doing authentication, for uploads).
$no_serve_uploads = zulipconf('application_server', 'no_serve_uploads', '')
if $no_serve_uploads == '' {
file { '/etc/nginx/zulip-include/app.d/uploads-internal.conf':
diff --git a/puppet/zulip/templates/nginx/zulip-enterprise.template.erb b/puppet/zulip/templates/nginx/zulip-enterprise.template.erb
index 42565a9de60..87fa6bcf2f6 100644
--- a/puppet/zulip/templates/nginx/zulip-enterprise.template.erb
+++ b/puppet/zulip/templates/nginx/zulip-enterprise.template.erb
@@ -26,15 +26,6 @@ server {
ssl_certificate_key <%= @ssl_dir %>/private/zulip.key;
<% end -%>
-<% if @no_serve_uploads == '' -%>
- location /user_avatars {
- include /etc/nginx/zulip-include/headers;
- add_header Content-Security-Policy "default-src 'none' img-src 'self'";
- include /etc/nginx/zulip-include/uploads.types;
- alias /home/zulip/uploads/avatars;
- }
-<% end -%>
-
location /local-static {
alias /home/zulip/local-static;
}