Add autostart to template context for supervisor config

This commit is contained in:
Lance Edgar 2023-05-08 17:31:07 -05:00
parent 9e24846b15
commit d8f953b11a
2 changed files with 8 additions and 4 deletions

View file

@ -14,7 +14,8 @@ from corporal.fablib import deploy_common
def bootstrap_corporal_app(c, env, envname='corporal', user='rattail',
port=7900, asgi=False, sitename=None, stage=False,
coredir=None, lanes=None,
core_office_url=None):
core_office_url=None,
autostart=True):
"""
Create a virtual environment for use with a Corporal app.
"""
@ -151,9 +152,11 @@ def bootstrap_corporal_app(c, env, envname='corporal', user='rattail',
database=dbname)
# supervisor
deploy_common(c, 'corporal/supervisor.conf.mako', '/etc/supervisor/conf.d/{}.conf'.format(safename),
use_sudo=True, context={'envdir': envdir, 'safename': safename,
'port': port, 'asgi': asgi})
deploy_common(c, 'corporal/supervisor.conf.mako',
'/etc/supervisor/conf.d/{}.conf'.format(safename),
use_sudo=True,
context={'envdir': envdir, 'safename': safename,
'port': port, 'asgi': asgi, 'autostart': autostart})
c.sudo('supervisorctl update')
c.sudo('supervisorctl start {}:'.format(safename))

View file

@ -12,3 +12,4 @@ command=${envdir}/bin/pserve pastedeploy+ini:${envdir}/app/web.conf
directory=${envdir}/app/work
% endif
user=rattail
autostart=${'true' if autostart else 'false'}