From b6a168390f36ddcfc254e5217aca5c8c3962d28e Mon Sep 17 00:00:00 2001 From: Marc Date: Fri, 17 Oct 2014 13:09:56 +0000 Subject: [PATCH] =?UTF-8?q?random=20fixes=C2=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- INSTALL.md | 11 +++++++++++ orchestra/apps/domains/backends.py | 9 ++++++--- orchestra/apps/systemusers/models.py | 1 + orchestra/apps/webapps/backends/phpfcgid.py | 5 ++--- orchestra/apps/webapps/settings.py | 5 +++-- scripts/migration/domains.sh | 4 ++++ 6 files changed, 27 insertions(+), 8 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index 91a637ec..579598ee 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -76,3 +76,14 @@ Additionally the following command can be used in order to determine the current python manage.py orchestraversion ``` + + +Extra +===== + +1. Generate a passwordless ssh key for orchestra user +ssh-keygen + +2. Copy this key to all servers orchestra will manage, including itself is neccessary +ssh-copy-id root@ + diff --git a/orchestra/apps/domains/backends.py b/orchestra/apps/domains/backends.py index f00360f3..1e50f900 100644 --- a/orchestra/apps/domains/backends.py +++ b/orchestra/apps/domains/backends.py @@ -45,10 +45,13 @@ class Bind9MasterDomainBackend(ServiceController): self.delete_conf(context) def delete_conf(self, context): + if context['name'][0] in ('*', '_'): + # These can never be top level domains + return self.append(textwrap.dedent(""" - awk -v s=%(name)s 'BEGIN { - RS=""; s="zone \\""s"\\"" - } $0!~s{ print $0"\\n" }' %(conf_path)s > %(conf_path)s.tmp""" % context + cat -s <(sed -e 's/^};/};\n/' named.conf.local) | \ + awk -v s="%(name)s" 'BEGIN { RS=""; s="zone \""s"\"" } $0!~s{ print $0"\n" }' \ + > %(conf_path)s.tmp""" % context )) self.append('diff -I"^\s*//" %(conf_path)s.tmp %(conf_path)s || UPDATED=1' % context) self.append('mv %(conf_path)s.tmp %(conf_path)s' % context) diff --git a/orchestra/apps/systemusers/models.py b/orchestra/apps/systemusers/models.py index d07a1800..7df96aa5 100644 --- a/orchestra/apps/systemusers/models.py +++ b/orchestra/apps/systemusers/models.py @@ -67,6 +67,7 @@ class SystemUser(models.Model): basehome = basehome.replace('/./', '/') home = os.path.join(basehome, self.home) # Chrooting + # TODO option for disabling chrooting home = home.split('/') home.insert(-2, '.') return '/'.join(home) diff --git a/orchestra/apps/webapps/backends/phpfcgid.py b/orchestra/apps/webapps/backends/phpfcgid.py index ec69cee4..c796ac3f 100644 --- a/orchestra/apps/webapps/backends/phpfcgid.py +++ b/orchestra/apps/webapps/backends/phpfcgid.py @@ -33,7 +33,7 @@ class PHPFcgidBackend(WebAppServiceMixin, ServiceController): def commit(self): super(PHPFcgidBackend, self).commit() - self.append("[[ $UPDATED_APACHE == 1 ]] && { /etc/init.d/apache reload; }") + self.append("[[ $UPDATED_APACHE == 1 ]] && { service apache2 reload; }") def get_context(self, webapp): context = super(PHPFcgidBackend, self).get_context(webapp) @@ -50,8 +50,7 @@ class PHPFcgidBackend(WebAppServiceMixin, ServiceController): #!/bin/sh # %(banner)s export PHPRC=/etc/%(type)s/cgi/ - exec /usr/bin/%(type)s-cgi %(init_vars)s - """ % context), + exec /usr/bin/%(type)s-cgi %(init_vars)s""" % context), 'wrapper_path': wrapper_path, 'wrapper_dir': os.path.dirname(wrapper_path), }) diff --git a/orchestra/apps/webapps/settings.py b/orchestra/apps/webapps/settings.py index 25d51d12..8b93a210 100644 --- a/orchestra/apps/webapps/settings.py +++ b/orchestra/apps/webapps/settings.py @@ -2,6 +2,7 @@ from django.conf import settings from django.utils.translation import ugettext_lazy as _ +# TODO make '%(mainuser_home)s/webapps... WEBAPPS_BASE_ROOT = getattr(settings, 'WEBAPPS_BASE_ROOT', '/home/%(user)s/webapps/%(app_name)s/') @@ -30,8 +31,8 @@ WEBAPPS_TYPES = getattr(settings, 'WEBAPPS_TYPES', { _("This creates a PHP5.5 application under ~/webapps/\n" "PHP-FPM will be used to execute PHP files.") ), - 'php5': ( - _("PHP 5"), + 'php5.2': ( + _("PHP 5.2"), 'fcgid', (WEBAPPS_FCGID_PATH,), _("This creates a PHP5.2 application under ~/webapps/\n" "Apache-mod-fcgid will be used to execute PHP files.") diff --git a/scripts/migration/domains.sh b/scripts/migration/domains.sh index 9729613e..959d96f5 100644 --- a/scripts/migration/domains.sh +++ b/scripts/migration/domains.sh @@ -18,6 +18,10 @@ echo "from orchestra.apps.accounts.models import Account" echo "account = Account.objects.get(pk=1)" ERRORS="" while read name; do + [[ -f $name ]] && { + ZONE_PATH=${name%/*} + name=${name##*/} + } ZONE=$(named-checkzone -D $name ${ZONE_PATH}/$name) if [[ $? != 0 ]]; then ERRORS="${ERRORS} $name"