From fb29858e46fb955ada91995660c9b7110f28ac72 Mon Sep 17 00:00:00 2001 From: Ian Kent Date: Wed, 17 Dec 2014 19:54:29 +0000 Subject: [PATCH] Fix #16 (on the right branch this time!) --- CONFIG.md | 14 ++++++++++++++ DEPLOY.md | 40 ++++++++++++++++++++++++++++++++++++++++ README.md | 28 +++++++--------------------- 3 files changed, 61 insertions(+), 21 deletions(-) create mode 100644 CONFIG.md create mode 100644 DEPLOY.md diff --git a/CONFIG.md b/CONFIG.md new file mode 100644 index 00000000..683bc81b --- /dev/null +++ b/CONFIG.md @@ -0,0 +1,14 @@ +Configuring MailHog +=================== + +You can configure Go-MailHog using command line options or environment variables: + +| Environment | Command line | Default | Description +| ------------------- | ------------- | --------------- | ----------- +| MH_HOSTNAME | -hostname | mailhog.example | Hostname to use for EHLO/HELO and message IDs +| MH_HTTP_BIND_ADDR | -httpbindaddr | 0.0.0.0:8025 | Interface and port for HTTP server to bind to +| MH_MONGO_COLLECTION | -mongocoll | messages | MongoDB collection name for message storage +| MH_MONGO_DB | -mongodb | mailhog | MongoDB database name for message storage +| MH_MONGO_URI | -mongouri | 127.0.0.1:27017 | MongoDB host and port +| MH_SMTP_BIND_ADDR | -smtpbindaddr | 0.0.0.0:1025 | Interface and port for SMTP server to bind to +| MH_STORAGE | -storage | memory | Set message storage: memory / mongodb diff --git a/DEPLOY.md b/DEPLOY.md new file mode 100644 index 00000000..cb2440ea --- /dev/null +++ b/DEPLOY.md @@ -0,0 +1,40 @@ +Deploying MailHog +================= + +### Command line + +You can run MailHog locally from the command line. + + go get github.com/ian-kent/MailHog/MailHog + MailHog + +To configure MailHog, use the environment variables or command line flags +described in the [README](README.md). + +### Using supervisord/upstart/etc + +MailHog can be started as a daemon using supervisord/upstart/etc. + +See [this example init script](https://github.com/geerlingguy/ansible-role-mailhog/blob/master/files/mailhog) +and [this Ansible role](https://github.com/geerlingguy/ansible-role-mailhog) by [geerlingguy](https://github.com/geerlingguy). + +### Docker + +The example [Dockerfile](Dockerfile) can be used to run MailHog in a [Docker](https://www.docker.com/) container. + +### Elastic Beanstalk + +You can deploy Go-MailHog using [AWS Elastic Beanstalk](http://aws.amazon.com/elasticbeanstalk/). + +1. Open the Elastic Beanstalk console +2. Create a zip file containing the Dockerfile and MailHog binary +3. Create a new Elastic Beanstalk application +4. Launch a new environment and upload the zip file + +If you're using in-memory storage, you can only use a single instance of +Go-MailHog. To use a load balanced EB application, use MongoDB backed storage. + +To configure your Elastic Beanstalk MailHog instance, either: + +* Set environment variables using the Elastic Beanstalk console +* Edit the Dockerfile to pass in command line arguments diff --git a/README.md b/README.md index 6c062116..c3c8273f 100644 --- a/README.md +++ b/README.md @@ -13,13 +13,13 @@ Go was chosen for portability - MailHog runs without installation on multiple pl ### Getting started -Either: - -* [Download the latest release](RELEASES.md) of Go-MailHog for your platform -* Use Docker or AWS Elastic Beanstalk to deploy Go-MailHog with the example [Dockerfile](Dockerfile) - -By default, the SMTP server will start on port 1025, the HTTP server will start -on port 8025, and in-memory message storage will be used. +1. Either: + * [Download the latest release](RELEASES.md) of Go-MailHog for your platform + * [Read the deployment guide](DEPLOY.md) for other deployment options +2. [Configure MailHog](CONFIG.md), or use the default settings: + * the SMTP server will start on port 1025 + * the HTTP server will start on port 8025 + * in-memory message storage will be used. ### Features @@ -40,20 +40,6 @@ on port 8025, and in-memory message storage will be used. ![Screenshot of MailHog web interface](/images/MailHog.png "MailHog web interface") -### Configuration - -You can configure Go-MailHog using command line options or environment variables: - -| Environment | Command line | Default | Description -| ------------------- | ------------- | --------------- | ----------- -| MH_HOSTNAME | -hostname | mailhog.example | Hostname to use for EHLO/HELO and message IDs -| MH_HTTP_BIND_ADDR | -httpbindaddr | 0.0.0.0:8025 | Interface and port for HTTP server to bind to -| MH_MONGO_COLLECTION | -mongocoll | messages | MongoDB collection name for message storage -| MH_MONGO_DB | -mongodb | mailhog | MongoDB database name for message storage -| MH_MONGO_URI | -mongouri | 127.0.0.1:27017 | MongoDB host and port -| MH_SMTP_BIND_ADDR | -smtpbindaddr | 0.0.0.0:1025 | Interface and port for SMTP server to bind to -| MH_STORAGE | -storage | memory | Set message storage: memory / mongodb - ### Contributing Clone this repository to ```$GOPATH/src/github.com/ian-kent/Go-MailHog``` and type ```make deps```.