give instances and NOTIFY_APP_NAME sensible defaults

NOTIFY_APP_NAME follows precedent and just tries to strip 'notify-'
from the beginning of the string.

instances is not specified at all if not defined - it'll scale up to
the same amount of instances as currently present, and then the
autoscaler will take over anyway
This commit is contained in:
Leo Hemsted
2019-04-11 14:57:22 +01:00
parent 575ec96b6b
commit c786258a60

View File

@@ -7,22 +7,16 @@
},
'notify-api-db-migration': {'NOTIFY_APP_NAME': 'api', 'instances': 0},
'notify-delivery-celery-beat': {'NOTIFY_APP_NAME': 'delivery-celery-beat', 'instances': 1, 'memory': '128M'},
'notify-delivery-worker-database': {'NOTIFY_APP_NAME': 'delivery-worker-database'},
'notify-delivery-worker-research': {'NOTIFY_APP_NAME': 'delivery-worker-research'},
'notify-delivery-worker-sender': {'NOTIFY_APP_NAME': 'delivery-worker-sender', 'instances': 1, 'disk_quota': '2G', 'memory': '3G'},
'notify-delivery-worker-periodic': {'NOTIFY_APP_NAME': 'delivery-worker-periodic', 'instances': 1},
'notify-delivery-worker-priority': {'NOTIFY_APP_NAME': 'delivery-worker-priority'},
'notify-delivery-worker': {'NOTIFY_APP_NAME': 'delivery-worker'},
'notify-delivery-worker-internal': {'NOTIFY_APP_NAME': 'delivery-worker-internal'},
'notify-delivery-worker-receipts': {'NOTIFY_APP_NAME': 'delivery-worker-receipts'},
'notify-delivery-worker-service-callbacks': {'NOTIFY_APP_NAME': 'delivery-worker-service-callbacks', 'disk_quota': '2G'},
} -%}
{%- set env_defaults = {
'preview': {'instances': 1},
'staging': {'instances': 2},
'production': {'instances': 2}
'notify-delivery-celery-beat': {'memory': '128M'},
'notify-delivery-worker-database': {},
'notify-delivery-worker-research': {},
'notify-delivery-worker-sender': {'disk_quota': '2G', 'memory': '3G'},
'notify-delivery-worker-periodic': {},
'notify-delivery-worker-priority': {},
'notify-delivery-worker': {},
'notify-delivery-worker-internal': {},
'notify-delivery-worker-receipts': {},
'notify-delivery-worker-service-callbacks': {'disk_quota': '2G'},
} -%}
{%- set app = app_vars[CF_APP] -%}
@@ -32,8 +26,9 @@
applications:
- name: {{ CF_APP }}
buildpack: python_buildpack
instances: {{ app.get('instances', env_defaults[environment]['instances']) }}
{% if 'instances' in app %}
instances: {{ app['instances'] }}
{%- endif %}
memory: {{ app.get('memory', '1G') }}
disk_quota: {{ app.get('disk_quota', '1G')}}
@@ -52,7 +47,7 @@ applications:
- logit-ssl-syslog-drain
env:
NOTIFY_APP_NAME: {{ app['NOTIFY_APP_NAME'] }}
NOTIFY_APP_NAME: {{ app.get('NOTIFY_APP_NAME', CF_APP.replace('notify-', '')) }}
SQLALCHEMY_POOL_SIZE: {{ app.get('sqlalchemy_pool_size', 1) }}
FLASK_APP: application.py