Added support for multiple webservers
This commit is contained in:
parent
0c1b4c7f4a
commit
a1f73d883a
|
@ -23,6 +23,8 @@ class WebApp(models.Model):
|
||||||
related_name='webapps')
|
related_name='webapps')
|
||||||
data = JSONField(_("data"), blank=True, default={},
|
data = JSONField(_("data"), blank=True, default={},
|
||||||
help_text=_("Extra information dependent of each service."))
|
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
|
# CMS webapps usually need a database and dbuser, with these virtual fields we tell the ORM to delete them
|
||||||
databases = VirtualDatabaseRelation('databases.Database')
|
databases = VirtualDatabaseRelation('databases.Database')
|
||||||
|
|
|
@ -99,6 +99,7 @@ WEBAPPS_PHP_VERSIONS = Setting('WEBAPPS_PHP_VERSIONS', (
|
||||||
('5.3-cgi', 'PHP 5.3 FCGID'),
|
('5.3-cgi', 'PHP 5.3 FCGID'),
|
||||||
('5.2-cgi', 'PHP 5.2 FCGID'),
|
('5.2-cgi', 'PHP 5.2 FCGID'),
|
||||||
('4-cgi', 'PHP 4 FCGID'),
|
('4-cgi', 'PHP 4 FCGID'),
|
||||||
|
('7-fpm', 'PHP 7 FPM')
|
||||||
),
|
),
|
||||||
help_text="Execution modle choose by ending -fpm or -cgi.",
|
help_text="Execution modle choose by ending -fpm or -cgi.",
|
||||||
validators=[Setting.validate_choices]
|
validators=[Setting.validate_choices]
|
||||||
|
|
|
@ -69,7 +69,7 @@ class WebsiteAdmin(SelectAccountAdminMixin, ExtendedModelAdmin):
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
(None, {
|
(None, {
|
||||||
'classes': ('extrapretty',),
|
'classes': ('extrapretty',),
|
||||||
'fields': ('account_link', 'name', 'protocol', 'domains', 'is_active'),
|
'fields': ('account_link', 'name', 'protocol', 'target_server', 'domains', 'is_active'),
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
form = WebsiteAdminForm
|
form = WebsiteAdminForm
|
||||||
|
|
|
@ -58,7 +58,8 @@ class Apache2Controller(ServiceController):
|
||||||
context.update({
|
context.update({
|
||||||
'port': self.HTTPS_PORT if ssl else self.HTTP_PORT,
|
'port': self.HTTPS_PORT if ssl else self.HTTP_PORT,
|
||||||
'vhost_set_fcgid': False,
|
'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)
|
context['extra_conf'] = self.get_extra_conf(site, context, ssl)
|
||||||
return Template(textwrap.dedent("""\
|
return Template(textwrap.dedent("""\
|
||||||
|
@ -71,7 +72,8 @@ class Apache2Controller(ServiceController):
|
||||||
CustomLog {{ access_log }} common{% endif %}\
|
CustomLog {{ access_log }} common{% endif %}\
|
||||||
{% if error_log %}
|
{% if error_log %}
|
||||||
ErrorLog {{ error_log }}{% endif %}
|
ErrorLog {{ error_log }}{% endif %}
|
||||||
SuexecUserGroup {{ user }} {{ group }}\
|
{% if suexec_needed %}
|
||||||
|
SuexecUserGroup {{ user }} {{ group }}{% endif %}\
|
||||||
{% for line in extra_conf.splitlines %}
|
{% for line in extra_conf.splitlines %}
|
||||||
{{ line | safe }}{% endfor %}
|
{{ line | safe }}{% endfor %}
|
||||||
</VirtualHost>
|
</VirtualHost>
|
||||||
|
|
|
@ -34,6 +34,8 @@ class Website(models.Model):
|
||||||
domains = models.ManyToManyField(settings.WEBSITES_DOMAIN_MODEL, blank=True,
|
domains = models.ManyToManyField(settings.WEBSITES_DOMAIN_MODEL, blank=True,
|
||||||
related_name='websites', verbose_name=_("domains"))
|
related_name='websites', verbose_name=_("domains"))
|
||||||
contents = models.ManyToManyField('webapps.WebApp', through='websites.Content')
|
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)
|
is_active = models.BooleanField(_("active"), default=True)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
|
Loading…
Reference in New Issue