nginx: Move uploads handling into app_frontend_base.

As uploads are a feature of the application, not of a generic nginx
deployment, move them into the `zulip::app_frontend_base` class.  This
is purely for organizational clarity -- we do not support deployments
with has `zulip::nginx` but not `zulip::app_frontend_base`.
This commit is contained in:
Alex Vandiver 2022-12-06 02:45:10 +00:00 committed by Alex Vandiver
parent 79fb2c38fb
commit 497abc2e48
2 changed files with 34 additions and 41 deletions

View File

@ -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.

View File

@ -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],