diff --git a/corporal/fablib/corporal.py b/corporal/fablib/corporal.py index 97626be..36a48fd 100644 --- a/corporal/fablib/corporal.py +++ b/corporal/fablib/corporal.py @@ -3,7 +3,7 @@ Fabric library for Corporal systems """ -from rattail_fabric2 import postgresql, python, exists, mkdir +from rattail_fabric2 import apache, postgresql, python, exists, mkdir from corporal.fablib import deploy_common @@ -20,7 +20,7 @@ def bootstrap_corporal_app(c, env, envname='corporal', user='rattail', envdir = '/srv/envs/{}'.format(envname) appdir = '{}/app'.format(envdir) srcdir = '{}/src'.format(envdir) - production = False if stage else env.machine_is_live + production = not stage c.sudo('supervisorctl stop {}:'.format(safename), warn=True) @@ -135,7 +135,12 @@ def bootstrap_corporal_app(c, env, envname='corporal', user='rattail', # cron etc. deploy_common.sudoers(c, 'corporal/sudoers.mako', '/etc/sudoers.d/{}'.format(safename), - context={'envdir': envdir, 'safename': safename, - 'host': host, 'stage': stage}) + context={'envdir': envdir, 'safename': safename}) deploy_common(c, 'corporal/logrotate.conf.mako', '/etc/logrotate.d/{}'.format(safename), use_sudo=True, context={'envdir': envdir}) + + # apache + deploy_common.apache_site(c, 'apache/site-corporal.mako', sitename, + enable=True, + context={'sitename': sitename, 'port': port}) + apache.restart(c) diff --git a/corporal/fablib/deploy/apache/site-corporal.mako b/corporal/fablib/deploy/apache/site-corporal.mako new file mode 100644 index 0000000..145ecfd --- /dev/null +++ b/corporal/fablib/deploy/apache/site-corporal.mako @@ -0,0 +1,16 @@ +# -*- mode: apache; -*- + + + ServerName ${sitename} + + # Corporal + + ProxyPreserveHost On + ProxyPass "http://127.0.0.1:${port}/" + ProxyPassReverse "http://127.0.0.1:${port}/" + + + ErrorLog ${'$'}{APACHE_LOG_DIR}/error.log + LogLevel warn + CustomLog ${'$'}{APACHE_LOG_DIR}/access.log combined + diff --git a/corporal/fablib/deploy/corporal/rattail.conf.mako b/corporal/fablib/deploy/corporal/rattail.conf.mako index 20d052d..3f8acf4 100644 --- a/corporal/fablib/deploy/corporal/rattail.conf.mako +++ b/corporal/fablib/deploy/corporal/rattail.conf.mako @@ -19,7 +19,6 @@ default.pool_recycle = 3600 [rattail] production = ${'true' if production else 'false'} app_title = Corporal -node_type = ${node_type} appdir = ${envdir}/app datadir = ${envdir}/app/data workdir = ${envdir}/app/work @@ -57,8 +56,8 @@ files = ${envdir}/app/data/upgrades <%text>############################## [alembic] -script_location = corporal.db:alembic -version_locations = corporal.db:alembic/versions rattail.db:alembic/versions +script_location = rattail.db:alembic +version_locations = rattail_corepos.db:alembic/versions rattail.db:alembic/versions <%text>##############################