More fabric tweaks for basic Corporal app install

This commit is contained in:
Lance Edgar 2021-06-11 18:39:56 -05:00
parent f5f5a22df0
commit df559275b1
3 changed files with 27 additions and 7 deletions

View file

@ -3,7 +3,7 @@
Fabric library for Corporal systems 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 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) envdir = '/srv/envs/{}'.format(envname)
appdir = '{}/app'.format(envdir) appdir = '{}/app'.format(envdir)
srcdir = '{}/src'.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) c.sudo('supervisorctl stop {}:'.format(safename), warn=True)
@ -135,7 +135,12 @@ def bootstrap_corporal_app(c, env, envname='corporal', user='rattail',
# cron etc. # cron etc.
deploy_common.sudoers(c, 'corporal/sudoers.mako', '/etc/sudoers.d/{}'.format(safename), deploy_common.sudoers(c, 'corporal/sudoers.mako', '/etc/sudoers.d/{}'.format(safename),
context={'envdir': envdir, 'safename': safename, context={'envdir': envdir, 'safename': safename})
'host': host, 'stage': stage})
deploy_common(c, 'corporal/logrotate.conf.mako', '/etc/logrotate.d/{}'.format(safename), deploy_common(c, 'corporal/logrotate.conf.mako', '/etc/logrotate.d/{}'.format(safename),
use_sudo=True, context={'envdir': envdir}) 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)

View file

@ -0,0 +1,16 @@
# -*- mode: apache; -*-
<VirtualHost *:80>
ServerName ${sitename}
# Corporal
<Location "/">
ProxyPreserveHost On
ProxyPass "http://127.0.0.1:${port}/"
ProxyPassReverse "http://127.0.0.1:${port}/"
</Location>
ErrorLog ${'$'}{APACHE_LOG_DIR}/error.log
LogLevel warn
CustomLog ${'$'}{APACHE_LOG_DIR}/access.log combined
</VirtualHost>

View file

@ -19,7 +19,6 @@ default.pool_recycle = 3600
[rattail] [rattail]
production = ${'true' if production else 'false'} production = ${'true' if production else 'false'}
app_title = Corporal app_title = Corporal
node_type = ${node_type}
appdir = ${envdir}/app appdir = ${envdir}/app
datadir = ${envdir}/app/data datadir = ${envdir}/app/data
workdir = ${envdir}/app/work workdir = ${envdir}/app/work
@ -57,8 +56,8 @@ files = ${envdir}/app/data/upgrades
<%text>##############################</%text> <%text>##############################</%text>
[alembic] [alembic]
script_location = corporal.db:alembic script_location = rattail.db:alembic
version_locations = corporal.db:alembic/versions rattail.db:alembic/versions version_locations = rattail_corepos.db:alembic/versions rattail.db:alembic/versions
<%text>##############################</%text> <%text>##############################</%text>