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.

nginx: Move uploads handling into app_frontend_base.

Alex Vandiver497abc2e48ff
diff --git a/puppet/zulip/manifests/app_frontend_base.pp b/puppet/zulip/manifests/app_frontend_base.pp
index ba6df815e81..583b9c505e1 100644
--- a/puppet/zulip/manifests/app_frontend_base.pp
+++ b/puppet/zulip/manifests/app_frontend_base.pp
@@ -69,6 +69,40 @@ class zulip::app_frontend_base {
notify => Service['nginx'],
}
+ # 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 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', false)
+ if $no_serve_uploads {
+ file { '/etc/nginx/zulip-include/app.d/uploads-internal.conf':
+ ensure => absent,
+ }
+ } else {
+ file { '/etc/nginx/zulip-include/app.d/uploads-internal.conf':
+ ensure => file,
+ require => Package[$zulip::common::nginx],
+ owner => 'root',
+ group => 'root',
+ mode => '0644',
+ notify => Service['nginx'],
+ source => 'puppet:///modules/zulip/nginx/zulip-include-maybe/uploads-internal.conf',
+ }
+ }
+
+ # TODO/compatibility: Removed 2021-04 in Zulip 4.0; these lines can
+ # be removed once one must have upgraded through Zulip 4.0 or higher
+ # to get to the next release.
+ file { ['/etc/nginx/zulip-include/uploads.route', '/etc/nginx/zulip-include/app.d/thumbor.conf']:
+ ensure => absent,
+ }
+
# This determines whether we run queue processors multithreaded or
# multiprocess. Multiprocess scales much better, but requires more
# RAM; we just auto-detect based on available system RAM.
diff --git a/puppet/zulip/manifests/nginx.pp b/puppet/zulip/manifests/nginx.pp
index aa8c7b94241..5895bfd6bee 100644
--- a/puppet/zulip/manifests/nginx.pp
+++ b/puppet/zulip/manifests/nginx.pp
@@ -29,47 +29,6 @@ class zulip::nginx {
notify => Service['nginx'],
}
- # 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 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', false)
- if $no_serve_uploads {
- file { '/etc/nginx/zulip-include/app.d/uploads-internal.conf':
- ensure => absent,
- }
- } else {
- file { '/etc/nginx/zulip-include/app.d/uploads-internal.conf':
- ensure => file,
- require => Package[$zulip::common::nginx],
- owner => 'root',
- group => 'root',
- mode => '0644',
- notify => Service['nginx'],
- source => 'puppet:///modules/zulip/nginx/zulip-include-maybe/uploads-internal.conf',
- }
- }
-
- # TODO/compatibility: Removed 2021-04 in Zulip 4.0; these lines can
- # be removed once one must have upgraded through Zulip 4.0 or higher
- # to get to the next release.
- file { '/etc/nginx/zulip-include/uploads.route':
- ensure => absent,
- }
-
- # TODO/compatibility: Removed 2021-05 in Zulip 4.0; these lines can
- # be removed once one must have upgraded through Zulip 4.0 or higher
- # to get to the next release.
- file { '/etc/nginx/zulip-include/app.d/thumbor.conf':
- ensure => absent,
- }
-
file { '/etc/nginx/dhparam.pem':
ensure => file,
require => Package[$zulip::common::nginx],