From 9ce00ff5e06b0721a40778561dae3dcad142a5d5 Mon Sep 17 00:00:00 2001 From: Stephan Porada Date: Fri, 15 May 2020 14:43:12 +0200 Subject: [PATCH] Merge notify into daemon --- app/models.py | 13 +++++++++++++ docker-compose.yml | 18 +++--------------- nopaque.env.tpl | 3 +++ 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/app/models.py b/app/models.py index ba6424f7..91955841 100644 --- a/app/models.py +++ b/app/models.py @@ -434,6 +434,19 @@ class NotificationEmailData(db.Model): notify_status = db.Column(db.String(16), default=None) creation_date = db.Column(db.DateTime(), default=datetime.utcnow) + def __repr__(self): + ''' + String representation of the NotificationEmailData. For human readability. + ''' + return '' % self.id # TODO: Why not .format()? + + def to_dict(self): + return {'id': self.id, + 'job_id': self.job_id, + 'job': self.job, + 'notify_status': self.notify_status, + 'creation_date': self.creation_date} + class CorpusFile(db.Model): ''' diff --git a/docker-compose.yml b/docker-compose.yml index dc4d7f86..51c0449d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -52,23 +52,11 @@ services: - "./logs:/home/nopaqued/logs" - "../opaque_daemon/docker-entrypoint.sh:/usr/local/bin/docker-entrypoint.sh" - "../opaque_daemon/nopaqued.py:/home/nopaqued/nopaqued.py" + - "../opaque_daemon/decorators.py:/home/nopaqued/decorators.py" + - "../opaque_daemon/notify:/home/nopaqued/notify" + - "../opaque_daemon/templates:/home/nopaqued/templates" - "../opaque_daemon/requirements.txt:/home/nopaqued/requirements.txt" - "$HOME/.docker:/home/nopaqued/.docker" - notify: - depends_on: - - db - env_file: nopaque.env - extra_hosts: - - "host.docker.internal:172.17.0.1" - image: gitlab.ub.uni-bielefeld.de:4567/sfb1288inf/opaque_notify:latest - volumes: - - "./logs:/home/nopaquen/logs" - - "../opaque_notify/docker-entrypoint.sh:/usr/local/bin/docker-entrypoint.sh" - - "../opaque_notify/nopaquen.py:/home/nopaquen/nopaquen.py" - - "../opaque_notify/notify:/home/nopaquen/notify" - - "../opaque_notify/templates:/home/nopaquen/templates" - - "../opaque_notify/requirements.txt:/home/nopaquen/requirements.txt" - - "$HOME/.docker:/home/nopaquen/.docker" db: env_file: nopaque.env image: postgres:11 diff --git a/nopaque.env.tpl b/nopaque.env.tpl index 6e39a0e0..e7efeb1f 100644 --- a/nopaque.env.tpl +++ b/nopaque.env.tpl @@ -23,6 +23,9 @@ MAIL_USE_TLS= MAIL_USERNAME= MAIL_PASSWORD= +### Opaque Notifications ### +OPAQUE_DOMAIN= + ### nopaque ### NOPAQUE_ADMIN= NOPAQUE_MAIL_SENDER=