From 0d5aa90e7d2f4e5e177aecb690ee00c801eb8b1d Mon Sep 17 00:00:00 2001 From: Gareth Coles Date: Thu, 31 May 2018 15:52:28 +0100 Subject: [Gunicorn] Announce site deployment --- gunicorn_config.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'gunicorn_config.py') diff --git a/gunicorn_config.py b/gunicorn_config.py index 6c9cf04a..c7d9dcd3 100644 --- a/gunicorn_config.py +++ b/gunicorn_config.py @@ -2,7 +2,10 @@ import re from kombu import Connection -from pysite.constants import RMQ_HOST, RMQ_PASSWORD, RMQ_PORT, RMQ_USERNAME +from pysite.constants import ( + BOT_EVENT_QUEUE, BotEventTypes, DEBUG_MODE, + RMQ_HOST, RMQ_PASSWORD, RMQ_PORT, RMQ_USERNAME, + CHANNEL_DEV_LOGS) from pysite.migrations.runner import run_migrations from pysite.queues import QUEUES @@ -46,3 +49,16 @@ def _when_ready(server=None, output_func=None): for name, queue in QUEUES.items(): queue.declare(channel=channel) output(f"Queue declared: {name}") + + if not DEBUG_MODE: + producer = c.Producer() + producer.publish( + { + "event": BotEventTypes.send_embed, + "data": { + "target": CHANNEL_DEV_LOGS, + "title": "Site Deployment", + "message": "The site has been deployed!" + } + }, + routing_key=BOT_EVENT_QUEUE) -- cgit v1.2.3