remove old manifest files and creation script

This commit is contained in:
Leo Hemsted
2019-04-10 15:21:30 +01:00
parent 7d9cd58e89
commit 8cc5d40291
12 changed files with 0 additions and 303 deletions

View File

@@ -209,16 +209,6 @@ cf-login: ## Log in to Cloud Foundry
@echo "Logging in to Cloud Foundry on ${CF_API}" @echo "Logging in to Cloud Foundry on ${CF_API}"
@cf login -a "${CF_API}" -u ${CF_USERNAME} -p "${CF_PASSWORD}" -o "${CF_ORG}" -s "${CF_SPACE}" @cf login -a "${CF_API}" -u ${CF_USERNAME} -p "${CF_PASSWORD}" -o "${CF_ORG}" -s "${CF_SPACE}"
.PHONY: generate-manifest-old
generate-manifest-old:
$(if ${CF_APP},,$(error Must specify CF_APP))
$(if ${CF_SPACE},,$(error Must specify CF_SPACE))
$(if $(shell which gpg2), $(eval export GPG=gpg2), $(eval export GPG=gpg))
$(if ${GPG_PASSPHRASE_TXT}, $(eval export DECRYPT_CMD=echo -n $$$${GPG_PASSPHRASE_TXT} | ${GPG} --quiet --batch --passphrase-fd 0 --pinentry-mode loopback -d), $(eval export DECRYPT_CMD=${GPG} --quiet --batch -d))
@./scripts/generate_manifest.py ${CF_MANIFEST_FILE} \
<(${DECRYPT_CMD} ${NOTIFY_CREDENTIALS}/credentials/${CF_SPACE}/paas/environment-variables.gpg)
.PHONY: generate-manifest .PHONY: generate-manifest
generate-manifest: generate-manifest:
$(if ${CF_APP},,$(error Must specify CF_APP)) $(if ${CF_APP},,$(error Must specify CF_APP))

View File

@@ -1,67 +0,0 @@
---
buildpack: python_buildpack
command: unset GUNICORN_CMD_ARGS; scripts/run_app_paas.sh gunicorn -c /home/vcap/app/gunicorn_config.py application
services:
- notify-db
- logit-ssl-syslog-drain
env:
NOTIFY_APP_NAME: public-api
CW_APP_NAME: api
# required by cf run-task
FLASK_APP: application.py
SQLALCHEMY_POOL_SIZE: 20
# Credentials variables
ADMIN_BASE_URL: null
ADMIN_CLIENT_SECRET: null
API_HOST_NAME: null
DANGEROUS_SALT: null
SECRET_KEY: null
ROUTE_SECRET_KEY_1: null
ROUTE_SECRET_KEY_2: null
CRONITOR_KEYS: null
PERFORMANCE_PLATFORM_ENDPOINTS: null
NOTIFICATION_QUEUE_PREFIX: null
AWS_ACCESS_KEY_ID: null
AWS_SECRET_ACCESS_KEY: null
STATSD_PREFIX: null
ZENDESK_API_KEY: null
MMG_URL: null
MMG_API_KEY: null
MMG_INBOUND_SMS_AUTH: null
MMG_INBOUND_SMS_USERNAME: null
FIRETEXT_API_KEY: null
LOADTESTING_API_KEY: null
FIRETEXT_INBOUND_SMS_AUTH: null
REDIS_ENABLED: null
REDIS_URL: null
TEMPLATE_PREVIEW_API_HOST: null
TEMPLATE_PREVIEW_API_KEY: null
DOCUMENT_DOWNLOAD_API_HOST: null
DOCUMENT_DOWNLOAD_API_KEY: null
instances: 1
memory: 1G
disk_quota: 2G
applications:
- name: notify-api
- name: notify-api-db-migration
command: sleep infinity
no-route: true
health-check-type: none
instances: 1
memory: 128M

View File

@@ -1,10 +0,0 @@
---
inherit: manifest-api-base.yml
routes:
- route: notify-api-preview.cloudapps.digital
- route: api.notify.works
instances: 1
memory: 1G

View File

@@ -1,9 +0,0 @@
---
inherit: manifest-api-base.yml
routes:
- route: notify-api-production.cloudapps.digital
- route: api.notifications.service.gov.uk
instances: 2
memory: 1G

View File

@@ -1,6 +0,0 @@
---
inherit: manifest-api-base.yml
routes:
- route: notify-api-sandbox.cloudapps.digital

View File

@@ -1,9 +0,0 @@
---
inherit: manifest-api-base.yml
routes:
- route: notify-api-staging.cloudapps.digital
- route: api.staging-notify.works
instances: 2
memory: 1G

View File

@@ -1,107 +0,0 @@
---
buildpack: python_buildpack
health-check-type: none
no-route: true
services:
- notify-db
- logit-ssl-syslog-drain
instances: 1
memory: 1G
env:
# Credentials variables
ADMIN_BASE_URL: null
ADMIN_CLIENT_SECRET: null
API_HOST_NAME: null
DANGEROUS_SALT: null
SECRET_KEY: null
ROUTE_SECRET_KEY_1: null
ROUTE_SECRET_KEY_2: null
CRONITOR_KEYS: null
PERFORMANCE_PLATFORM_ENDPOINTS: null
NOTIFICATION_QUEUE_PREFIX: null
AWS_ACCESS_KEY_ID: null
AWS_SECRET_ACCESS_KEY: null
STATSD_PREFIX: null
ZENDESK_API_KEY: null
MMG_URL: null
MMG_API_KEY: null
MMG_INBOUND_SMS_AUTH: null
MMG_INBOUND_SMS_USERNAME: null
FIRETEXT_API_KEY: null
LOADTESTING_API_KEY: null
FIRETEXT_INBOUND_SMS_AUTH: null
REDIS_ENABLED: null
REDIS_URL: null
TEMPLATE_PREVIEW_API_HOST: null
TEMPLATE_PREVIEW_API_KEY: null
SQLALCHEMY_POOL_SIZE: 1
applications:
- name: notify-delivery-celery-beat
command: scripts/run_app_paas.sh celery -A run_celery.notify_celery beat --loglevel=INFO
instances: 1
memory: 128M
env:
NOTIFY_APP_NAME: delivery-celery-beat
- name: notify-delivery-worker-database
command: scripts/run_app_paas.sh celery -A run_celery.notify_celery worker --loglevel=INFO --concurrency=11 -Q database-tasks 2> /dev/null
env:
NOTIFY_APP_NAME: delivery-worker-database
- name: notify-delivery-worker-research
command: scripts/run_app_paas.sh celery -A run_celery.notify_celery worker --loglevel=INFO --concurrency=5 -Q research-mode-tasks 2> /dev/null
env:
NOTIFY_APP_NAME: delivery-worker-research
- name: notify-delivery-worker-sender
command: scripts/run_multi_worker_app_paas.sh celery multi start 3 -c 10 -A run_celery.notify_celery --loglevel=INFO -Q send-sms-tasks,send-email-tasks
memory: 3G
disk_quota: 2G
env:
NOTIFY_APP_NAME: delivery-worker-sender
- name: notify-delivery-worker-periodic
command: scripts/run_app_paas.sh celery -A run_celery.notify_celery worker --loglevel=INFO --concurrency=2 -Q periodic-tasks,statistics-tasks 2> /dev/null
instances: 1
env:
NOTIFY_APP_NAME: delivery-worker-periodic
- name: notify-delivery-worker-priority
command: scripts/run_app_paas.sh celery -A run_celery.notify_celery worker --loglevel=INFO --concurrency=5 -Q priority-tasks 2> /dev/null
env:
NOTIFY_APP_NAME: delivery-worker-priority
- name: notify-delivery-worker
command: scripts/run_app_paas.sh celery -A run_celery.notify_celery worker --loglevel=INFO --concurrency=11 -Q job-tasks,retry-tasks,create-letters-pdf-tasks,letter-tasks 2> /dev/null
env:
NOTIFY_APP_NAME: delivery-worker
# Only consume the notify-internal-tasks queue on this app so that Notify messages are processed as a priority
- name: notify-delivery-worker-internal
command: scripts/run_app_paas.sh celery -A run_celery.notify_celery worker --loglevel=INFO --concurrency=11 -Q notify-internal-tasks 2> /dev/null
env:
NOTIFY_APP_NAME: delivery-worker-internal
- name: notify-delivery-worker-receipts
command: scripts/run_app_paas.sh celery -A run_celery.notify_celery worker --loglevel=INFO --concurrency=11 -Q ses-callbacks 2> /dev/null
env:
NOTIFY_APP_NAME: delivery-worker-receipts
- name: notify-delivery-worker-service-callbacks
command: scripts/run_app_paas.sh celery -A run_celery.notify_celery worker --loglevel=INFO --concurrency=11 -Q service-callbacks 2> /dev/null
disk_quota: 2G
env:
NOTIFY_APP_NAME: delivery-worker-service-callbacks

View File

@@ -1,5 +0,0 @@
---
inherit: manifest-delivery-base.yml
memory: 1G

View File

@@ -1,6 +0,0 @@
---
inherit: manifest-delivery-base.yml
instances: 2
memory: 1G

View File

@@ -1,3 +0,0 @@
---
inherit: manifest-delivery-base.yml

View File

@@ -1,6 +0,0 @@
---
inherit: manifest-delivery-base.yml
instances: 2
memory: 1G

View File

@@ -1,65 +0,0 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import json
import yaml
def merge_dicts(a, b):
if not (isinstance(a, dict) and isinstance(b, dict)):
raise ValueError("Error merging variables: '{}' and '{}'".format(
type(a).__name__, type(b).__name__
))
result = a.copy()
for key, val in b.items():
if isinstance(result.get(key), dict):
result[key] = merge_dicts(a[key], b[key])
else:
result[key] = val
return result
def load_manifest(manifest_file):
with open(manifest_file) as f:
manifest = yaml.load(f)
if 'inherit' in manifest:
inherit_file = os.path.join(os.path.dirname(manifest_file), manifest.pop('inherit'))
manifest = merge_dicts(load_manifest(inherit_file), manifest)
return manifest
def load_variables(vars_files):
variables = {}
for vars_file in vars_files:
with open(vars_file) as f:
variables = merge_dicts(variables, yaml.load(f))
return {
k.upper(): json.dumps(v) if isinstance(v, (dict, list)) else v
for k, v in variables.items()
}
def paas_manifest(manifest_file, *vars_files):
"""Generate a PaaS manifest file from a Jinja2 template"""
manifest = load_manifest(manifest_file)
variables = load_variables(vars_files)
for key in manifest.get('env', {}):
if key in variables:
manifest['env'][key] = variables[key]
return yaml.dump(manifest, default_flow_style=False, allow_unicode=True)
if __name__ == "__main__":
print('---')
print(paas_manifest(*sys.argv[1:]))