I have some Django-based systems that often need to be deployed on different servers. This involves, among other things, installing all dependencies, downloading project files, placing them in a standardized folder, etc., all of which can be done through a simple script.
However, a part of this process I've always done manually, since I do not know a good way to automate / semi-automate:
Create a virtual host for my application; in general it is just an archive with more or less this format:
<VirtualHost X.X.X.X:443>
SSLEngine On
ServerName <<nome do servidor>>
ServerAlias <<nome alternativo>>
ServerAdmin <<e-mail do administrador>>
DocumentRoot /opt/<<pasta da aplicação>>
Alias /media/ /opt/<<pasta da aplicação>>/media/
Alias /static/ /opt/<<pasta da aplicação>>/static/
WSGIDaemonProcess <<processo wsgi>> user=<<usuario>> group=<<grupo>> threads=1
WSGIProcessGroup <<grupo wsgi>>
WSGIScriptAlias / /opt/<<pasta da aplicação>>/aplicacao.wsgi
</VirtualHost>
to be placed in sites-available
with link in sites-enabled
. This is the easiest: in the last case, I can generate the file given the desired parameters. But if you have a simpler way, the better.
Are there tools - from Apache itself or from third parties (preferably open-source ) - to simplify this configuration, without requiring you to edit httpd.conf
and its various referenced files? Or, if the answer is no, what is the best way to programmatically edit these files? Unlike popular formats like XML, JSON and YAML, I do not know any reader / writer for their format.
P.S. I'm assuming a Linux / Unix environment, and the programming language does not matter (but if there is a solution in Python, so much the better).