diff --git a/orchestra/contrib/webapps/models.py b/orchestra/contrib/webapps/models.py index 48e21511..d3fd7121 100644 --- a/orchestra/contrib/webapps/models.py +++ b/orchestra/contrib/webapps/models.py @@ -23,6 +23,8 @@ class WebApp(models.Model): related_name='webapps') data = JSONField(_("data"), blank=True, default={}, help_text=_("Extra information dependent of each service.")) + target_server = models.ForeignKey('orchestration.Server', verbose_name=_("Target Server"), + related_name='webapps') # CMS webapps usually need a database and dbuser, with these virtual fields we tell the ORM to delete them databases = VirtualDatabaseRelation('databases.Database') diff --git a/orchestra/contrib/webapps/settings.py b/orchestra/contrib/webapps/settings.py index b8614dc2..625de96f 100644 --- a/orchestra/contrib/webapps/settings.py +++ b/orchestra/contrib/webapps/settings.py @@ -99,6 +99,7 @@ WEBAPPS_PHP_VERSIONS = Setting('WEBAPPS_PHP_VERSIONS', ( ('5.3-cgi', 'PHP 5.3 FCGID'), ('5.2-cgi', 'PHP 5.2 FCGID'), ('4-cgi', 'PHP 4 FCGID'), + ('7-fpm', 'PHP 7 FPM') ), help_text="Execution modle choose by ending -fpm or -cgi.", validators=[Setting.validate_choices] diff --git a/orchestra/contrib/websites/admin.py b/orchestra/contrib/websites/admin.py index fed31707..5b0dd106 100644 --- a/orchestra/contrib/websites/admin.py +++ b/orchestra/contrib/websites/admin.py @@ -69,7 +69,7 @@ class WebsiteAdmin(SelectAccountAdminMixin, ExtendedModelAdmin): fieldsets = ( (None, { 'classes': ('extrapretty',), - 'fields': ('account_link', 'name', 'protocol', 'domains', 'is_active'), + 'fields': ('account_link', 'name', 'protocol', 'target_server', 'domains', 'is_active'), }), ) form = WebsiteAdminForm diff --git a/orchestra/contrib/websites/backends/apache.py b/orchestra/contrib/websites/backends/apache.py index 90e9d8be..9d42f7f9 100644 --- a/orchestra/contrib/websites/backends/apache.py +++ b/orchestra/contrib/websites/backends/apache.py @@ -58,7 +58,8 @@ class Apache2Controller(ServiceController): context.update({ 'port': self.HTTPS_PORT if ssl else self.HTTP_PORT, 'vhost_set_fcgid': False, - 'server_alias_lines': ' \\\n '.join(context['server_alias']) + 'server_alias_lines': ' \\\n '.join(context['server_alias']), + 'suexec_needed': site.target_server == 'web.pangea.lan' }) context['extra_conf'] = self.get_extra_conf(site, context, ssl) return Template(textwrap.dedent("""\ @@ -71,7 +72,8 @@ class Apache2Controller(ServiceController): CustomLog {{ access_log }} common{% endif %}\ {% if error_log %} ErrorLog {{ error_log }}{% endif %} - SuexecUserGroup {{ user }} {{ group }}\ + {% if suexec_needed %} + SuexecUserGroup {{ user }} {{ group }}{% endif %}\ {% for line in extra_conf.splitlines %} {{ line | safe }}{% endfor %} diff --git a/orchestra/contrib/websites/models.py b/orchestra/contrib/websites/models.py index 6492bbd3..593f4e4e 100644 --- a/orchestra/contrib/websites/models.py +++ b/orchestra/contrib/websites/models.py @@ -34,6 +34,8 @@ class Website(models.Model): domains = models.ManyToManyField(settings.WEBSITES_DOMAIN_MODEL, blank=True, related_name='websites', verbose_name=_("domains")) contents = models.ManyToManyField('webapps.WebApp', through='websites.Content') + target_server = models.ForeignKey('orchestration.Server', verbose_name=_("Target Server"), + related_name='websites') is_active = models.BooleanField(_("active"), default=True) class Meta: