Commit Graph

528 Commits

Author SHA1 Message Date
Sumana Harihareswara 07afc9d34b Move production health check doc to separate page. 2016-07-12 15:46:10 -07:00
Tim Abbott 883e991adf install: Improve support for non-default puppet rules.
Previously, the install script would fail if you passed various
non-default puppet rules, since the code to configure and restart
services that runs later on in the install script largely ran
unconditionally, regardless of whether the relevant service was
actually installed on the target system.

This should make the main install script reusable for installing
e.g. a dedicated Postgres server for use with Zulip.
2016-07-12 14:12:09 -07:00
Tim Abbott 80bf7e32a4 Add option to not create a virtualenv. 2016-07-12 14:12:05 -07:00
Eklavya Sharma f1ba3ded42 Revert "Extract reply from email."
This reverts commit f1f48f305e.

The use of sklearn unfortunately caused a substantial slowdown to the
Zulip provisioning process, which didn't seem worth it for a
relatively minor feature.
2016-07-10 11:30:30 -07:00
Tim Abbott 12028339a3 puppet: Use --detailed-exitcodes to return nonzero exit code on failure.
Apparently, puppet has messed up exit codes and doesn't by default
return the usual 0=success, nonzero=failure codes.  By default, it
seems to always return 0; and with `--detailed-exitcodes`, it returns
the complicated thing documented in the comments.

We fix this by checking the exit code and translating it to what we
actually care about, namely whether errors occurred.

See https://tickets.puppetlabs.com/browse/PUP-2754 for details.

Fixes #1094.
2016-07-08 12:11:44 -07:00
Umair Khan f1f48f305e Extract reply from email. 2016-07-08 10:58:25 -07:00
Eklavya Sharma 7e020e3dae scripts/lib/setup_venv.py: Use universal_newlines=True.
In python 3, subprocess uses bytes for input and output if
universal_newlines=False (the default).  It uses str for input and
output if universal_newlines=True.
Since we're dealing with strings here, add universal_newlines=True
to subprocess.check_output calls.
2016-07-06 13:50:55 -07:00
Eklavya Sharma f1b72c5f41 Upgrade wheel before installing venv requirements.
This is required because an older wheel version causes problems
when building wheels on python 3.
2016-07-02 11:53:26 -07:00
Eklavya Sharma 0b714ea6c6 Use python2-specific requirements files. 2016-07-02 11:53:26 -07:00
Tim Abbott f094123fd3 install: Add support for installing Xenial systems.
This isn't fully supported yet, but merging this makes it more
convenient to test Zulip on Ubuntu Xenial.
2016-06-28 23:05:38 -07:00
Tim Abbott 4aae4de294 Properly cache production virtualenvs in Travis CI.
Previously, the --travis argument wasn't available to the `setup_venv`
code when creating the production virtualenv.
2016-06-28 12:04:11 -07:00
Tim Abbott 7ed0ab8c4a Ensure Zulip virtualenvs are world-readable.
This is important for both ensuring the Nagios checks work correctly
in production, as well as making sure the `zulip` user can access the
virtualenv (owned by the `travis` user) in Travis CI.
2016-06-28 12:03:01 -07:00
Tim Abbott 4a7913bc22 setup_venv: Use correct VENV_CACHE_PATH for production suite. 2016-06-27 21:16:22 -07:00
Eklavya Sharma a9835c0ab2 Activate virtualenv in production Python code.
The manage.py change effectively switches the Zulip production server
to use the virtualenv, since all of our supervisord commands for the
various Python services go through manage.py.

Additionally, this migrates the production scripts and Nagios plugins
to use the virtualenv as well.
2016-06-27 19:55:35 -07:00
Eklavya Sharma 64affb83f9 Create a virtualenv when installing/upgrading production instances. 2016-06-27 19:55:11 -07:00
Tim Abbott 101820bc29 Move docker development environment scripts to tools/.
scripts/ is for scripts which are used in production.
2016-06-27 13:38:06 -07:00
Tim Abbott dfd8fede4a setup_venv: Add missing build essential dependencies.
Apparently, c74a74dc74 introduced a bug
where we are no longer correctly depending on build-essential as part
of the Zulip development environment installation process.

Fixes #1111.
2016-06-24 09:11:10 -07:00
Eklavya Sharma 9482cdccf4 scripts/lib/setup-venv.py: Accept None as target_venv_path.
If target_venv_path in setup_virtualenv is None, create a virtualenv
named 'venv' but don't make a symlink to it.  Also return
cached_venv_path.
2016-06-23 14:17:17 -07:00
Eklavya Sharma 0365a4a9f2 Factor out apt dependencies for setting up virtualenv.
Move apt dependencies for creating a virtualenv from provision.py
to scripts/lib/setup_venv.py.
2016-06-23 14:17:17 -07:00
Tim Abbott d3f3046629 Add python-six to early installer dependencies.
Since we're now using python-six in zulip-puppet-apply, we need to
install python-six before calling into zulip-puppet-apply.
2016-06-22 08:11:34 -07:00
Eklavya Sharma 121a5f26fb Move hash_reqs.py from tools/ to scripts/lib/.
This is needed because hash_reqs.py is used to create a virtualenv.
Currently we only use virtualenv in development, but we will soon
start using it in production.  Scripts used in production should be
put in scripts/.
2016-06-22 18:12:08 +05:30
Eklavya Sharma fc8d4f9ef5 Factor out venv-creating code from provision.py.
Move setup_virtualenv and do_setup_virtualenv from provision.py to
scripts/lib/setup_venv.py.
2016-06-21 11:25:41 -07:00
Tim Abbott f7ce5fc179 generate_secrets: Silence mypy error with configparser.
See https://github.com/python/typeshed/issues/307.
2016-06-20 09:03:09 -07:00
Umair Khan a9a6687b7d Make generate-secrets script use existing values.
Fixes #1035
2016-06-20 17:00:27 +05:00
Michael Cordover b401ec0af7 Warn on postgres-init-db if >200 messages exist.
Closes #548.
2016-06-13 15:57:51 -07:00
acrefoot cf15b0b4e6 Fix hanging nc and 'invalid wait time' error on Trusty.
Apparently, 0 isn't a supported wait time value in some versions of nc.
2016-06-02 18:02:13 -07:00
Eklavya Sharma 94e4b39112 Replace python2.7 by python everywhere. 2016-05-29 05:03:08 -07:00
Eklavya Sharma 149938d468 Change shebangs from python2.7 to python. 2016-05-29 05:03:08 -07:00
Tim Abbott 6e1872987d Move bin/get-django-setting to scripts/. 2016-05-07 19:37:06 -07:00
Tim Abbott a315849a9e Move bin/log-management-command to scripts/lib/.
We're in the process of eliminating the bin/ subdirectory in favor of
the scripts/ tree, and this one isn't user-facing.
2016-05-07 19:37:06 -07:00
Tim Abbott cb81a59e38 Move write-rabbitmq-consumers-state-file to scripts/nagios/. 2016-05-07 19:37:06 -07:00
Tim Abbott 2761c012e5 Move rabbitmq consumer checks from bots/ to scripts/nagios/. 2016-05-07 19:37:06 -07:00
Tim Abbott be6566dc5c nagios: Move cron_file_helper from bots/ to scripts/lib.
This ensures the tool is available in Zulip production deployments.
2016-05-07 19:37:06 -07:00
Tim Abbott 52c1e8ac7d 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.
2016-05-02 17:21:31 -07:00
Tim Abbott 6e1e4aaef6 postgres-init-db: Add POSTGRES_USER argument. 2016-04-26 15:27:35 -07:00
Tim Abbott dc772518e7 Don't chown supervisor socket if it doesn't exist. 2016-04-26 15:27:35 -07:00
Tim Abbott 6a3c775842 install: Ensure prod-static/serve is created. 2016-04-26 15:27:35 -07:00
Tim Abbott bb25b6060e install: Avoid unnecessarily storing apt key under /root. 2016-04-26 15:07:53 -07:00
Tim Abbott e9416a9fb2 install: Add PUPPET_CLASSES variable. 2016-04-26 15:06:37 -07:00
Tim Abbott a9d86a3620 install: Add DEPLOYMENT_TYPE variable. 2016-04-26 15:04:32 -07:00
Tim Abbott 68c6d514e8 install: Add ADDITIONAL_PACKAGES option. 2016-04-26 15:02:28 -07:00
Tim Abbott ae48f6394b migrations: Disable prompting about content-type deletion.
The main function of prompting inside `manage.py migrate` is to ask
the user if they want to delete stale content-types, which is
unimportant and likely scary, so we disable doing so.
2016-04-13 13:19:02 -07:00
Tim Abbott 4352a022cd Add type: ignore to wildcard imports in pythonrc.py. 2016-04-03 15:40:24 -07:00
Tim Abbott f9222de83e Auto-load commonly used modules in manage.py shell.
This automatically loads settings, zerver.models.* and
zerver.lib.actions.* when you start `manage.py shell`, which should
save a bit of time basically every time someone uses it.

Fixes #275.
2016-03-19 11:32:49 -07:00
Eklavya Sharma 7b8cb105bf Apply Python 3 futurize transform libmodernize.fixes.fix_imports_six
Refer to #256
2016-03-10 22:03:30 -08:00
Eklavya Sharma c59185e119 Apply Python 3 futurize transform libfuturize.fixes.fix_print_with_import
Refer #256
2016-03-10 22:02:17 -08:00
Luke Faraone 9d9bfb27ef Correct shell quoting around $DEFAULT_USER in terminate-psql-sessions
Previously, we used shell quoting that would result in the shell variable not
being substituted. Instead, we use `"`s that will allow for variable
substitution.
2016-02-19 02:09:50 +00:00
Vladislav Manchev dfbea01c8f Add support for running OpenBSD in development environment. 2016-01-21 22:33:55 -08:00
Alexander Trost 84f7a1f1ea Make rabbitmq, redis, and memcached configurable via user settings.py.
Previously these were hardcoded in zproject/settings.py to be accessed
on localhost.

[Modified by Tim Abbott to adjust comments and fix configure-rabbitmq]
2016-01-21 22:07:56 -08:00
Tim Abbott 26e9d55e16 deployments: Refactor locking libraries into zulip_tools.py.
The code in update-deployment and upgrade-zulip for managing the
deployment lock was nearly identical.
2016-01-11 21:36:42 -08:00
Tim Abbott f871090bb6 upgrade-zulip: Archive release tarballs at /home/zulip/archives.
A common issue when doing a Zulip upgrade is trying to pass
upgrade-zulip a tarball path under /root, which doesn't work because
the Zulip user doesn't have permission to read the tarball.  We
could fix this by just unpacking the tarballs as root, but it seemed
like a nicer approach would be to archive the release tarballs
somewhere readable by the Zulip user (/home/zulip/archives) and unpack
them from there.

Fixes #208.
2016-01-11 21:36:42 -08:00
Tim Abbott c101bf663d Run upgrade-zulip-stage-2 from an absolute path.
This should make it more obvious in tracebacks that we are running the
script from the version of Zulip we're upgrading to, not the old
version.
2016-01-11 21:36:42 -08:00
Tim Abbott 52d0423591 Document structure of upgrade-zulip-stage-2 more clearly. 2016-01-11 21:36:41 -08:00
Tim Abbott 186f563176 Fix deployment locks being leaked when a deployment fails.
The point of the lock is to prevent two deployments happening at the
same time and racing with each other, not to prevent doing any future
deployments after an error happens (which is what the current
implementation does in practice).

Addresses part of #208.
2016-01-11 21:36:41 -08:00
Tim Abbott e7353902df upgrade-zulip: Restart process-fts-updates if also a DB host.
Previoulsy, process-fts-updates wouldn't be restarted on a server
upgrade in Voyager configurations.
2016-01-09 16:59:43 -08:00
Tim Abbott 75b5a1b8da upgrade-zulip: Stop zulip-senders too when shutting down services. 2016-01-09 16:59:43 -08:00
Reid Barton b2a92877ff Don't print echo commands in initialize-database post-success message. 2015-12-25 10:38:44 -08:00
Reid Barton 64a142f0a2 Fix running postgres-init-db via a relative path.
If the user runs ./scripts/setup/postgres-init-db, then dirname "$0"
would no longer refer to the correct directory after cd /.
2015-12-25 10:06:45 -08:00
Javier Ros ab89ef501f Add support for a development environment with Docker. 2015-12-14 18:22:56 -08:00
Tim Abbott 7395003e6a Fix buggy #! lines using "/usr/bin/env python2.7 -u".
The #! line processing interpreted the argument to pass to `env` as
"python2.7 -u", which obviously isn't a real program.

We fix this by setting the PYTHONUNBUFFERED environment variable
inside the program, which has the same effect.

Thanks to Dan Fedele for the bug report and suggested solution!
2015-11-16 08:46:48 -08:00
Tim Abbott 827babdf29 terminate-psql-sessions: Remove dependency on bc.
Fixes #281.
2015-11-11 21:35:16 -08:00
Tim Abbott 6eb670097c Expand testing done via Travis CI to cover production pipeline.
With this change, we are now testing the production static asset
pipeline and installation process in a new testing job (and also run
the frontend/backend tests separately).

This means that changes that break the Zulip static asset pipeline or
production installation process are more likely to fail tests.  The
testing is imperfect in that it does not have proper isolation -- we
build a complete Zulip development environment and then install a
Zulip production environment on top of it, so e.g. any apt
dependencies installed for Zulip development will still be available
for the Zulip production environment.  But, it's better than nothing!

A good v2 of this would be to have the production setup process just
install the minimum stuff needed to run `build-release-tarball` and
then uninstall it / clean it up so that we can do a more clear
production installation, but that's more work.
2015-11-01 18:11:39 -08:00
Tim Abbott 421560af21 postgres-init-db: Stop all services before recreating database. 2015-11-01 18:11:39 -08:00
Tim Abbott 3c31f9a2e3 Drop database users prior to DROP/CREATE database.
This fixes an annoying issue where one tries to rebuild the database,
and it fails due to there being existing connections.

The one thing that is potentially scary about this implementation is
that it means it's now a lot easier to accidentally drop your
production database by running the wrong script; might be worth adding
a "--force" flag controlling this behavior or something.

Thanks to Nemanja Stanarevic and Neeraj Wahi for prototypes of this
implementation!  They did most of the work and testing for this.
2015-11-01 18:11:39 -08:00
Tim Abbott b7cd000af6 install: Check nginx configuration is valid.
It's better to fail here and have the user correct the issue than fail
later.
2015-11-01 18:06:59 -08:00
Tim Abbott f3783fb4a1 Apply Python 3 futurize transform libfuturize.fixes.fix_print_with_import. 2015-11-01 09:26:16 -08:00
Steven Oud d5435fad1d Consistently use /usr/bin/env python2.7 in shebangs and commands. 2015-10-21 22:58:21 +00:00
Tim Abbott e75ba630fb initialize-database: Make management command errors fatal again.
We accidentally made this non-fatal when we added the nice error
output telling users to run postgres-init-db.
2015-10-15 12:21:46 -04:00
Tim Abbott bf694fa832 Flush memcached whenever we drop the databases.
This fixes some issues that we've had where commands will fail is
confusing ways after the database is rebuilt because data from before
the database was dropped is still in the memcached cache.
2015-10-15 12:18:41 -04:00
Raphael 0608e32eeb Cause install to return 1 on failure.
This fixes issue #123. Namely, the script in scripts/setup/install was
returning 0. Adding `set -e` and `set -o pipeline` causes the install
script to exit and return 1 if any part fails, including piping output
(`set -o pipeline` does this).
2015-10-07 08:46:16 -04:00
Ged Lawrenson 21b7048e54 install: Verify that the script has sufficient privileges. 2015-09-30 10:55:49 -07:00
Tim Abbott 92aebe595b Dramatically extend post-install documentation for production Zulip. 2015-09-30 09:04:14 -07:00
Tim Abbott 40ec59b93e install: Add nice error message for RabbitMQ not having started. 2015-09-29 18:41:31 -07:00
Tim Abbott 5bf66e04fc initialize-database: Print nice instructions for how to redo if fails.
Most of our installation process is idempotent, but this step in
particular is not, so it's important to provide a clear error message
about how to proceed.
2015-09-29 18:27:27 -07:00
Tim Abbott 96bd1c38dc install: Make sure python is installed before using it.
This is relevant for completely bare Ubuntu systems which might only
have python3 installed.

Fixes #40.
2015-09-26 21:34:36 -07:00
Tim Abbott 9748780192 Remove unnecessary puppet.conf configuration.
Fixes #23.
2015-09-26 21:34:19 -07:00
Tim Abbott 00bf7b25b5 install: Remote the python-django-guardian hack.
This is no longer required since it's in the PPA now.
2015-09-26 18:01:18 -07:00
Anders Kaseorg 0d12dfd06f Improve shell quoting hygiene
Most of these problems were found by ShellCheck
(http://www.shellcheck.net).

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2015-09-25 23:25:08 -04:00
Andreas Litt aeb6a5df7c Use current working dir instead of /tmp 2015-09-25 22:11:59 +02:00
Andreas Litt 94c35d8fb0 Fix 'python-django-guardian' download
While the docu on https://www.zulip.org/server.html says:
```
cd /root/zulip
./scripts/setup/install
```
This script downloads the `python-django-guardian_1.3-1~zulip4_all.deb` file to current working dir (`/root/zulip` if you follow the docu), but tries to install it from /root/.
This fails obviously. So i changed the download location to /tmp/.
2015-09-25 22:02:13 +02:00
Tim Abbott b69c6228af Hackishly install a correct version of python-django-guardian in prod install.
(imported from commit 1027e05a1a9805a17fcb4b8dea2c2cf8cda280af)
2015-09-25 09:45:26 -07:00
Tim Abbott abb1a13e31 Switch to new Trusty PPA for Voyager install process.
(imported from commit 91fdc16f121938d36c389f5b285f0da942558759)
2015-09-25 09:45:26 -07:00
Tim Abbott 2348a83678 postgres-init-db: Fix running with cwd=/root.
(imported from commit d2ac25fa8c54b89eed80e941b3eacf1a4c2f5546)
2015-09-25 00:22:15 -07:00
Tim Abbott 6540807761 install: Copy rather than moving local_settings_template.py.
(imported from commit 23e5af225738af32567c543df75375cd5ce378dc)
2015-09-24 22:41:00 -07:00
Tim Abbott 2fb9560476 puppet: enterprise=>voyager for single-server configuration.
(imported from commit 7cc47ac7c470239cd00f69cfd3137b39a0d06e3a)
2015-09-24 22:40:59 -07:00
Tim Abbott cf17168c9f Move prod README to root of repository.
(imported from commit db108ffa7f88f22610ecee085abdcd6c5a2bb681)
2015-09-22 21:22:11 -07:00
Reid Barton 5be0c2902e Connect to the zulip database correctly in postgres-init-db
(imported from commit b6ab80567ff5d229a00c7d2cf5866bca0ee9c7c5)
2015-08-29 12:07:33 -07:00
Reid Barton 942e97d886 Create directory to write log of initial installation into
(imported from commit fa352a7b4f57379df14249fd5f168249ead64777)
2015-08-28 09:40:30 -07:00
Reid Barton d8b44606a3 Make configure-rabbitmq fail on error
If there's a problem with Django settings then RMQPW would just be
empty, causing more confusing errors downstream.

(imported from commit 5948b1a15eb92fc032ea02e499be58365d8e9ecb)
2015-08-28 09:37:58 -07:00
Reid Barton 4e61c06903 Fix postgres syntax when creating zulip schema in production
(imported from commit 51ba85b995e4b5044f914163dab7f2ae14df908f)
2015-08-28 09:37:46 -07:00
Reid Barton 5768fd7f49 Remove reference to Zulip deployment key from Zulip Voyager README
(imported from commit 74a4f86839fb76eb175016453d91b916b9ce416d)
2015-08-23 21:44:27 -07:00
Reid Barton a3d85f501b Create tsearch_extras in production database setup
(imported from commit e6c699b06f022d923b57ccee7ad778f870bf890d)
2015-08-21 16:54:35 -07:00
Tim Abbott d281fc75fd Rename generate_voyager_secrets.py => generate_secrets.py.
(imported from commit c2f370c3b241601b4f6883d3953ceec1efda71be)
2015-08-21 10:33:36 -07:00
David Roe e3f38acbce Enterprise => Voyager.
(imported from commit 41b9a67301aeaf5fd40bbbb8f34a326ca98431fd)
2015-08-21 10:33:35 -07:00
David Roe 3f7cb34b00 enterprise => voyager
(imported from commit 04be792bb480d5e5db1c91d296d1000cf1682571)
2015-08-21 10:33:35 -07:00
Reid Barton 362f9c6c5f Django 1.7: syncdb and migrate are now synonyms
(imported from commit b8a1b2476892bab2418240b04deea6aa40ff1b03)
2015-08-20 23:01:26 -07:00
Yoyo Zhou ec5ed87ca0 Make get_secret return None instead of an exception if the secret isn't defined.
Remove empty key generation from generate_enterprise_secrets, since get_secret ignores missing keys now.

(imported from commit 32d61e3058f0d41bfb4b17775e581a3c84540fe7)
2015-08-20 21:54:38 -07:00
Jonathan Dahan e95dfd78ed Fix production deployment script.
(imported from commit 5b8398a0075dc297d3f86c65ce2ef43977e57ecb)
2015-08-20 20:50:41 -07:00
Tim Abbott 9000d27f12 Update generate_enterprise_secrets to support running in production.
(imported from commit 1051f668ebe684cc60ba4444e815ef60398fad61)
2015-08-20 17:33:16 -07:00
Cat Miller 0a20f168a7 Auto-generate dev-secrets file.
Source LOCAL_DATABASE_PASSWORD and INITIAL_PASSWORD_SALT from the secrets file.
Fix the creation of pgpass file.

Tim's note: This will definitely break the original purpose of the
tool but it should be pretty easy to add that back as an option.

(imported from commit 8ab31ea2b7cbc80a4ad2e843a2529313fad8f5cf)
2015-08-20 00:20:44 -07:00
Tim Abbott 5b8894cd25 Rename USING_SSO to something more clear.
(imported from commit 94e8ae84b01419783872a5d09bafe5c2eb933c18)
2015-08-18 20:48:15 -07:00
Tim Abbott 0dae10eab4 Remove unused secret HASH_SALT.
(imported from commit 831c4cb7680b7bf8dadbd930195175e9a4186356)
2015-08-18 20:17:48 -07:00
Luke Faraone cf7ea9bef9 Allow configure-rabbitmq to be run w/o sudo
(imported from commit 98e820d92b42420d6851a967f6675940ee4d8217)
2015-08-16 16:45:07 -07:00
Tim Abbott b2d01e2da0 [manual] restart-server: Minimize downtime for message sender worker.
The manual step here is that we need to do the `puppet apply` before
pushing this commit, or `restart-server` will crash.

Previously we shut down everything in one group, which performed
poorly with supervisor's bad performance on restarting many daemons at
once.  Now we shut down the unimportant stuff, then the important
stuff, bring back the important stuff, and then bring back the
unimportant stuff.

This new model has a little over 5s of downtime for the core
user-facing daemons -- which is still far more than would be ideal,
but a lot less than the 13s or so that we had before.

Here's some logs with the current setup for the tornado/django downtime:
2013-12-19 20:16:51,995 restart-server: Stopping daemons
2013-12-19 20:16:53,461 restart-server: Starting daemons
2013-12-19 20:16:57,146 restart-server: Starting workers

Compare with the behavior on master today:
2013-12-19 20:21:45,281 restart-server: Stopping daemons
2013-12-19 20:21:49,225 restart-server: Starting daemons
2013-12-19 20:21:58,463 restart-server: Done!

(imported from commit b2c1ba77f3dc989551d0939779208465a8410435)
2013-12-19 17:21:23 -05:00
Luke Faraone 490af28958 Update URL for user APT key.
We're moving to S3, so apt.z.c no longer serves SSL.

(imported from commit a2d376337ddaf2f5fd4ddf193a1ff0732f89c78a)
2013-12-11 10:54:30 -05:00
Tim Abbott 3665a0e289 Fix permissions issues with upgrade-zulip from /root path.
(imported from commit b7fce92ac1b7317388debaae2bc3270fe3ae155e)
2013-11-25 17:16:15 -05:00
Zev Benjamin 9b2aa657be Revert "restart-server: Use 'all' instead of specifying the supervisor jobs to operate on explicitly"
This reverts commit acef4c0027b77053497ef6e9f7aa4b61703205c3.

Despite the lower total downtime, this caused more user-facing downtime.

(imported from commit 5cce032bb20abe83853a65ee72bf0bb28af403cc)
2013-11-21 15:14:38 -05:00
Zev Benjamin a363b7185d restart-server: Use 'all' instead of specifying the supervisor jobs to operate on explicitly
This shaves about 1.5 seconds off our restart time on ls-dev (9s ->
7.5s).  Still too slow, but it's a little bit better.

(imported from commit acef4c0027b77053497ef6e9f7aa4b61703205c3)
2013-11-15 15:23:02 -05:00
Tim Abbott 2e5eec5bd3 install: Remove apache restart from install process.
We don't use apache in the main app -- only for the SSO situation --
this code was just copied from our own install script.  And it caused
problems at CUSTOMER13 because they installed Apache in preparation for
the SSO integration, but restarting it failed.

(imported from commit 3f2961574134847c836e8b69736f60d9f8790201)
2013-11-15 15:04:13 -05:00
Zev Benjamin 974159ec94 Move apache2 restart for SSO sites to restart-server
(imported from commit f999e2b0591a11442c1d3fdba2393ecf6e78bad3)
2013-11-15 11:34:48 -05:00
Leo Franchi 68954ee89a Show info on how to remove lockdir in upgrade-deployment
(imported from commit 59984c9b3ce7ef133f0e929836533ae9d6d40707)
2013-11-14 12:00:03 -05:00
Tim Abbott af21f943a2 Fix paths to zulip_tools for relocated scripts.
(imported from commit 9a3664c0f7da1ce6dcb554e7e9ddef5bde6cad7e)
2013-11-14 11:16:16 -05:00
Tim Abbott 9a6f34a807 Make generate_enterprise_secrets.py work regardless of path.
(imported from commit c1ab8231fbe907a32b18c02a00cee51011abbb21)
2013-11-14 09:10:10 -05:00
Tim Abbott 037460b24c Fix permissions on install script.
(imported from commit af71b3a4988059c58e741bf94d0c28383c08f704)
2013-11-14 08:56:06 -05:00
Tim Abbott f9707dd903 Clean up scripts/ by moving helper tools into lib/.
(imported from commit 31a99d5cc68524a1399daa50eb1fcda54383a317)
2013-11-14 08:47:11 -05:00
Tim Abbott 486fcfa53f README
(imported from commit c02dfbd15ab6bac5a450d04075b15a7c44e8ddfe)
2013-11-14 08:19:20 -05:00
Tim Abbott bd607a32e6 unpack-zulip: Update for zulip-server paths containing versions.
(imported from commit 9318cab0cfcdf57412afbe9386371c8f9994da9f)
2013-11-14 08:19:20 -05:00
Zev Benjamin 87a6838e0e enterprise: Log the output of upgrade-zulip and install scripts
We may eventually want to rotate the log files, but this seems good
enough for now.

(imported from commit 9a54fa6b40bc62f68e52ef552c1a676856b21829)
2013-11-14 08:08:59 -05:00
Zev Benjamin 1546d06344 upgrade-zulip-stage-2: Tweak log message
(imported from commit e8979fa3331119f1f039b3809f6d06fc81fd5e0e)
2013-11-13 16:57:00 -05:00
Zev Benjamin 718a1a8405 upgrade-zulip-stage-2: Restart Apache when using SSO
(imported from commit c06be261ec4ab56551962d26cfc41590a64f49e7)
2013-11-13 16:57:00 -05:00
Zev Benjamin 9addde74ec enterprise: Split upgrade-zulip in two for better future-proofing
(imported from commit 808d8d68a6e799aa2962eec90c0953db3c94cfa4)
2013-11-13 16:57:00 -05:00
Zev Benjamin e8c104012b Move su_to_zulip into zulip_tools.py
(imported from commit 4a79f87dc396da9419a0a1cf5f5b7bb798d5b194)
2013-11-13 16:56:59 -05:00
Zev Benjamin 0b592a27b1 enterprise: Make upgrade-zulip do puppet applies and schema migrations
(imported from commit 6d0109e6cd6a02ed5d57b0c0b4c9dc052f158344)
2013-11-13 16:26:04 -05:00
Zev Benjamin 67ed16a12e enterprise: Make /root/zulip be a symlink to ~zulip/deployments/next
(imported from commit 2a0e7f99fe4517e45ad2794b7fa464df08d40db1)
2013-11-13 16:26:04 -05:00
Zev Benjamin 031dfbcc46 zulip_tools.py: Add a make_deploy_path function and make it invokable from the commandline
(imported from commit 94578d117864fba76f9353784734c712c89c4bf2)
2013-11-13 16:26:04 -05:00
Zev Benjamin baecc950a5 enterprise: Remove dead code
(imported from commit ca0cdc89f72367d15cd8cfe33666a4cff80deb66)
2013-11-13 16:26:03 -05:00
Tim Abbott c54322f76a install: Move DROP SCHEMA PUBLIC to run in zulip database.
(imported from commit 1eef44e7255b8fe1314f7763ebfc6c04083305e5)
2013-11-13 15:35:45 -05:00
Tim Abbott c842b42b12 postgres-init-db: The zulip user doesn't need CREATE DB on enterprise.
Also clean up the series of similar blocks.

(imported from commit fdb468bd6be3077bdbf2d72289064397ea04f27a)
2013-11-13 15:35:45 -05:00
Tim Abbott b4ace85d3a Make sure everything under /home/zulip is owned by zulip.
(imported from commit f6c8b6c0a6dc8b7ada79cb4951818f06faa873e7)
2013-11-13 12:07:15 -05:00
Tim Abbott 0299964051 Make the Zulip user able to edit settings.py.
(imported from commit c69ff2b2e9f176ae2e78b76a7b022e00d09e7c00)
2013-11-13 12:02:50 -05:00
Tim Abbott 6bcd5a7ffc Update installation instructions to include configuring the app.
(imported from commit 89395815c32416ec0636efcff12eb76f5d890bbd)
2013-11-13 12:02:50 -05:00
Tim Abbott 6aaa2b1a24 Create the zulip database owned by zulip.
(imported from commit cc6e895d9e97bdd9d084c7b1a7204bd5b7ae5cd8)
2013-11-13 12:02:50 -05:00
Tim Abbott 0ec8a7a2f1 install: Make sure we own everything under /var/log/zulip
supervisord may start up during the install process and do a bunch of
incorrect stuff, with the net effect of creating files in there owned
by root.

(imported from commit 28379af9680bf9d3c72da196f329abdf8c82c6be)
2013-11-13 12:02:50 -05:00
Tim Abbott b2d4883165 postgres-init-db: Split into internal and external versions for now.
(imported from commit 3516b1377e5914dac2b504961922ef8d08148d1f)
2013-11-13 12:02:50 -05:00
Tim Abbott f4a9e99498 puppet: Move the postgres dictionary symlink creation to puppet.
(imported from commit 823f6683e3d8f3604da68e55dd6761ecb38d4b63)
2013-11-13 12:02:50 -05:00
Tim Abbott 45f21cbb14 Setup the database after the Zulip user is fully setup.
Otherwise we may run into permissions issues.

(imported from commit a8013c84796d16146336c2809dcd8cd935b43a7b)
2013-11-13 12:02:50 -05:00
Tim Abbott e1a8f511fe configure-rabbittmq: Make it work if you run it a second time.
This is to make it easier to just run the install script again if it
fails.

(imported from commit 65deb9d001e061d58deecd44c4683231de76dc79)
2013-11-13 12:02:50 -05:00
Tim Abbott c7d9bf41bc Rename SSL certificates for Zulip Enterprise.
(imported from commit 4f15f2aee2bcc7450953488c94e8b88734aeaff7)
2013-11-12 15:57:42 -05:00
Tim Abbott 270f5730fa Rename local server => enterprise in some scripts.
(imported from commit 98cdb4c2e1be5a6abb59821eb32f749c058b773b)
2013-11-12 15:57:42 -05:00
Tim Abbott 966fde261a puppet: Rename local_server => enterprise.
(imported from commit 5faa269df5937f6db99098e44aaea7d0a4f2c14a)
2013-11-12 15:57:02 -05:00
Tim Abbott 21f1058fd2 Rename local_server=>enterprise in DB initialization script.
(imported from commit 76e26f43858e3baa6ed1b38d67973ed41acf04f3)
2013-11-12 15:57:02 -05:00
Tim Abbott b461e3c10e Add a README file documenting the installation process for local server.
(imported from commit 4fb149a39acb4dda7ee0d2f038212534f410e064)
2013-11-12 15:57:01 -05:00
Tim Abbott 57b5231063 install: Script the install process more fully.
We can probably later merge the create-database code with that of our
internal do-destroy-rebuild-database.

(imported from commit 323932dbf2eb916545d6ebdda70eb1f5e1abb181)
2013-11-12 15:57:01 -05:00
Tim Abbott 2e41515cc3 localserver: Make the zulip user own supervisor.sock.
We really should fix this in supervisor itself, since in particular we
lose this setting every time the system is rebooted.

(imported from commit a700078b158808340f5f30812235449c74508cde)
2013-11-12 15:57:01 -05:00
Kevin Mehall 9b6c99c7af Copy localserver prod-static instead of linking so old files are retained.
(imported from commit 728cce9f1b3a47d62f2856a509ed65a3ac6bd451)
2013-11-12 15:50:08 -05:00
Tim Abbott 03bf4ba423 postgres-init-db: Don't hardcode LOCAL_DATABASE_PASSWORD.
(imported from commit e2cf6c6c0abb688c77661e4849e7b574b4222e68)
2013-11-12 09:38:43 -05:00
Tim Abbott 5f7c530285 install: Set puppet deploy type for local server.
(imported from commit c8b7ac3a7741470851f6fa9c27677e1238c1dce7)
2013-11-12 09:34:25 -05:00
Tim Abbott 26d7411bc0 generate_localserver_secrets: Fix path to camo defaults file.
(imported from commit 4456715e038b10978b3ce1e7454d625795f336e7)
2013-11-12 09:34:25 -05:00
Tim Abbott bf0fda7426 Use the enterprise apt key when installing local server.
(imported from commit 24fa7474a77cac7b1d033c6732de6873d4aa9880)
2013-11-12 09:34:25 -05:00
Tim Abbott 30e5543eae install: Use mkdir -p so that running it again on error works.
(imported from commit 361985ce7463c9ccaa7b2eaf1b23ca262e64560d)
2013-11-12 09:34:25 -05:00
Tim Abbott cb72df39b1 install: Configure rabbitmq during setup process.
(imported from commit c610e6bac9a1d6f2c856664ba1e17bbfcc5e551a)
2013-11-12 09:34:11 -05:00
Tim Abbott 8eaef81f6b localserver: Install site settings via a symlink to /etc/zulip/settings.py.
(imported from commit b0bedfe3fc4e9039f30061ae9cbdc34069f1f284)
2013-11-12 09:34:07 -05:00
Tim Abbott 92a230acaa install: Unpack the initial Zulip tarball in deployments/
(imported from commit 2b340aacaa5233fd8708d6392e3c9210e866acbd)
2013-11-12 09:22:50 -05:00
Tim Abbott 5c450afd2d Split out unpack-zulip from the upgrade script.
(imported from commit e41a8ad01c3042c7d877fb3aa17f9617dc2b0121)
2013-11-12 09:22:48 -05:00
Tim Abbott 5b71ceb03c localserver: Setup apt repo first in install script.
(imported from commit d26e3dffcfa2d7feeb58eb8c01e17460a8dfced0)
2013-11-12 09:12:06 -05:00
Tim Abbott c38bad0b65 zulip-puppet-apply: Fix the force option handling.
(imported from commit e3a0f3902ac183c7c30ba0e8ed27e7bd9924ff2b)
2013-11-05 17:06:31 -05:00
Tim Abbott 6b9ebfdad5 localserver: Fix leftover code in install script.
This should have been removed when forking from our internal install
script.

(imported from commit cb0c0790ba8343d62ef5f5171b219c458a16e906)
2013-11-05 17:06:31 -05:00
Tim Abbott 6fea6a7856 Make our install script executable.
(imported from commit 26be3f76b2654701b7361f2b369e9b82eeeda54e)
2013-11-05 17:06:31 -05:00
Zev Benjamin b3e6d49d2f puppet: Switch puppet to using include-style class declarations
This allows us to declare classes more than once, which we need as
we're making our class dependency graph more complicated.  See
http://docs.puppetlabs.com/puppet/2.7/reference/lang_classes.html#aside-history-the-future-and-best-practices

(imported from commit d4199b0df0d92d166fbc3559957f67ee9cf2ecdc)
2013-11-05 14:14:19 -05:00
Zev Benjamin 787215d743 [manual] Switch over to new /etc/zulip/zulip.conf config file
Run the following commands as root before deploying this branch:
 # /root/zulip/tools/migrate-server-config
 # rm /etc/zulip/machinetype /etc/zulip/server /etc/zulip/local /etc/humbug-machinetype /etc/humbug-server /etc/humbug-local

(imported from commit aa7dcc50d2f4792ce33834f14761e76512fca252)
2013-11-05 14:14:19 -05:00
Kevin Mehall 78b45b61fb Minify JS in the localserver upgrade tarball.
This moves the list of removed files from .gitattributes to
tools/build-local-server-tarball because static/ and tools/ are
necessary for update-prod-static, and it seemed best to keep the
entire list in one place.

(imported from commit 2a447cbde29e90d776da43bb333650a40d4d363c)
2013-11-04 13:40:43 -05:00
Tim Abbott ca0848b308 Don't purge old deployments on local server, for now.
(imported from commit 860e51691d90eee3e594388d514af07c9bb86d6a)
2013-11-04 13:22:42 -05:00
Tim Abbott 5f92ccb422 [manual] Move update-prod-static and update-deployments back to tools/.
update-deployment has been replaced by upgrade-zulip for local server
instances, since it won't be running off a git repository, and
update-prod-static won't be needed since we plan on shipping minified
javascript.

When we deploy this, the deployment will fail, and then we'll need to
update the git checkout from which post-receive runs on git.zulip.net.

(imported from commit 86aaedbab09c60ae86ac1d0ae492d0d1bc45569f)
2013-11-04 13:22:41 -05:00
Tim Abbott bc19be977a purge-old-deployments: Never purge the currently running deployment.
(imported from commit edccfc908f50a66e5c214bca8a5418625ed64bf0)
2013-11-04 13:22:41 -05:00
Tim Abbott adc5771062 Rename purge-deployments to purge-old-deployments.
Since this is a user-facing script, we should make it more clear about
what it does.

(imported from commit eecaed8462a92fe7c688df5c32fea2e088b25058)
2013-11-04 13:22:41 -05:00
Tim Abbott 81aff30127 Add script to upgrade a local server installation.
This has a decent amount of code copied from update-deployment, but
there's enough different that I think it's reasonable to write this
and then move some common code into the zulip_tools library.

(imported from commit ae4fdf8125daf802f04f4543a9f1ebae4e9cd3bd)
2013-11-04 13:22:41 -05:00
Tim Abbott 5afb0ed7d1 update-deployment: Remove obsolete deletion of pyc files.
Since we do a fresh clone every time, there never are any.

(imported from commit ffd0baba3cf26b019c968b99e7f43c9bcc40b175)
2013-11-04 13:22:41 -05:00
Tim Abbott a53c7c0f45 Update local server install script for puppet move.
(imported from commit 4bd7292dd54e9091747dce44b41b57a42496bc3b)
2013-11-01 10:30:17 -04:00
Tim Abbott 806fab9fe9 localserver: Initial prototype for an install script.
(imported from commit b0afd6493e2d5878e3c31d17f0bdee19b34062a5)
2013-10-30 20:39:39 -04:00
Zev Benjamin 8ca76ba13f Split our puppet configuration in two
The 'zulip' module contains the general setup for any server that
will run our app.  The 'zulip-internal' module contains configuration
that is internal to Zulip the company.

(imported from commit 23c99dd889577c2917ddbf76892cf8f6cc66a13e)
2013-10-30 15:42:25 -04:00
Zev Benjamin 57bef07832 [manual] Move /etc/humbug-* files into /etc/zulip
The moved files are:
humbug-server
humbug-local
humbug-machinetype

Their new names are their old names with 'humbug-' removed.

zulip-puppet-apply must be run before this commit is deployed

(imported from commit f4eb523244d3409b5809c279301225d3fdf0c230)
2013-10-30 15:42:25 -04:00
Tim Abbott fffd4f3c59 Move zulip_tools library to root of repository.
(imported from commit 2fada9d2acbcf81f8e2b3de8caadbf335141dfaa)
2013-10-28 10:54:48 -04:00
Tim Abbott 38c5629505 Move generate_localserver_secrets.py to scripts/setup.
(imported from commit 8d9ca2fc78700a38ec3ce5866b2b1032aabe1635)
2013-10-28 10:54:48 -04:00
Tim Abbott 7c6ca81df5 Move zulip-puppet-apply to scripts/.
(imported from commit c4e4c98f0a50feb31f7a716e04009d814cf047e7)
2013-10-28 10:54:48 -04:00
Tim Abbott 56e9ad230e [manual] Move our deployment scripts to scripts/.
This will require updating the post-receive code on git.zulip.net to
work.

(imported from commit 2e51fa2d7b891c1138d3f22ae534cfb8a6cf174c)
2013-10-28 10:54:48 -04:00
Tim Abbott 1a448c256e Move get-django-setting to bin/.
(imported from commit b4d908897550f9818b6db862d95bb0cbbc1da15a)
2013-10-28 10:54:48 -04:00
Tim Abbott cdd7ab895d Move postgres-init-db to scripts/setup/.
(imported from commit 7844fc5cac3e3c90466216e14b2c5b25b4830216)
2013-10-28 10:54:48 -04:00
Tim Abbott 0a44ba2a28 Move servers/configure-rabbitmq to scripts/setup/.
(imported from commit 2b4d5ccb88675447ae744fb985246211deef7486)
2013-10-28 10:54:48 -04:00