No description, website, or topics provided.
Clone or download
pyup-bot and samuelcolvin Scheduled monthly dependency update for August (#106)
* Update cffi from 1.11.4 to 1.11.5

* Update libsass from 0.13.6 to 0.14.5

* Update multidict from 4.0.0 to 4.3.1

* Update uvloop from 0.9.1 to 0.11.0

* Update aiohttp from 2.3.9 to 3.3.2

* Update aiohttp-jinja2 from 0.14.0 to 1.0.0

* Update aioredis from 1.0.0 to 1.1.0

* Update arq from 0.13 to 0.14

* Update chevron from 0.11.1 to 0.12.2

* Update ipython from 6.2.1 to 6.5.0

* Update msgpack-python from 0.5.1 to 0.5.6

* Update phonenumbers from 8.8.9 to 8.9.10

* Update pydantic from 0.6.3 to 0.12.1

* Update pytz from 2017.3 to 2018.5

* Update raven from 6.5.0 to 6.9.0

* Update raven-aiohttp from 0.6.0 to 0.7.0

* Update ua-parser from 0.7.3 to 0.8.0

* Update aiohttp-devtools from 0.7 to 0.10.1

* Update requests from 2.18.4 to 2.19.1

* Update coverage from 4.4.2 to 4.5.1

* Update isort from 4.2.15 to 4.3.4

* Update pycodestyle from 2.3.1 to 2.4.0

* Update pyflakes from 1.6.0 to 2.0.0

* Update pytest from 3.3.2 to 3.7.0

* Update pytest-isort from 0.1.0 to 0.2.0

* Update pytest-mock from 1.6.3 to 1.10.0

* Update pytest-sugar from 0.9.0 to 0.9.1

* Update pytest-toolbox from 0.2 to 0.4

* Fix deprecation errors

* Use harrier with email
Latest commit 955f653 Aug 21, 2018

README.md

Morpheus

Build Status codecov.io pypi

MIT license, Copyright (c) 2017 TutorCruncher & Samuel Colvin. See LICENSE for details.

"The Greek God of Dreams who delivered messages from the gods to the mortal world"

Okay, chill. We're not normally that astronomically arrogant. Just the obvious mythological name for a messaging platform - "hermes" was already taken by a plethora of terrible nineties mail clients.

What morpheus does:

  • sends emails and SMSs fast using mandrill, SES (TODO) and messagebird (SMS). One http request to send 5000 emails or SMSs.
  • generate PDFs for attachments given HTML using wkhtmltopdf.
  • provide a searchable history of sent messages and delivery analytics.
  • manage sending quotas as mandrill does when not using mandrill.

Here's a picture to help explain:

Morpheus and Iris

Usage

Running locally

Set up your environment

source activate.sh

then

docker build morpheus -t morpheus && docker-compose up -d

--build makes sure to build any changes to the morpheus image, -d is detach

At the same time in another window

until $(curl -so /dev/null http://localhost:8001/logs -I && true); do printf .; sleep 0.1; done && curl -s http://localhost:8001/logs

To view the logs

You can also run either the web or worker with

./morpheus/run.py web
# OR
./morpheus/run.py worker

You'll need elastic search and redis installed.

To prepare for deploy

Get ssl cert.pem and key.pem and put them in ./nginx/keys.

Create activate.prod.sh:

#!/usr/bin/env bash
. env/bin/activate
export SCALEWAY_ORGANIZATION='...1'
export SCALEWAY_TOKEN='...'
export LOGSPOUT_ENDPOINT='...'
export RAVEN_DSN='...'
export APP_AUTH_KEY='...'
export APP_MANDRILL_KEY='...'
export APP_USER_AUTH_KEY='...'
export APP_HOST_NAME='...'
export APP_PUBLIC_LOCAL_API_URL='...'
export APP_ADMIN_BASIC_AUTH_PASSWORD='...'
export APP_S3_ACCESS_KEY='...'
export APP_S3_SECRET_KEY='...'

export APP_MESSAGEBIRD_KEY='...'
export APP_MESSAGEBIRD_PRICING_USERNAME='...'
export APP_MESSAGEBIRD_PRICING_PASSWORD='...'

echo "enabling docker machine..."
eval $(docker-machine env morpheus)

export MODE='PRODUCTION'
export PS1="PROD $PS1"

Setting up the machine

you'll need to add

vm.max_map_count=262144

To the end of /etc/sysctl.conf to allow elastic search to boot.

To deploy

Set up your environment

./start-prod.sh

(this assumes you have a prod gnome profile setup to differentiate commands going to the production server)

then

./deploy/deploy

That same command should also work to update the deployment after a change.

To test

Set up your environment. If you have ElasticSearch installed and running you're fine, or you can run it with:

./run-es.sh

then

make

to monitor

backup in progress (the pydf image has curl installed)

docker exec -it morpheus_pdf_1 curl elastic:9200/_cat/recovery?v

indices

docker exec -it morpheus_pdf_1 curl elastic:9200/_cat/indices/?v

to backup redis

docker exec -it morpheus_redis_1 redis-cli SAVE
docker cp morpheus_redis_1:/data/dump.rdb dump.rdb

to restore redis

./deploy/compose stop redis
docker cp dump.rdb morpheus_redis_1:/data/dump.rdb
./deploy/compose start redis

check with

docker exec -it morpheus_redis_1 redis-cli DBSIZE
docker exec -it morpheus_redis_1 redis-cli INFO