mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 13:33:24 +00:00
ENTERPRISE => VOYAGER.
(imported from commit 4f8080b9f506a87ca40bef32e39de5218cba916a)
This commit is contained in:
@@ -31,7 +31,7 @@ def confirm(request, confirmation_key):
|
||||
'key': confirmation_key,
|
||||
'full_name': request.GET.get("full_name", None),
|
||||
'support_email': settings.ZULIP_ADMINISTRATOR,
|
||||
'enterprise': settings.ENTERPRISE
|
||||
'enterprise': settings.VOYAGER
|
||||
}
|
||||
templates = [
|
||||
'confirmation/confirm.html',
|
||||
|
||||
@@ -42,7 +42,7 @@ cp zproject/local_settings_template.py zproject/local_settings.py
|
||||
# Some settings need to be updated for update-prod-static to work
|
||||
#
|
||||
# TODO: Would be much better to instead run the below tools with some
|
||||
# sort of environment hack to make settings.ENTERPRISE=True so that we
|
||||
# sort of environment hack to make settings.VOYAGER=True so that we
|
||||
# don't need to create this dummy secrets file.
|
||||
cat >> zproject/local_settings.py <<EOF
|
||||
DEBUG = False
|
||||
|
||||
@@ -10,7 +10,7 @@ def add_settings(request):
|
||||
# We use the not_enterprise variable name so that templates
|
||||
# will render even if the appropriate context is not provided
|
||||
# to the template
|
||||
'not_enterprise': not settings.ENTERPRISE,
|
||||
'not_enterprise': not settings.VOYAGER,
|
||||
'zulip_com': settings.ZULIP_COM,
|
||||
'zulip_admin': settings.ZULIP_ADMINISTRATOR,
|
||||
'login_url': settings.HOME_NOT_LOGGED_IN,
|
||||
|
||||
@@ -25,12 +25,13 @@ import cProfile
|
||||
from zerver.lib.mandrill_client import get_mandrill_client
|
||||
|
||||
|
||||
if not settings.ENTERPRISE:
|
||||
from zilencer.models import get_deployment_by_domain, Deployment
|
||||
else:
|
||||
if settings.VOYAGER:
|
||||
from mock import Mock
|
||||
get_deployment_by_domain = Mock()
|
||||
Deployment = Mock()
|
||||
else:
|
||||
# Should this be only on zulip.com?
|
||||
from zilencer.models import get_deployment_by_domain, Deployment
|
||||
|
||||
def get_deployment_or_userprofile(role):
|
||||
return get_user_profile_by_email(role) if "@" in role else get_deployment_by_domain(role)
|
||||
|
||||
@@ -44,7 +44,7 @@ class RegistrationForm(forms.Form):
|
||||
# actually required for a realm
|
||||
password = forms.CharField(widget=forms.PasswordInput, max_length=100,
|
||||
required=False)
|
||||
if not settings.ENTERPRISE:
|
||||
if not settings.VOYAGER:
|
||||
terms = forms.BooleanField(required=True)
|
||||
|
||||
|
||||
|
||||
@@ -2173,7 +2173,7 @@ def encode_email_address_helper(name, email_token):
|
||||
def decode_email_address(email):
|
||||
# Perform the reverse of encode_email_address. Returns a tuple of (streamname, email_token)
|
||||
pattern_parts = [re.escape(part) for part in settings.EMAIL_GATEWAY_PATTERN.split('%s')]
|
||||
if settings.PRODUCTION and not settings.ENTERPRISE:
|
||||
if settings.ZULIP_COM or settings.ZULIP_COM_STAGING:
|
||||
# Accept mails delivered to any Zulip server
|
||||
pattern_parts[-1] = r'@[\w-]*\.zulip\.net'
|
||||
match_email_re = re.compile("(.*?)".join(pattern_parts))
|
||||
@@ -2547,7 +2547,7 @@ def do_send_confirmation_email(invitee, referrer):
|
||||
body_template_path = 'confirmation/invite_email_body.txt'
|
||||
context = {'referrer': referrer,
|
||||
'support_email': settings.ZULIP_ADMINISTRATOR,
|
||||
'enterprise': settings.ENTERPRISE}
|
||||
'enterprise': settings.VOYAGER}
|
||||
|
||||
if referrer.realm.domain == 'mit.edu':
|
||||
subject_template_path = 'confirmation/mituser_invite_email_subject.txt'
|
||||
|
||||
@@ -526,7 +526,7 @@ class Avatar(markdown.inlinepatterns.Pattern):
|
||||
img.set('alt', email_address)
|
||||
return img
|
||||
|
||||
if settings.ENTERPRISE:
|
||||
if settings.VOYAGER:
|
||||
path_to_emoji = os.path.join(os.path.dirname(__file__), '..', '..', '..',
|
||||
'prod-static', 'serve', 'third', 'gemoji', 'images', 'emoji', '*.png')
|
||||
else:
|
||||
|
||||
@@ -4,7 +4,7 @@ from django.conf import settings
|
||||
MAIL_CLIENT = None
|
||||
|
||||
def get_mandrill_client():
|
||||
if settings.MANDRILL_API_KEY == '' or settings.DEVELOPMENT or settings.ENTERPRISE:
|
||||
if settings.MANDRILL_API_KEY == '' or settings.DEVELOPMENT or settings.VOYAGER:
|
||||
return None
|
||||
|
||||
global MAIL_CLIENT
|
||||
|
||||
@@ -494,14 +494,14 @@ def send_local_email_template_with_delay(recipients, template_prefix,
|
||||
|
||||
def enqueue_welcome_emails(email, name):
|
||||
sender = {'email': 'wdaher@zulip.com', 'name': 'Waseem Daher'}
|
||||
if settings.ENTERPRISE:
|
||||
if settings.VOYAGER:
|
||||
sender = {'email': settings.ZULIP_ADMINISTRATOR, 'name': 'Zulip'}
|
||||
|
||||
user_profile = get_user_profile_by_email(email)
|
||||
unsubscribe_link = one_click_unsubscribe_link(user_profile, "welcome")
|
||||
|
||||
template_payload = {'name': name,
|
||||
'not_enterprise': not settings.ENTERPRISE,
|
||||
'not_enterprise': not settings.VOYAGER,
|
||||
'external_host': settings.EXTERNAL_HOST,
|
||||
'unsubscribe_link': unsubscribe_link}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ from django.core.management.base import BaseCommand
|
||||
from zerver.lib.actions import do_create_realm, set_default_streams
|
||||
from zerver.models import RealmAlias
|
||||
|
||||
if not settings.ENTERPRISE:
|
||||
if not settings.VOYAGER:
|
||||
from zilencer.models import Deployment
|
||||
|
||||
import re
|
||||
@@ -63,7 +63,7 @@ Usage: python manage.py create_realm --domain=foo.com --name='Foo, Inc.'"""
|
||||
print >>sys.stderr, "\033[1;31mExternal deployments cannot be open realms.\033[0m\n"
|
||||
self.print_help("python manage.py", "create_realm")
|
||||
exit(1)
|
||||
if options["deployment_id"] is not None and settings.ENTERPRISE:
|
||||
if options["deployment_id"] is not None and settings.VOYAGER:
|
||||
print >>sys.stderr, "\033[1;31mExternal deployments are not supported on enterprise deployments.\033[0m\n"
|
||||
exit(1)
|
||||
|
||||
@@ -81,10 +81,11 @@ Usage: python manage.py create_realm --domain=foo.com --name='Foo, Inc.'"""
|
||||
deployment.realms.add(realm)
|
||||
deployment.save()
|
||||
print "Added to deployment", str(deployment.id)
|
||||
elif not settings.ENTERPRISE:
|
||||
elif settings.ZULIP_COM or settings.ZULIP_COM_STAGING:
|
||||
deployment = Deployment.objects.get(base_site_url="https://zulip.com/")
|
||||
deployment.realms.add(realm)
|
||||
deployment.save()
|
||||
# should there be an else clause here?
|
||||
set_default_streams(realm, ["social", "engineering"])
|
||||
|
||||
print "\033[1;36mDefault streams set to social,engineering,zulip!\033[0m"
|
||||
|
||||
@@ -53,8 +53,8 @@ def queue_digest_recipient(user_profile, cutoff):
|
||||
queue_json_publish("digest_emails", event, lambda event: None)
|
||||
|
||||
def domains_for_this_deployment():
|
||||
if settings.PRODUCTION and not settings.ENTERPRISE:
|
||||
# Enterprise deployments don't have a Deployment entry.
|
||||
if settings.ZULIP_COM or settings.ZULIP_COM_STAGING:
|
||||
# Voyager deployments don't have a Deployment entry.
|
||||
# Only send zulip.com digests on staging.
|
||||
from zilencer.models import Deployment
|
||||
site_url = settings.EXTERNAL_URI_SCHEME + settings.EXTERNAL_HOST.rstrip("/")
|
||||
@@ -65,18 +65,19 @@ def domains_for_this_deployment():
|
||||
raise ValueError("digest: Unable to determine deployment.")
|
||||
|
||||
return [r.domain for r in deployment.realms.all()]
|
||||
# Enterprise and localhost.
|
||||
# Voyager and development.
|
||||
return []
|
||||
|
||||
def should_process_digest(domain, deployment_domains):
|
||||
if settings.ENTERPRISE:
|
||||
# Enterprise. We ship with a zulip.com realm for the feedback bot, but
|
||||
if settings.VOYAGER:
|
||||
# Voyager. We ship with a zulip.com realm for the feedback bot, but
|
||||
# don't try to send e-mails to it.
|
||||
return domain != "zulip.com"
|
||||
elif settings.PRODUCTION:
|
||||
# zulip.com or staging.zulip.com
|
||||
return domain in deployment_domains
|
||||
else:
|
||||
# Localhost.
|
||||
# Development
|
||||
return True
|
||||
|
||||
class Command(BaseCommand):
|
||||
|
||||
@@ -830,7 +830,7 @@ def send_registration_completion_email(email, request):
|
||||
"""
|
||||
prereg_user = create_preregistration_user(email, request)
|
||||
context = {'support_email': settings.ZULIP_ADMINISTRATOR,
|
||||
'enterprise': settings.ENTERPRISE}
|
||||
'enterprise': settings.VOYAGER}
|
||||
Confirmation.objects.send_confirmation(prereg_user, email,
|
||||
additional_context=context)
|
||||
|
||||
@@ -966,7 +966,7 @@ def home(request):
|
||||
# Pass parameters to the client-side JavaScript code.
|
||||
# These end up in a global JavaScript Object named 'page_params'.
|
||||
page_params = dict(
|
||||
enterprise = settings.ENTERPRISE,
|
||||
enterprise = settings.VOYAGER,
|
||||
debug_mode = settings.DEBUG,
|
||||
test_suite = settings.TEST_SUITE,
|
||||
poll_timeout = settings.POLL_TIMEOUT,
|
||||
|
||||
@@ -125,7 +125,7 @@ class ConfirmationEmailWorker(QueueProcessingWorker):
|
||||
"zerver/emails/invitation/invitation_reminder_email",
|
||||
{'activate_url': link,
|
||||
'referrer': referrer,
|
||||
'enterprise': settings.ENTERPRISE,
|
||||
'enterprise': settings.VOYAGER,
|
||||
'external_host': settings.EXTERNAL_HOST,
|
||||
'support_email': settings.ZULIP_ADMINISTRATOR},
|
||||
datetime.timedelta(days=2),
|
||||
|
||||
@@ -120,7 +120,7 @@ class Command(BaseCommand):
|
||||
for realm in Realm.objects.all():
|
||||
realms[realm.domain] = realm
|
||||
|
||||
if not settings.ENTERPRISE:
|
||||
if settings.ZULIP_COM or settings.ZULIP_COM_STAGING: # what about development?
|
||||
# Associate initial deployment with Realm
|
||||
dep = Deployment()
|
||||
dep.base_api_url = "https://zulip.com/api/"
|
||||
|
||||
@@ -7,16 +7,17 @@ config_file = ConfigParser.RawConfigParser()
|
||||
config_file.read("/etc/zulip/zulip.conf")
|
||||
|
||||
# Whether we're running in a production environment. Note that PRODUCTION does
|
||||
# **not** mean hosted on Zulip.com; customer sites are PRODUCTION and ENTERPRISE
|
||||
# **not** mean hosted on Zulip.com; customer sites are PRODUCTION and VOYAGER
|
||||
# and as such should not assume they are the main Zulip site.
|
||||
PRODUCTION = config_file.has_option('machine', 'deploy_type')
|
||||
|
||||
# The following flags are left over from the various configurations of
|
||||
# Zulip run by Zulip, Inc. We will eventually be able to get rid of
|
||||
# them and just have the PRODUCTION flag, but we need them for now.
|
||||
ZULIP_COM_STAGING = PRODUCTION and config_file.get('machine', 'deploy_type') == 'staging'
|
||||
ZULIP_COM = PRODUCTION and config_file.get('machine', 'deploy_type') == 'prod'
|
||||
ENTERPRISE = PRODUCTION and config_file.get('machine', 'deploy_type') == 'enterprise'
|
||||
ZULIP_COM_STAGING = PRODUCTION and config_file.get('machine', 'deploy_type') == 'zulip.com-staging'
|
||||
ZULIP_COM = PRODUCTION and config_file.get('machine', 'deploy_type') == 'zulip.com-prod'
|
||||
if not ZULIP_COM and not ZULIP_COM_STAGING:
|
||||
raise Exception("You should create your own local settings from local_settings_template.")
|
||||
|
||||
ZULIP_FRIENDS_LIST_ID = '84b2f3da6b'
|
||||
|
||||
@@ -41,39 +42,23 @@ SESSION_SERIALIZER = "django.contrib.sessions.serializers.PickleSerializer"
|
||||
|
||||
if ZULIP_COM_STAGING:
|
||||
EXTERNAL_HOST = 'staging.zulip.com'
|
||||
elif PRODUCTION:
|
||||
else:
|
||||
EXTERNAL_HOST = 'zulip.com'
|
||||
EXTERNAL_API_PATH = 'api.zulip.com'
|
||||
|
||||
|
||||
# For now, ENTERPRISE is only testing, so write to our test buckets
|
||||
if PRODUCTION and not ENTERPRISE:
|
||||
S3_BUCKET="humbug-user-uploads"
|
||||
S3_AUTH_UPLOADS_BUCKET = "zulip-user-uploads"
|
||||
S3_AVATAR_BUCKET="humbug-user-avatars"
|
||||
else:
|
||||
S3_BUCKET="humbug-user-uploads-test"
|
||||
S3_AUTH_UPLOADS_BUCKET = "zulip-user-uploads-test"
|
||||
S3_AVATAR_BUCKET="humbug-user-avatars-test"
|
||||
|
||||
if PRODUCTION or ZULIP_COM_STAGING:
|
||||
APNS_SANDBOX = "push_production"
|
||||
APNS_FEEDBACK = "feedback_production"
|
||||
APNS_CERT_FILE = "/etc/ssl/django-private/apns-dist.pem"
|
||||
DBX_APNS_CERT_FILE = "/etc/ssl/django-private/dbx-apns-dist.pem"
|
||||
else:
|
||||
APNS_SANDBOX = "push_sandbox"
|
||||
APNS_FEEDBACK = "feedback_sandbox"
|
||||
APNS_CERT_FILE = "/etc/ssl/django-private/apns-dev.pem"
|
||||
DBX_APNS_CERT_FILE = "/etc/ssl/django-private/dbx-apns-dev.pem"
|
||||
|
||||
GOOGLE_CLIENT_ID = "835904834568-77mtr5mtmpgspj9b051del9i9r5t4g4n.apps.googleusercontent.com"
|
||||
|
||||
if PRODUCTION:
|
||||
GOOGLE_OAUTH2_CLIENT_ID = '835904834568-ag4p18v0sd9a0tero14r3gekn6shoen3.apps.googleusercontent.com'
|
||||
else:
|
||||
# Google OAUTH2 for dev with the redirect uri set to http://localhost:9991/accounts/login/google/done/
|
||||
GOOGLE_OAUTH2_CLIENT_ID = '607830223128-4qgthc7ofdqce232dk690t5jgkm1ce33.apps.googleusercontent.com'
|
||||
|
||||
# Administrator domain for this install
|
||||
ADMIN_DOMAIN = "zulip.com"
|
||||
@@ -82,7 +67,7 @@ ADMIN_DOMAIN = "zulip.com"
|
||||
# The %s will be replaced with a unique token.
|
||||
if ZULIP_COM_STAGING:
|
||||
EMAIL_GATEWAY_PATTERN = "%s@streams.staging.zulip.com"
|
||||
elif PRODUCTION:
|
||||
else:
|
||||
EMAIL_GATEWAY_PATTERN = "%s@streams.zulip.com"
|
||||
|
||||
# Email mirror configuration
|
||||
|
||||
@@ -31,7 +31,10 @@ DEVELOPMENT = not PRODUCTION
|
||||
# them and just have the PRODUCTION flag, but we need them for now.
|
||||
ZULIP_COM_STAGING = PRODUCTION and config_file.get('machine', 'deploy_type') == 'zulip.com-staging'
|
||||
ZULIP_COM = PRODUCTION and config_file.get('machine', 'deploy_type') == 'zulip.com-prod'
|
||||
ENTERPRISE = PRODUCTION and config_file.get('machine', 'deploy_type') == 'enterprise'
|
||||
|
||||
# Voyager is a production zulip server that is not zulip.com or staging.zulip.com
|
||||
# VOYAGER is not ENTERPRISE.
|
||||
VOYAGER = PRODUCTION and not ZULIP_COM and not ZULIP_COM_STAGING
|
||||
|
||||
secrets_file = ConfigParser.RawConfigParser()
|
||||
if PRODUCTION:
|
||||
@@ -189,7 +192,7 @@ INSTALLED_APPS = [
|
||||
'zerver',
|
||||
]
|
||||
|
||||
if not ENTERPRISE:
|
||||
if not VOYAGER:
|
||||
INSTALLED_APPS += [
|
||||
'analytics',
|
||||
'zilencer',
|
||||
@@ -220,7 +223,7 @@ DATABASES = {"default": {
|
||||
},
|
||||
}
|
||||
|
||||
if ENTERPRISE:
|
||||
if VOYAGER:
|
||||
DATABASES["default"].update({
|
||||
# Host = '' => connect through a local socket
|
||||
'HOST': '',
|
||||
@@ -276,7 +279,7 @@ CACHES = {
|
||||
########################################################################
|
||||
|
||||
LOCAL_STATSD = (False)
|
||||
USING_STATSD = (PRODUCTION and not ENTERPRISE) or LOCAL_STATSD
|
||||
USING_STATSD = ZULIP_COM or ZULIP_COM_STAGING or LOCAL_STATSD
|
||||
|
||||
# These must be named STATSD_PREFIX for the statsd module
|
||||
# to pick them up
|
||||
@@ -376,7 +379,7 @@ DEFAULT_SETTINGS = {'TWITTER_CONSUMER_KEY': '',
|
||||
'ERROR_REPORTING': True,
|
||||
'NAME_CHANGES_DISABLED': False,
|
||||
'DEPLOYMENT_ROLE_NAME': "",
|
||||
# The following bots only exist in non-ENTERPRISE installs
|
||||
# The following bots only exist in non-VOYAGER installs
|
||||
'ERROR_BOT': None,
|
||||
'NEW_USER_BOT': None,
|
||||
'NAGIOS_STAGING_SEND_BOT': None,
|
||||
@@ -533,7 +536,7 @@ else:
|
||||
STATICFILES_FINDERS = (
|
||||
'zerver.finders.ZulipFinder',
|
||||
)
|
||||
if PRODUCTION or ENTERPRISE:
|
||||
if PRODUCTION:
|
||||
STATIC_ROOT = '/home/zulip/prod-static'
|
||||
else:
|
||||
STATIC_ROOT = 'prod-static/serve'
|
||||
@@ -765,7 +768,7 @@ ZULIP_PATHS = [
|
||||
|
||||
# The Event log basically logs most significant database changes,
|
||||
# which can be useful for debugging.
|
||||
if ENTERPRISE:
|
||||
if VOYAGER:
|
||||
EVENT_LOG_DIR = None
|
||||
else:
|
||||
ZULIP_PATHS.append(("EVENT_LOG_DIR", "/home/zulip/logs/event_log"))
|
||||
|
||||
@@ -254,7 +254,7 @@ v1_api_and_json_patterns = patterns('zerver.views',
|
||||
{'GET': 'get_events_backend',
|
||||
'DELETE': 'cleanup_event_queue'}),
|
||||
)
|
||||
if not settings.ENTERPRISE:
|
||||
if not settings.VOYAGER:
|
||||
v1_api_and_json_patterns += patterns('',
|
||||
# Still scoped to api/v1/, but under a different project
|
||||
url(r'^deployments/', include('zilencer.urls.api')),
|
||||
|
||||
Reference in New Issue
Block a user