From 21f09dcab72e71099c75fc05995f54b2a9032518 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Fri, 3 Feb 2017 12:46:58 -0800 Subject: [PATCH] docs: Make it harder to screw up our manage.py commands. --- docs/prod-install.md | 21 +++++++++++++-------- manage.py | 2 +- zproject/prod_settings_template.py | 3 ++- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/docs/prod-install.md b/docs/prod-install.md index 961c17a89d..36851fff6e 100644 --- a/docs/prod-install.md +++ b/docs/prod-install.md @@ -84,10 +84,11 @@ These settings include: - `EMAIL_*`, `DEFAULT_FROM_EMAIL`, and `NOREPLY_EMAIL_ADDRESS`: Regardless of which authentication backends you enable, you must provide settings for an outgoing SMTP server so Zulip can send - emails when needed (and don't forget to set `email_password` in - the `zulip-secrets.conf` file). We highly recommend testing - your configuration using `manage.py send_test_email` to confirm - your outgoing email configuration is working correctly. + emails when needed (and don't forget to set `email_password` in the + `zulip-secrets.conf` file). We highly recommend testing your + configuration using `su zulip` and then + `/home/zulip/deployments/current/manage.py send_test_email` to + confirm your outgoing email configuration is working correctly. ## Step 4: Initialize Zulip database @@ -109,16 +110,20 @@ in your Zulip installation. ## Step 5: Create a Zulip organization and login * If you haven't already, verify that your server can send email using -`./manage.py send_test_email username@example.com`. You'll need -working outgoing email to complete the setup process. + + ``` + su zulip + /home/zulip/deployments/current/manage.py send_test_email user@example.com + ``` + + You'll need working outgoing email to complete the setup process. * Run the organization (realm) creation [management command](prod-maintain-secure-upgrade.html#management-commands) : ``` su zulip # If you weren't already the zulip user - cd /home/zulip/deployments/current - ./manage.py generate_realm_creation_link + /home/zulip/deployments/current/manage.py generate_realm_creation_link ``` This will print out a secure 1-time use link that allows creation of a diff --git a/manage.py b/manage.py index 2423c81943..c3fae5ac76 100755 --- a/manage.py +++ b/manage.py @@ -11,7 +11,7 @@ import scripts.lib.setup_path_on_import if __name__ == "__main__": if 'posix' in os.name and os.geteuid() == 0: from django.core.management.base import CommandError - raise CommandError("manage.py should not be run as root.") + raise CommandError("manage.py should not be run as root. Use `su zulip` to drop root.") os.environ.setdefault("DJANGO_SETTINGS_MODULE", "zproject.settings") os.environ.setdefault("PYTHONSTARTUP", os.path.join(BASE_DIR, "scripts/lib/pythonrc.py")) diff --git a/zproject/prod_settings_template.py b/zproject/prod_settings_template.py index 20df0ebdb7..95dcd9a5d1 100644 --- a/zproject/prod_settings_template.py +++ b/zproject/prod_settings_template.py @@ -85,7 +85,8 @@ SSO_APPEND_DOMAIN = None # type: str # https://support.google.com/mail/answer/14257. # # You can quickly test your sending email configuration using: -# ./manage.py send_test_email username@example.com +# su zulip +# /home/zulip/deployments/current/manage.py send_test_email username@example.com # # A common problem is hosting providers that block outgoing SMTP traffic. #