2014-12-17 19:54:29 +00:00
|
|
|
Deploying MailHog
|
|
|
|
=================
|
|
|
|
|
|
|
|
### Command line
|
|
|
|
|
|
|
|
You can run MailHog locally from the command line.
|
|
|
|
|
2014-12-24 17:57:47 +00:00
|
|
|
go get github.com/mailhog/MailHog
|
|
|
|
MailHog -h
|
2014-12-17 19:54:29 +00:00
|
|
|
|
|
|
|
To configure MailHog, use the environment variables or command line flags
|
2017-03-14 11:12:08 +00:00
|
|
|
described in the [CONFIG](CONFIG.md).
|
2014-12-17 19:54:29 +00:00
|
|
|
|
|
|
|
### Using supervisord/upstart/etc
|
|
|
|
|
|
|
|
MailHog can be started as a daemon using supervisord/upstart/etc.
|
|
|
|
|
2016-04-26 14:51:04 +00:00
|
|
|
See [this example init script](https://github.com/geerlingguy/ansible-role-mailhog/blob/master/templates/mailhog.init.j2)
|
2014-12-17 19:54:29 +00:00
|
|
|
and [this Ansible role](https://github.com/geerlingguy/ansible-role-mailhog) by [geerlingguy](https://github.com/geerlingguy).
|
|
|
|
|
2016-04-28 15:30:56 +00:00
|
|
|
If installed with Homebrew on OSX you can have launchd start mailhog now and restart at login:
|
|
|
|
brew services start mailhog
|
|
|
|
|
2014-12-17 19:54:29 +00:00
|
|
|
### Docker
|
|
|
|
|
2018-03-20 13:36:12 +00:00
|
|
|
The example [Dockerfile](../Dockerfile) can be used to run MailHog in a [Docker](https://www.docker.com/) container.
|
2014-12-17 19:54:29 +00:00
|
|
|
|
2014-12-31 17:43:52 +00:00
|
|
|
You can run it directly from Docker Hub (thanks [humboldtux](https://github.com/humboldtux))
|
2014-12-31 12:52:23 +00:00
|
|
|
|
2014-12-31 17:43:52 +00:00
|
|
|
docker run -d -p 1025:1025 -p 8025:8025 mailhog/mailhog
|
2014-12-31 12:52:23 +00:00
|
|
|
|
2017-06-21 11:14:40 +00:00
|
|
|
To mount the Maildir to the local filesystem, you can use a volume:
|
|
|
|
|
|
|
|
docker run -d -e "MH_STORAGE=maildir" -v $PWD/maildir:/maildir -p 1025:1025 -p 8025:8025 mailhog/mailhog
|
|
|
|
|
2014-12-17 19:54:29 +00:00
|
|
|
### Elastic Beanstalk
|
|
|
|
|
2014-12-24 17:57:47 +00:00
|
|
|
You can deploy MailHog using [AWS Elastic Beanstalk](http://aws.amazon.com/elasticbeanstalk/).
|
2014-12-17 19:54:29 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2014-12-31 12:52:23 +00:00
|
|
|
**Note** You'll need to reconfigure nginx in Elastic Beanstalk to expose both
|
|
|
|
ports as TCP, since by default it proxies the first exposed port to port 80 as HTTP.
|
|
|
|
|
2014-12-17 19:54:29 +00:00
|
|
|
If you're using in-memory storage, you can only use a single instance of
|
2014-12-24 17:57:47 +00:00
|
|
|
MailHog. To use a load balanced EB application, use MongoDB backed storage.
|
2014-12-17 19:54:29 +00:00
|
|
|
|
|
|
|
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
|
2014-12-24 17:57:47 +00:00
|
|
|
|
|
|
|
You may face restrictions on outbound SMTP from EC2, for example if you are
|
|
|
|
releasing messages to real SMTP servers.
|
2018-11-23 23:17:13 +00:00
|
|
|
|
|
|
|
### SaltStack
|
|
|
|
|
|
|
|
For deploying MailHog using [SaltStack](https://github.com/saltstack/salt), there's a
|
|
|
|
[SaltStack Formula](https://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html)
|
|
|
|
available in [github.com/ssc-services/salt-formulas-public](https://github.com/ssc-services/salt-formulas-public/tree/master/mailhog).
|