Added script changes according to my pull request

This commit is contained in:
Alexander Trost
2016-04-24 11:05:55 +02:00
parent d3ae865088
commit 6ef1ef6a79
9 changed files with 54 additions and 20 deletions

View File

@@ -44,7 +44,7 @@ try:
os.environ['DJANGO_SETTINGS_MODULE'] = 'zproject.settings' os.environ['DJANGO_SETTINGS_MODULE'] = 'zproject.settings'
from django.conf import settings from django.conf import settings
remote_postgres_host = settings.REMOTE_POSTGRES_HOST remote_postgres_host = settings.REMOTE_POSTGRES_HOST
except ImportError, e: except ImportError as e:
# process_fts_updates also supports running locally on a remote # process_fts_updates also supports running locally on a remote
# postgres server; in that case, one can just connect to localhost # postgres server; in that case, one can just connect to localhost
remote_postgres_host = '' remote_postgres_host = ''

View File

@@ -133,4 +133,13 @@ class zulip::app_frontend_base {
file { "/etc/cron.d/email-mirror": file { "/etc/cron.d/email-mirror":
ensure => absent, 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",
}
} }

View File

@@ -10,6 +10,8 @@ class zulip::base {
"ipython", "ipython",
# Used in scripts # Used in scripts
"netcat", "netcat",
# Nagios plugins; needed to ensure /var/lib/nagios_plugins exists
"nagios-plugins-basic",
] ]
package { $base_packages: ensure => "installed" } package { $base_packages: ensure => "installed" }
@@ -81,4 +83,14 @@ class zulip::base {
group => 'zulip', group => 'zulip',
mode => 640, 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",
}
} }

View File

@@ -56,5 +56,14 @@ class zulip::postgres_appdb_base {
mode => 644, mode => 644,
source => "puppet:///modules/zulip/postgresql/zulip_english.stop", 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",
}
} }

View File

@@ -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", 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', 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",
}
} }

View File

@@ -5,10 +5,10 @@ set -xe
APT_OPTIONS="${APT_OPTIONS:-}" APT_OPTIONS="${APT_OPTIONS:-}"
# Install additional packages using apt # Install additional packages using apt
ADDITIONAL_PACKAGES=${ADDITIONAL_PACKAGES:-} 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}" DEPLOYMENT_TYPE="${DEPLOYMENT_TYPE:-voyager}"
# Can be for example "zulip::dockervoyager" or "zulip::voyager" # Can be for example "dockervoyager" or voyager
VOYAGER_CLASS="${VOYAGER_CLASS:-zulip::voyager}" PUPPET_CLASSES="${PUPPET_CLASSES:-zulip::voyager}"
# Assumes we've already been untarred # Assumes we've already been untarred
@@ -26,13 +26,13 @@ apt-get install -y puppet git python $ADDITIONAL_PACKAGES
mkdir -p /etc/zulip 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 /root/zulip/scripts/zulip-puppet-apply -f
# These server restarting bits should be moveable into puppet-land, ideally # These server restarting bits should be moveable into puppet-land, ideally
apt-get -y upgrade apt-get -y upgrade
# Don't start services when deploying in docker aka dockervoyager # 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 if [ -e "/etc/init.d/nginx" ]; then
# Check nginx was configured properly now that we've installed it. # Check nginx was configured properly now that we've installed it.
# Most common failure mode is certs not having been installed. # Most common failure mode is certs not having been installed.
@@ -53,12 +53,13 @@ if [ "$DEPLOYMENT_TYPE" != "dockervoyager" ]; then
fi 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
if [ "$DEPLOYMENT_TYPE" != "dockervoyager" ]; then if [ "$DEPLOYMENT_TYPE" = "voyager" ]; then
# Configure rabbitmq
/root/zulip/scripts/setup/configure-rabbitmq /root/zulip/scripts/setup/configure-rabbitmq
# Init postgres database
/root/zulip/scripts/setup/postgres-init-db /root/zulip/scripts/setup/postgres-init-db
else 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 fi
deploy_path=$(/root/zulip/zulip_tools.py make_deploy_path) 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/next
ln -nsf "$deploy_path" /home/zulip/deployments/current ln -nsf "$deploy_path" /home/zulip/deployments/current
ln -nsf /etc/zulip/settings.py "$deploy_path"/zproject/local_settings.py 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 mkdir -p "$deploy_path"/prod-static/serve
fi
cp -rT "$deploy_path"/prod-static/serve /home/zulip/prod-static cp -rT "$deploy_path"/prod-static/serve /home/zulip/prod-static
chown -R zulip:zulip /home/zulip /var/log/zulip /etc/zulip/settings.py 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 # Allow this to fail, if there is no supervisor running in a docker install

View File

@@ -2,8 +2,7 @@
# #
# Delete the "guest" default user and replace it with a Zulip user # Delete the "guest" default user and replace it with a Zulip user
# with a real password # with a real password
set -e set -ex
set -x
RABBITMQ_USERNAME=$("$(dirname "$0")/../../bin/get-django-setting" RABBITMQ_USERNAME) RABBITMQ_USERNAME=$("$(dirname "$0")/../../bin/get-django-setting" RABBITMQ_USERNAME)
RABBITMQ_PASSWORD=$("$(dirname "$0")/../../bin/get-django-setting" RABBITMQ_PASSWORD) RABBITMQ_PASSWORD=$("$(dirname "$0")/../../bin/get-django-setting" RABBITMQ_PASSWORD)

View File

@@ -1,6 +1,5 @@
#!/bin/bash #!/bin/bash
set -e set -ex
set -x
# A bit of a helper variable, default is voyager # A bit of a helper variable, default is voyager
DEPLOYMENT_TYPE="${DEPLOYMENT_TYPE:-voyager}" DEPLOYMENT_TYPE="${DEPLOYMENT_TYPE:-voyager}"
@@ -44,7 +43,7 @@ CREATE USER zulip;
ALTER ROLE zulip SET search_path TO zulip,public; ALTER ROLE zulip SET search_path TO zulip,public;
EOF EOF
# Never drop the database when run from docker! # 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 if [ "$DEPLOYMENT_TYPE" != "dockervoyager" ]; then
su "$POSTGRES_USER" -c "$POSTGRES_COMMAND" <<EOF su "$POSTGRES_USER" -c "$POSTGRES_COMMAND" <<EOF
DROP DATABASE IF EXISTS zulip; DROP DATABASE IF EXISTS zulip;

View File

@@ -677,6 +677,7 @@ JS_SPECS = {
'js/resize.js', 'js/resize.js',
'js/floating_recipient_bar.js', 'js/floating_recipient_bar.js',
'js/ui.js', 'js/ui.js',
'js/pointer.js',
'js/click_handlers.js', 'js/click_handlers.js',
'js/scroll_bar.js', 'js/scroll_bar.js',
'js/gear_menu.js', 'js/gear_menu.js',
@@ -912,7 +913,6 @@ if (len(AUTHENTICATION_BACKENDS) == 1 and
else: else:
HOME_NOT_LOGGED_IN = '/login' HOME_NOT_LOGGED_IN = '/login'
ONLY_SSO = False ONLY_SSO = False
AUTHENTICATION_BACKENDS += ('guardian.backends.ObjectPermissionBackend',)
AUTHENTICATION_BACKENDS += ('zproject.backends.ZulipDummyBackend',) AUTHENTICATION_BACKENDS += ('zproject.backends.ZulipDummyBackend',)
POPULATE_PROFILE_VIA_LDAP = bool(AUTH_LDAP_SERVER_URI) POPULATE_PROFILE_VIA_LDAP = bool(AUTH_LDAP_SERVER_URI)