mirror of
				https://github.com/zulip/docker-zulip.git
				synced 2025-11-03 21:43:26 +00:00 
			
		
		
		
	Added script changes according to my pull request
This commit is contained in:
		@@ -44,7 +44,7 @@ try:
 | 
			
		||||
    os.environ['DJANGO_SETTINGS_MODULE'] = 'zproject.settings'
 | 
			
		||||
    from django.conf import settings
 | 
			
		||||
    remote_postgres_host = settings.REMOTE_POSTGRES_HOST
 | 
			
		||||
except ImportError, e:
 | 
			
		||||
except ImportError as e:
 | 
			
		||||
    # process_fts_updates also supports running locally on a remote
 | 
			
		||||
    # postgres server; in that case, one can just connect to localhost
 | 
			
		||||
    remote_postgres_host = ''
 | 
			
		||||
 
 | 
			
		||||
@@ -133,4 +133,13 @@ class zulip::app_frontend_base {
 | 
			
		||||
  file { "/etc/cron.d/email-mirror":
 | 
			
		||||
    ensure => absent,
 | 
			
		||||
  }
 | 
			
		||||
  file { "/usr/lib/nagios/plugins/zulip_app_frontend":
 | 
			
		||||
    require => Package[nagios-plugins-basic],
 | 
			
		||||
    recurse => true,
 | 
			
		||||
    purge => true,
 | 
			
		||||
    owner => "root",
 | 
			
		||||
    group => "root",
 | 
			
		||||
    mode => 755,
 | 
			
		||||
    source => "puppet:///modules/zulip/nagios_plugins/zulip_app_frontend",
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -10,6 +10,8 @@ class zulip::base {
 | 
			
		||||
                     "ipython",
 | 
			
		||||
                     # Used in scripts
 | 
			
		||||
                     "netcat",
 | 
			
		||||
                     # Nagios plugins; needed to ensure /var/lib/nagios_plugins exists
 | 
			
		||||
                     "nagios-plugins-basic",
 | 
			
		||||
                     ]
 | 
			
		||||
  package { $base_packages: ensure => "installed" }
 | 
			
		||||
 | 
			
		||||
@@ -81,4 +83,14 @@ class zulip::base {
 | 
			
		||||
    group  => 'zulip',
 | 
			
		||||
    mode   => 640,
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  file { "/usr/lib/nagios/plugins/zulip_base":
 | 
			
		||||
    require => Package[nagios-plugins-basic],
 | 
			
		||||
    recurse => true,
 | 
			
		||||
    purge => true,
 | 
			
		||||
    owner => "root",
 | 
			
		||||
    group => "root",
 | 
			
		||||
    mode => 755,
 | 
			
		||||
    source => "puppet:///modules/zulip/nagios_plugins/zulip_base",
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -56,5 +56,14 @@ class zulip::postgres_appdb_base {
 | 
			
		||||
    mode => 644,
 | 
			
		||||
    source => "puppet:///modules/zulip/postgresql/zulip_english.stop",
 | 
			
		||||
  }
 | 
			
		||||
  file { "/usr/lib/nagios/plugins/zulip_postgres_appdb":
 | 
			
		||||
    require => Package[nagios-plugins-basic],
 | 
			
		||||
    recurse => true,
 | 
			
		||||
    purge => true,
 | 
			
		||||
    owner => "root",
 | 
			
		||||
    group => "root",
 | 
			
		||||
    mode => 755,
 | 
			
		||||
    source => "puppet:///modules/zulip/nagios_plugins/zulip_postgres_appdb",
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -23,4 +23,13 @@ class zulip::postgres_common {
 | 
			
		||||
    command => "/usr/bin/dpkg-divert --rename --divert /etc/logrotate.d/postgresql-common.disabled --add /etc/logrotate.d/postgresql-common",
 | 
			
		||||
    creates => '/etc/logrotate.d/postgresql-common.disabled',
 | 
			
		||||
  }
 | 
			
		||||
  file { "/usr/lib/nagios/plugins/zulip_postgres_common":
 | 
			
		||||
    require => Package[nagios-plugins-basic],
 | 
			
		||||
    recurse => true,
 | 
			
		||||
    purge => true,
 | 
			
		||||
    owner => "root",
 | 
			
		||||
    group => "root",
 | 
			
		||||
    mode => 755,
 | 
			
		||||
    source => "puppet:///modules/zulip/nagios_plugins/zulip_postgres_common",
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -5,10 +5,10 @@ set -xe
 | 
			
		||||
APT_OPTIONS="${APT_OPTIONS:-}"
 | 
			
		||||
# Install additional packages using apt
 | 
			
		||||
ADDITIONAL_PACKAGES=${ADDITIONAL_PACKAGES:-}
 | 
			
		||||
# Call the default type "voyager", for docker it's "dockervoyager"
 | 
			
		||||
# Call the default type "voyager", for docker it's the same
 | 
			
		||||
DEPLOYMENT_TYPE="${DEPLOYMENT_TYPE:-voyager}"
 | 
			
		||||
# Can be for example "zulip::dockervoyager" or "zulip::voyager"
 | 
			
		||||
VOYAGER_CLASS="${VOYAGER_CLASS:-zulip::voyager}"
 | 
			
		||||
# Can be for example "dockervoyager" or voyager
 | 
			
		||||
PUPPET_CLASSES="${PUPPET_CLASSES:-zulip::voyager}"
 | 
			
		||||
 | 
			
		||||
# Assumes we've already been untarred
 | 
			
		||||
 | 
			
		||||
@@ -26,13 +26,13 @@ apt-get install -y puppet git python $ADDITIONAL_PACKAGES
 | 
			
		||||
 | 
			
		||||
mkdir -p /etc/zulip
 | 
			
		||||
 | 
			
		||||
echo -e "[machine]\npuppet_classes = $VOYAGER_CLASS\ndeploy_type = voyager" > /etc/zulip/zulip.conf
 | 
			
		||||
echo -e "[machine]\npuppet_classes = $PUPPET_CLASSES\ndeploy_type = $DEPLOYMENT_TYPE" > /etc/zulip/zulip.conf
 | 
			
		||||
/root/zulip/scripts/zulip-puppet-apply -f
 | 
			
		||||
 | 
			
		||||
# These server restarting bits should be moveable into puppet-land, ideally
 | 
			
		||||
apt-get -y upgrade
 | 
			
		||||
# Don't start services when deploying in docker aka dockervoyager
 | 
			
		||||
if [ "$DEPLOYMENT_TYPE" != "dockervoyager" ]; then
 | 
			
		||||
if [ "$DEPLOYMENT_TYPE" = "voyager" ]; then
 | 
			
		||||
    if [ -e "/etc/init.d/nginx" ]; then
 | 
			
		||||
        # Check nginx was configured properly now that we've installed it.
 | 
			
		||||
        # Most common failure mode is certs not having been installed.
 | 
			
		||||
@@ -53,12 +53,13 @@ if [ "$DEPLOYMENT_TYPE" != "dockervoyager" ]; then
 | 
			
		||||
fi
 | 
			
		||||
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
 | 
			
		||||
if [ "$DEPLOYMENT_TYPE" != "dockervoyager" ]; then
 | 
			
		||||
if [ "$DEPLOYMENT_TYPE" = "voyager" ]; then
 | 
			
		||||
    # Configure rabbitmq
 | 
			
		||||
    /root/zulip/scripts/setup/configure-rabbitmq
 | 
			
		||||
 | 
			
		||||
    # Init postgres database
 | 
			
		||||
    /root/zulip/scripts/setup/postgres-init-db
 | 
			
		||||
else
 | 
			
		||||
    echo; echo "Skipping service starts, chosen Deployment Type is \'$DEPLOYMENT_TYPE\'."
 | 
			
		||||
    echo; echo "Skipping rabbitmq configure and postgres init, because DEPLOYMENT_TYPE is not 'voyager', is '$DEPLOYMENT_TYPE'."
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
deploy_path=$(/root/zulip/zulip_tools.py make_deploy_path)
 | 
			
		||||
@@ -67,11 +68,7 @@ ln -nsf /home/zulip/deployments/next /root/zulip
 | 
			
		||||
ln -nsf "$deploy_path" /home/zulip/deployments/next
 | 
			
		||||
ln -nsf "$deploy_path" /home/zulip/deployments/current
 | 
			
		||||
ln -nsf /etc/zulip/settings.py "$deploy_path"/zproject/local_settings.py
 | 
			
		||||
if [ "$DEPLOYMENT_TYPE" == "dockervoyager" ]; then
 | 
			
		||||
    # We generate the static files later in the entrypoint.sh we don't have the
 | 
			
		||||
    # static files right now, so just create the folder to fix the error with "cp ..."
 | 
			
		||||
mkdir -p "$deploy_path"/prod-static/serve
 | 
			
		||||
fi
 | 
			
		||||
cp -rT "$deploy_path"/prod-static/serve /home/zulip/prod-static
 | 
			
		||||
chown -R zulip:zulip /home/zulip /var/log/zulip /etc/zulip/settings.py
 | 
			
		||||
# Allow this to fail, if there is no supervisor running in a docker install
 | 
			
		||||
 
 | 
			
		||||
@@ -2,8 +2,7 @@
 | 
			
		||||
#
 | 
			
		||||
# Delete the "guest" default user and replace it with a Zulip user
 | 
			
		||||
# with a real password
 | 
			
		||||
set -e
 | 
			
		||||
set -x
 | 
			
		||||
set -ex
 | 
			
		||||
 | 
			
		||||
RABBITMQ_USERNAME=$("$(dirname "$0")/../../bin/get-django-setting" RABBITMQ_USERNAME)
 | 
			
		||||
RABBITMQ_PASSWORD=$("$(dirname "$0")/../../bin/get-django-setting" RABBITMQ_PASSWORD)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,5 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
set -e
 | 
			
		||||
set -x
 | 
			
		||||
set -ex
 | 
			
		||||
 | 
			
		||||
# A bit of a helper variable, default is voyager
 | 
			
		||||
DEPLOYMENT_TYPE="${DEPLOYMENT_TYPE:-voyager}"
 | 
			
		||||
@@ -44,7 +43,7 @@ CREATE USER zulip;
 | 
			
		||||
ALTER ROLE zulip SET search_path TO zulip,public;
 | 
			
		||||
EOF
 | 
			
		||||
# Never drop the database when run from docker!
 | 
			
		||||
# In Docker we have to run this script everytime we start the container, so don't drop..
 | 
			
		||||
# In Docker we have to run this script everytime we start the container, so don't drop.
 | 
			
		||||
if [ "$DEPLOYMENT_TYPE" != "dockervoyager" ]; then
 | 
			
		||||
    su "$POSTGRES_USER" -c "$POSTGRES_COMMAND" <<EOF
 | 
			
		||||
DROP DATABASE IF EXISTS zulip;
 | 
			
		||||
 
 | 
			
		||||
@@ -677,6 +677,7 @@ JS_SPECS = {
 | 
			
		||||
            'js/resize.js',
 | 
			
		||||
            'js/floating_recipient_bar.js',
 | 
			
		||||
            'js/ui.js',
 | 
			
		||||
            'js/pointer.js',
 | 
			
		||||
            'js/click_handlers.js',
 | 
			
		||||
            'js/scroll_bar.js',
 | 
			
		||||
            'js/gear_menu.js',
 | 
			
		||||
@@ -912,7 +913,6 @@ if (len(AUTHENTICATION_BACKENDS) == 1 and
 | 
			
		||||
else:
 | 
			
		||||
    HOME_NOT_LOGGED_IN = '/login'
 | 
			
		||||
    ONLY_SSO = False
 | 
			
		||||
AUTHENTICATION_BACKENDS += ('guardian.backends.ObjectPermissionBackend',)
 | 
			
		||||
AUTHENTICATION_BACKENDS += ('zproject.backends.ZulipDummyBackend',)
 | 
			
		||||
 | 
			
		||||
POPULATE_PROFILE_VIA_LDAP = bool(AUTH_LDAP_SERVER_URI)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user