mirror of https://github.com/zulip/zulip.git
Run a local camo server in voyager production environments.
Camo is a caching image proxy, used in Zulip to avoid mixed-content warnings by proxying HTTP image content over HTTPS. We've been using it in zulip.com production for years; this change makes it available in standalone Zulip deployments.
This commit is contained in:
parent
65207477c4
commit
52c1e8ac7d
|
@ -0,0 +1,7 @@
|
||||||
|
# Proxies /external_content to a local installation of the camo image
|
||||||
|
# proxy software
|
||||||
|
location /external_content {
|
||||||
|
rewrite /external_content/(.*) /$1 break;
|
||||||
|
proxy_pass http://camo;
|
||||||
|
include /etc/nginx/zulip-include/proxy;
|
||||||
|
}
|
|
@ -10,3 +10,7 @@ upstream tornado {
|
||||||
upstream localhost_sso {
|
upstream localhost_sso {
|
||||||
server localhost:8888;
|
server localhost:8888;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
upstream camo {
|
||||||
|
server localhost:9292;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
class zulip::localhost_camo {
|
||||||
|
include zulip::camo
|
||||||
|
|
||||||
|
# Install nginx configuration to run camo locally
|
||||||
|
file { "/etc/nginx/zulip-include/app.d/camo.conf":
|
||||||
|
require => Package["nginx-full"],
|
||||||
|
ensure => file,
|
||||||
|
owner => "root",
|
||||||
|
group => "root",
|
||||||
|
mode => 644,
|
||||||
|
notify => Service["nginx"],
|
||||||
|
source => "puppet:///modules/zulip/nginx/zulip-include-app.d/camo.conf",
|
||||||
|
}
|
||||||
|
}
|
|
@ -17,4 +17,5 @@ class zulip::voyager {
|
||||||
include zulip::memcached
|
include zulip::memcached
|
||||||
include zulip::rabbit
|
include zulip::rabbit
|
||||||
include zulip::redis
|
include zulip::redis
|
||||||
|
include zulip::localhost_camo
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,6 +42,12 @@ fi
|
||||||
cp -a /root/zulip/zproject/local_settings_template.py /etc/zulip/settings.py
|
cp -a /root/zulip/zproject/local_settings_template.py /etc/zulip/settings.py
|
||||||
ln -nsf /etc/zulip/settings.py /root/zulip/zproject/local_settings.py
|
ln -nsf /etc/zulip/settings.py /root/zulip/zproject/local_settings.py
|
||||||
|
|
||||||
|
# Restart camo since generate_secrets.py likely replaced its secret key
|
||||||
|
if [ -z "$TRAVIS" ]; then
|
||||||
|
# We don't run this in Travis CI due to a weird hang bug
|
||||||
|
service camo restart
|
||||||
|
fi
|
||||||
|
|
||||||
if ! rabbitmqctl status >/dev/null; then
|
if ! rabbitmqctl status >/dev/null; then
|
||||||
set +x
|
set +x
|
||||||
echo; echo "RabbitMQ seems to not have started properly after the installation process."
|
echo; echo "RabbitMQ seems to not have started properly after the installation process."
|
||||||
|
|
|
@ -18,7 +18,7 @@ apt-get update
|
||||||
apt-mark hold initramfs-tools initramfs-tools-bin oracle-java8-installer udev linux-image-3.19.0-28-generic linux-image-generic-lts-vivid base-files linux-firmware chromium-browser google-chrome-stable g++-4.8 gcc-4.8 cpp-4.8 openjdk-6-jre-headless openjdk-7-jre-headless
|
apt-mark hold initramfs-tools initramfs-tools-bin oracle-java8-installer udev linux-image-3.19.0-28-generic linux-image-generic-lts-vivid base-files linux-firmware chromium-browser google-chrome-stable g++-4.8 gcc-4.8 cpp-4.8 openjdk-6-jre-headless openjdk-7-jre-headless
|
||||||
apt-get upgrade -y $APT_OPTIONS
|
apt-get upgrade -y $APT_OPTIONS
|
||||||
# Install Zulip
|
# Install Zulip
|
||||||
/root/zulip/scripts/setup/install
|
env TRAVIS=1 /root/zulip/scripts/setup/install
|
||||||
|
|
||||||
cat >>/etc/zulip/settings.py <<EOF
|
cat >>/etc/zulip/settings.py <<EOF
|
||||||
# Travis CI override settings above
|
# Travis CI override settings above
|
||||||
|
|
|
@ -300,7 +300,10 @@ AUTH_LDAP_USER_ATTR_MAP = {
|
||||||
"full_name": "cn",
|
"full_name": "cn",
|
||||||
}
|
}
|
||||||
|
|
||||||
CAMO_URI = ''
|
# The default CAMO_URI of '/external_content/' is served by the camo
|
||||||
|
# setup in the default Voyager nginx configuration. Setting CAMO_URI
|
||||||
|
# to '' will disable the Camo integration.
|
||||||
|
CAMO_URI = '/external_content/'
|
||||||
|
|
||||||
# RabbitMQ configuration
|
# RabbitMQ configuration
|
||||||
#
|
#
|
||||||
|
|
|
@ -98,6 +98,8 @@ else:
|
||||||
NEW_USER_BOT = "new-user-bot@zulip.com"
|
NEW_USER_BOT = "new-user-bot@zulip.com"
|
||||||
EMAIL_GATEWAY_BOT = "emailgateway@zulip.com"
|
EMAIL_GATEWAY_BOT = "emailgateway@zulip.com"
|
||||||
EXTRA_INSTALLED_APPS = ["zilencer", "analytics"]
|
EXTRA_INSTALLED_APPS = ["zilencer", "analytics"]
|
||||||
|
# Disable Camo in development
|
||||||
|
CAMO_URI = ''
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
# DEFAULT VALUES FOR SETTINGS
|
# DEFAULT VALUES FOR SETTINGS
|
||||||
|
|
|
@ -13,9 +13,13 @@ DATABASES["default"] = {"NAME": "zulip_test",
|
||||||
|
|
||||||
|
|
||||||
if "TORNADO_SERVER" in os.environ:
|
if "TORNADO_SERVER" in os.environ:
|
||||||
|
# This covers the Casper test suite case
|
||||||
TORNADO_SERVER = os.environ["TORNADO_SERVER"]
|
TORNADO_SERVER = os.environ["TORNADO_SERVER"]
|
||||||
else:
|
else:
|
||||||
|
# This covers the backend test suite case
|
||||||
TORNADO_SERVER = None
|
TORNADO_SERVER = None
|
||||||
|
CAMO_URI = 'https://external-content.zulipcdn.net/'
|
||||||
|
CAMO_KEY = 'dummy'
|
||||||
|
|
||||||
# Decrease the get_updates timeout to 1 second.
|
# Decrease the get_updates timeout to 1 second.
|
||||||
# This allows CasperJS to proceed quickly to the next test step.
|
# This allows CasperJS to proceed quickly to the next test step.
|
||||||
|
@ -54,7 +58,4 @@ CACHES['database'] = {
|
||||||
LOGGING['loggers']['zulip.requests']['level'] = 'CRITICAL'
|
LOGGING['loggers']['zulip.requests']['level'] = 'CRITICAL'
|
||||||
LOGGING['loggers']['zulip.management']['level'] = 'CRITICAL'
|
LOGGING['loggers']['zulip.management']['level'] = 'CRITICAL'
|
||||||
|
|
||||||
CAMO_URI = 'https://external-content.zulipcdn.net/'
|
|
||||||
CAMO_KEY = 'dummy'
|
|
||||||
|
|
||||||
LOCAL_UPLOADS_DIR = 'test_uploads'
|
LOCAL_UPLOADS_DIR = 'test_uploads'
|
||||||
|
|
Loading…
Reference in New Issue