From f946d5e9c61464109ae1a75e718c23263c9610e0 Mon Sep 17 00:00:00 2001 From: Luke Murphy Date: Thu, 9 Apr 2020 21:25:55 +0200 Subject: [PATCH] Switch over to the mongodb DB --- ansible/pre-deploy.yml | 10 +++++----- ansible/templates/alerta.conf | 7 +++---- ansible/templates/alertad.conf | 13 ++++++++----- ansible/vars/all.yml | 5 +++-- 4 files changed, 19 insertions(+), 16 deletions(-) diff --git a/ansible/pre-deploy.yml b/ansible/pre-deploy.yml index df5973c..3f8c59d 100644 --- a/ansible/pre-deploy.yml +++ b/ansible/pre-deploy.yml @@ -15,23 +15,23 @@ - "{{ domain }}" state: present - - name: Create postgres database + - name: Create mongodb database no_log: true shell: " dokku - postgres:create + mongodb:create alerta --password {{ db_passwd }} --root-password {{ root_db_passwd }} " args: - creates: /var/lib/dokku/services/postgres/alerta + creates: /var/lib/dokku/services/mongodb/alerta - - name: Link postgres database to application + - name: Link mongodb database to application dokku_service_link: app: alerta name: alerta - service: postgres + service: mongodb - name: Create application directories become: true diff --git a/ansible/templates/alerta.conf b/ansible/templates/alerta.conf index a90df23..f394fad 100644 --- a/ansible/templates/alerta.conf +++ b/ansible/templates/alerta.conf @@ -1,14 +1,13 @@ [DEFAULT] -endpoint = http://127.0.0.1:8080/api +endpoint = http://localhost:8080/api key = {{ alerta_cli_api_key }} output = psql sslverify = False timezone = Europe/London [alerta-mailer] -amqp_url = mongodb://127.0.0.1:27017/ -amqp_queue_name = kombu -dashboard_url = http://127.0.0.1:8080 +amqp_url = {{ db_type }}://{{ db_loc }}/ +dashboard_url = http://localhost:8080 debug = True email_type = text endpoint = http://127.0.0.1:8080/api diff --git a/ansible/templates/alertad.conf b/ansible/templates/alertad.conf index 62e762f..c43df2c 100644 --- a/ansible/templates/alertad.conf +++ b/ansible/templates/alertad.conf @@ -52,12 +52,15 @@ SEVERITY_MAP = { DEFAULT_NORMAL_SEVERITY = "normal" DEFAULT_PREVIOUS_SEVERITY = "indeterminate" -PLUGINS = ["reject", "blackout", "normalise", "amqp", "mailer"] +PLUGINS = [ + "alerta-mailer", + "amqp", + "blackout", + "normalise", + "reject", +] -AMQP_URL = "mongodb://localhost:27017/kombu" -AMQP_TOPIC = "notify" - -DATABASE_URL = "postgres://{{ db_user }}:{{ db_passwd }}@{{ db_loc }}/{{ db_name }}" +DATABASE_URL = "{{ db_type }}://{{ db_user }}:{{ db_passwd }}@{{ db_loc }}/{{ db_name }}" DATABASE_NAME = "{{ db_name }}" EMAIL_VERIFICATION = False diff --git a/ansible/vars/all.yml b/ansible/vars/all.yml index 30a6eb1..2f1795b 100644 --- a/ansible/vars/all.yml +++ b/ansible/vars/all.yml @@ -1,7 +1,8 @@ --- -db_loc: "dokku-postgres-alerta:5432" +db_loc: "dokku-mongodb-alerta:27017" db_name: "alerta" -db_user: "postgres" +db_type: "mongodb" +db_user: "alerta" domain: "alerta.autonomic.zone" http_port: "8080" keycloak_realm: "autonomic"