Initial commit.

This commit is contained in:
Antoine Nguyen
2015-10-14 17:27:01 +02:00
parent d241066c27
commit 84fe9b0d16
49 changed files with 4270 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
"""Nginx related tools."""
import os
from .. import utils
from . import base
class Nginx(base.Installer):
"""Nginx installer."""
appname = "nginx"
packages = ["nginx", "ssl-cert"]
def get_template_context(self):
"""Additionnal variables."""
context = super(Nginx, self).get_template_context()
context.update({
"modoboa_instance_path": (
self.config.get("modoboa", "instance_path")),
"uwsgi_socket_path": self.config.get("uwsgi", "socket_path")
})
return context
def post_run(self):
"""Additionnal tasks."""
hostname = self.config.get("general", "hostname")
context = self.get_template_context()
src = self.get_file_path("nginx.conf.tpl")
dst = os.path.join(
self.config_dir, "sites-available", "{}.conf".format(hostname))
utils.copy_from_template(src, dst, context)
link = os.path.join(
self.config_dir, "sites-enabled", os.path.basename(dst))
if os.path.exists(link):
return
os.symlink(dst, link)