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', def bootstrap_corporal_app(c, env, envname='corporal', user='rattail',
port=7900, asgi=False, sitename=None, stage=False, port=7900, asgi=False, sitename=None, stage=False,
coredir=None, lanes=None, coredir=None, lanes=None,
core_office_url=None): core_office_url=None,
autostart=True):
""" """
Create a virtual environment for use with a Corporal app. 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) database=dbname)
# supervisor # supervisor
deploy_common(c, 'corporal/supervisor.conf.mako', '/etc/supervisor/conf.d/{}.conf'.format(safename), deploy_common(c, 'corporal/supervisor.conf.mako',
use_sudo=True, context={'envdir': envdir, 'safename': safename, '/etc/supervisor/conf.d/{}.conf'.format(safename),
'port': port, 'asgi': asgi}) use_sudo=True,
context={'envdir': envdir, 'safename': safename,
'port': port, 'asgi': asgi, 'autostart': autostart})
c.sudo('supervisorctl update') c.sudo('supervisorctl update')
c.sudo('supervisorctl start {}:'.format(safename)) 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 directory=${envdir}/app/work
% endif % endif
user=rattail user=rattail
autostart=${'true' if autostart else 'false'}