MailgunLogger

栏目: IT技术 · 发布时间: 4年前

内容简介:Simple admin tool to get Mailgun persistence ad infinite.MailgunLogger is a simple admin tool that uses the Mailgun API to retrieves events on a regular basis from Mailgun - who only provide a limited time of event storage - and stores them inside a Postgr

Mailgun Logger

Simple admin tool to get Mailgun persistence ad infinite.

MailgunLogger is a simple admin tool that uses the Mailgun API to retrieves events on a regular basis from Mailgun - who only provide a limited time of event storage - and stores them inside a Postgres database. For efficiency and less complexity, it retrieves events for the last two days (free accounts offer up to three days of persistence) and then inserts everything. Only new events will pass the unique constraint on the db.

This is done because, as stated in the Mailgun docs, it is not guaranteed that for a given time period, all actual events will be ready, since some take time to get into the system although they already happened.

See the docs for implementation details.

IMPORTANT

This application is not affiliated, associated, authorized, endorsed by, or in any way officially connected with Mailgun, or any of its subsidiaries or its affiliates. The official Mailgun website can be found at Mailgun .

This is NOT meant as a replacement for the excellent online tooling provided by Mailgun. Just simple storage, that's it.

Jack + Joe is not responsible for your use of this tool, neither for any persistence guarantees. Free comes at a price :)

Installation

MailgunLogger is available as a Docker image at Docker . To run it:

Docker

$ docker run -d -p 5050:5050 \
  -e "ML_DB_USER=username" \
  -e "ML_DB_PASSWORD=password" \
  -e "ML_DB_NAME=mailgun_logger" \
  -e "ML_DB_HOST=my_db_host" \
  --name mailgun_logger jackjoe/mailgun_logger

Docker Compose

With the following docker-compose.yml :

version: "3"

services:
  db:
    image: postgres
    networks:
      - webnet
    environment:
      POSTGRES_PASSWORD: logger
      POSTGRES_USER: logger
      POSTGRES_DB: mailgun_logger

  web:
    image: jackjoe/mailgun_logger
    ports:
      - "5050:5050"
    networks:
      - webnet
    environment:
      DB_HOST: db
      ML_DB_USER: logger
      ML_DB_PASSWORD: logger
      ML_DB_NAME: mailgun_logger
      ML_DB_HOST: db

networks:
  webnet:

Run:

$ docker-compose up

Then head over to http://0.0.0.0:5050 .

Contributing

To run on your local machine, you need to setup shop first. Mailgun Logger requires a Postgres database using the following environment variables along with their defaults:

# config/config.ex
config :mailgun_logger, MailgunLogger.Repo,
  username: System.get_env("ML_DB_USER", "mailgun_logger_ci"),
  password: System.get_env("ML_DB_PASSWORD", "johndoe"),
  database: System.get_env("ML_DB_NAME", "mailgun_logger_ci_test"),
  hostname: System.get_env("ML_DB_HOST", "localhost"),

Either export your own enviroment variables or adhere to the defaults. Then, for convenience, run:

# runs mix local.hex, deps.get, compile; install dev certificates, make run (see below)
$ make install

which will install all dependencies and setup local dev https certificates using phx.cert .

Then you can run the project:

# runs `iex -S mix phx.server`
$ make run

All of the make targets are convenience wrappers around mix , feel free to run your own. If you are using your own environment variables, consider gathering them in an .env file and source that prior to running the make command:

# non POSIX uses `source` instead of `.`
$ . .env && make run

Then head over to https://0.0.0.0:7000 .

TODO

  • check timestamp conversion!
  • clean up Makefile
  • add travis CI
  • add docker for CI
  • test coverage
  • provide generic logging agent? (no papertrail)

License

This software is licensed under the MIT license .

About Jack + Joe

MailgunLogger is our very first open source project, and we are excited to get it out! We love open source and contributed to various tools over the years, and now we have our own! We use it ourselves as well.

Our announcement article .

Get to know our projects, get in touch. jackjoe.be


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

未来版图

未来版图

麻省理工科技评论 / 人民邮电出版社 / 2018-5-1 / CNY 69.80

《麻省理工科技评论》作为世界上历史悠久、影响力极大的技术商业类杂志,每年都会依据公司的科技领军能力和商业敏感度这两个必要条件,从全球范围内选取50家未来可能会成为行业主导的聪明公司。 这些聪明公司,并非都是行业巨头,甚至专利数量、公司所在地以及资金规模都不在考察范围内。 这些公司是“高精尖科技创新”与“能够保证公司利益* 大化的商业模式”的完 美融合。无论公办私营,无关规模大小,这些遍布全球......一起来看看 《未来版图》 这本书的介绍吧!

正则表达式在线测试
正则表达式在线测试

正则表达式在线测试

HSV CMYK 转换工具
HSV CMYK 转换工具

HSV CMYK互换工具