1
0
mirror of https://github.com/jhillyerd/inbucket.git synced 2025-12-17 09:37:02 +00:00

More Docker work

- Dockerfile now builds Inbucket inside the container
- Add starter inbucket.conf for Docker
- Add install.sh to build inbucket inside container
- Add customized greeting.html for Docker
This commit is contained in:
James Hillyerd
2014-05-25 16:10:05 -07:00
parent cb487c3c7b
commit bb398498d4
5 changed files with 178 additions and 16 deletions

15
etc/docker/greeting.html Normal file
View File

@@ -0,0 +1,15 @@
<p>Inbucket is an email testing service; it will accept email for any email
address and make it available to view without a password.</p>
<p>To view email for a particular address, enter the username portion
of the address into the box on the upper right and click <em>go</em>.</p>
<p>This instance of Inbucket is running inside of a <a
href="https://www.docker.io/" target="_blank">Docker</a> container. It is
configured to retain messages for a maximum of 3 days, and will enforce a limit
of 300 messages per mailbox - the oldest messages will be deleted to stay under
the limit.</p>
<p>Messages addressed to any recipient in the <code>@bitbucket.local</code>
domain will be accepted but not written to disk. Use this domain for load or
soak testing your application.</p>

110
etc/docker/inbucket.conf Normal file
View File

@@ -0,0 +1,110 @@
# inbucket.conf
# Configuration for Inbucket inside of Docker
#
# These should be reasonable defaults for a production install of Inbucket
#############################################################################
[DEFAULT]
# Not used directly, but is typically referenced below in %()s format.
install.dir=/opt/inbucket
domain=inbucket.local
#############################################################################
[logging]
# Options from least to most verbose: ERROR, WARN, INFO, TRACE
level=INFO
#############################################################################
[smtp]
# IPv4 address to listen for SMTP connections on.
ip4.address=0.0.0.0
# IPv4 port to listen for SMTP connections on.
ip4.port=10025
# used in SMTP greeting
domain=inbucket.local
# optional: mail sent to accounts at this domain will not be stored,
# for mixed use (content and load testing)
domain.nostore=bitbucket.local
# Maximum number of RCPT TO: addresses we allow from clients, the SMTP
# RFC recommends this be at least 100.
max.recipients=100
# How long we allow a network connection to be idle before hanging up on the
# client, SMTP RFC recommends at least 5 minutes (300 seconds).
max.idle.seconds=300
# Maximum allowable size of message body in bytes (including attachments)
max.message.bytes=2048000
# Should we place messages into the datastore, or just throw them away
# (for load testing): true or false
store.messages=true
#############################################################################
[pop3]
# IPv4 address to listen for POP3 connections on.
ip4.address=0.0.0.0
# IPv4 port to listen for POP3 connections on.
ip4.port=10110
# used in POP3 greeting
domain=%(domain)
# How long we allow a network connection to be idle before hanging up on the
# client, POP3 RFC requires at least 10 minutes (600 seconds).
max.idle.seconds=600
#############################################################################
[web]
# IPv4 address to serve HTTP web interface on
ip4.address=0.0.0.0
# IPv4 port to serve HTTP web interface on
ip4.port=10080
# Name of web theme to use
theme=integral
# Path to the selected themes template files
template.dir=%(install.dir)s/themes/%(theme)s/templates
# Should we cache parsed templates (set to false during theme dev)
template.cache=true
# Path to the selected themes public (static) files
public.dir=%(install.dir)s/themes/%(theme)s/public
# Path to the greeting HTML displayed on front page, can
# be moved out of installation dir for customization
greeting.file=/etc/opt/inbucket-greeting.html
#############################################################################
[datastore]
# Path to the datastore, mail will be written into subdirectories
path=/var/opt/inbucket
# How many minutes after receipt should a message be stored until it's
# automatically purged. To retain messages until manually deleted, set this
# to 0
retention.minutes=4320
# How many milliseconds to sleep after purging messages from a mailbox.
# This should help reduce disk I/O when there are a large number of messages
# to purge.
retention.sleep.millis=100
# Maximum number of messages we will store in a single mailbox. If this
# number is exceeded, the oldest message in the box will be deleted each
# time a new message is received for it.
mailbox.message.cap=300

33
etc/docker/install.sh Executable file
View File

@@ -0,0 +1,33 @@
#!/bin/sh
# install.sh
# description: Build, test, and install Inbucket. Should be executed inside a Docker container.
# Note: we assume there are no spaces in dir paths
installdir=${INBUCKET_HOME}
srcdir=${INBUCKET_SRC}
bindir=$installdir/bin
# Setup
export GOBIN=$bindir
builddate="$(date --iso-8601=seconds)"
set -e
cd $srcdir
go clean
# Build
echo "### Fetching Dependencies"
go get -d -v ./...
go get -v github.com/stretchr/testify
echo "### Testing Inbucket"
go test ./...
echo "### Building Inbucket"
mkdir -p $bindir
go build -o inbucket -race -ldflags "-X main.BUILD_DATE '$builddate'" -v .
echo "### Installing Inbucket"
mv inbucket $bindir
install etc/docker/inbucket.conf /etc/opt/inbucket.conf
install etc/docker/greeting.html /etc/opt/inbucket-greeting.html
cp -r themes $installdir/