From 0068937d586582ff5dece8afdf8683aacc3c887d Mon Sep 17 00:00:00 2001 From: James Hillyerd Date: Tue, 8 Mar 2016 23:11:03 -0800 Subject: [PATCH 1/6] Add homebrew specific inbucket.conf --- etc/homebrew/inbucket.conf | 115 +++++++++++++++++++++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 etc/homebrew/inbucket.conf diff --git a/etc/homebrew/inbucket.conf b/etc/homebrew/inbucket.conf new file mode 100644 index 0000000..9b90179 --- /dev/null +++ b/etc/homebrew/inbucket.conf @@ -0,0 +1,115 @@ +# inbucket.conf +# homebrew inbucket configuration +# {{}} values will be replaced during installation + +############################################################################# +[DEFAULT] + +# Not used directly, but is typically referenced below in %()s format. +brew.pkgshare.dir={{pkgshare}} +brew.var.dir={{var}} +default.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=2500 + +# used in SMTP greeting +domain=%(default.domain)s + +# 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=1100 + +# used in POP3 greeting +domain=%(default.domain)s + +# 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=9000 + +# Name of web theme to use +theme=bootstrap + +# Path to the selected themes template files +template.dir=%(brew.pkgshare.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=%(brew.pkgshare.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=%(brew.pkgshare.dir)s/themes/greeting.html + +# Key used to sign session cookie data so that it cannot be tampered with. +# If this is left unset, Inbucket will generate a random key at startup +# and previous sessions will be invalidated. +cookie.auth.key=secret-inbucket-session-cookie-key + +############################################################################# +[datastore] + +# Path to the datastore, mail will be written into subdirectories +path=%(brew.var.dir)s/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=10080 + +# 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=100 From c421e4e0ebf2013b2cc7aa15f900ee7376cc0c74 Mon Sep 17 00:00:00 2001 From: James Hillyerd Date: Tue, 8 Mar 2016 23:30:00 -0800 Subject: [PATCH 2/6] First attempt at a homebrew formula --- etc/homebrew/inbucket.conf | 12 +-- etc/homebrew/inbucket.rb | 147 +++++++++++++++++++++++++++++++++++++ 2 files changed, 153 insertions(+), 6 deletions(-) create mode 100644 etc/homebrew/inbucket.rb diff --git a/etc/homebrew/inbucket.conf b/etc/homebrew/inbucket.conf index 9b90179..6281583 100644 --- a/etc/homebrew/inbucket.conf +++ b/etc/homebrew/inbucket.conf @@ -6,9 +6,9 @@ [DEFAULT] # Not used directly, but is typically referenced below in %()s format. -brew.pkgshare.dir={{pkgshare}} -brew.var.dir={{var}} default.domain=inbucket.local +themes.dir={{HOMEBREW_PREFIX}}/share/inbucket/themes +datastore.dir={{HOMEBREW_PREFIX}}/var/inbucket/datastore ############################################################################# [logging] @@ -76,17 +76,17 @@ ip4.port=9000 theme=bootstrap # Path to the selected themes template files -template.dir=%(brew.pkgshare.dir)s/themes/%(theme)s/templates +template.dir=%(themes.dir)s/%(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=%(brew.pkgshare.dir)s/themes/%(theme)s/public +public.dir=%(themes.dir)s/%(theme)s/public # Path to the greeting HTML displayed on front page, can be moved out of # installation dir for customization -greeting.file=%(brew.pkgshare.dir)s/themes/greeting.html +greeting.file=%(themes.dir)s/greeting.html # Key used to sign session cookie data so that it cannot be tampered with. # If this is left unset, Inbucket will generate a random key at startup @@ -97,7 +97,7 @@ cookie.auth.key=secret-inbucket-session-cookie-key [datastore] # Path to the datastore, mail will be written into subdirectories -path=%(brew.var.dir)s/inbucket +path=%(datastore.dir)s # How many minutes after receipt should a message be stored until it's # automatically purged. To retain messages until manually deleted, set this diff --git a/etc/homebrew/inbucket.rb b/etc/homebrew/inbucket.rb new file mode 100644 index 0000000..dfed876 --- /dev/null +++ b/etc/homebrew/inbucket.rb @@ -0,0 +1,147 @@ +require "language/go" + +class Inbucket < Formula + desc "Disposable webmail service with built in SMTP, POP3, REST servers" + homepage "http://www.inbucket.org/" + url "https://github.com/jhillyerd/inbucket.git", :tag => "1.1.0-rc3" + + head "https://github.com/jhillyerd/inbucket.git", :branch => "develop" + + devel do + url "https://github.com/jhillyerd/inbucket.git", :branch => "master" + version "1.1.1-alpha" + end + + def log_path + var/"log/inbucket.log" + end + + depends_on "go" => :build + + go_resource "github.com/goods/httpbuf" do + url "https://github.com/goods/httpbuf.git", + :revision => "5709e9bb814c932e48b6737e1cf214a6522453a2" + end + + go_resource "github.com/gorilla/context" do + url "https://github.com/gorilla/context.git", + :revision => "1ea25387ff6f684839d82767c1733ff4d4d15d0a" + end + + go_resource "github.com/gorilla/mux" do + url "https://github.com/gorilla/mux.git", + :revision => "acf3be1b335c8ce30b2c8d51300984666f0ceefa" + end + + go_resource "github.com/gorilla/securecookie" do + url "https://github.com/gorilla/securecookie.git", + :revision => "8dacca26977607e637262eb66b15b7d39f2d3009" + end + + go_resource "github.com/gorilla/sessions" do + url "https://github.com/gorilla/sessions.git", + :revision => "8cd570d8b4ed84b18bca9d8c3ae2db55885ccd8b" + end + + go_resource "github.com/jaytaylor/html2text" do + url "https://github.com/jaytaylor/html2text.git", + :revision => "4936b6c2ae7f89f5eeba2473c31fd27ea8f11068" + end + + go_resource "github.com/jhillyerd/go.enmime" do + url "https://github.com/jhillyerd/go.enmime.git", + :revision => "3ea281bf3e00864f4afe2f9a6911af164438b581" + end + + go_resource "github.com/robfig/config" do + url "https://github.com/robfig/config.git", + :revision => "0f78529c8c7e3e9a25f15876532ecbc07c7d99e6" + end + + go_resource "golang.org/x/net" do + url "https://go.googlesource.com/net.git", + :revision => "3e5cd1ed149001198e582f9d3f5bfd564cde2896" + end + + go_resource "golang.org/x/sys" do + url "https://go.googlesource.com/sys.git", + :revision => "7a56174f0086b32866ebd746a794417edbc678a1" + end + + go_resource "golang.org/x/text" do + url "https://go.googlesource.com/text.git", + :revision => "a71fd10341b064c10f4a81ceac72bcf70f26ea34" + end + + def install + package = "github.com/jhillyerd/inbucket" + contents = Dir["{*,.git,.gitignore}"] + gopath = buildpath/"gopath" + (gopath/"src/#{package}").install contents + + ENV["GOPATH"] = gopath + ENV.prepend_create_path "PATH", gopath/"bin" + + Language::Go.stage_deps resources, gopath/"src" + + cd gopath/"src/#{package}" do + system "go", "build" + bin.install "inbucket" + pkgshare.install "themes" + inreplace "etc/homebrew/inbucket.conf" do |s| + # We want the config to use non-versioned paths + s.gsub!(/{{HOMEBREW_PREFIX}}/, HOMEBREW_PREFIX) + end + etc.install "etc/homebrew/inbucket.conf" + end + end + + def caveats; <<-EOS.undent + By default, inbucket listens on the following TCP ports: + 0.0.0.0:2500 - SMTP + 0.0.0.0:1100 - POP3 + 0.0.0.0:9000 - HTTP + + You may change these ports by editing #{etc}/inbucket.conf + + Once inbucket has started, access its web interface at: + http://localhost:9000/ + EOS + end + + test do + system "#{bin}/inbucket", "-help" + end + + plist_options :startup => "true" + + def plist; <<-EOS.undent + + + + + Label + #{plist_name} + RunAtLoad + + KeepAlive + + WorkingDirectory + #{HOMEBREW_PREFIX} + ProgramArguments + + #{opt_bin}/inbucket + #{etc}/inbucket.conf + + StandardErrorPath + #{log_path} + EnvironmentVariables + + LANG + en_US.UTF-8 + + + + EOS + end +end From 982109597797c5257c6dfce2021600e97467600b Mon Sep 17 00:00:00 2001 From: James Hillyerd Date: Mon, 21 Mar 2016 19:59:20 -0700 Subject: [PATCH 3/6] Move homebrew to its own tap repository. --- CHANGELOG.md | 6 ++ README.md | 8 +++ etc/homebrew/inbucket.rb | 147 --------------------------------------- 3 files changed, 14 insertions(+), 147 deletions(-) delete mode 100644 etc/homebrew/inbucket.rb diff --git a/CHANGELOG.md b/CHANGELOG.md index 661c6e3..6c18900 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ Change Log All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). +[Unreleased] +------------ + +### Added +- Homebrew inbucket.conf and formula (see README) + [1.1.0-rc2] - 2016-03-06 ------------------------ diff --git a/README.md b/README.md index 708b388..32e3110 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,12 @@ Inbucket is currently production quality: it is being used for real work. Please see the [Change Log] and [Issues List] for more details. +Homebrew Tap +------------ + +Inbucket has an OS X [Homebrew] tap available as [jhillyerd/inbucket][Homebrew Tap], +see the `README.md` there for installation instructions. + Building from Source -------------------- @@ -47,5 +53,7 @@ version can be found at https://github.com/jhillyerd/inbucket [Change Log]: https://github.com/jhillyerd/inbucket/blob/master/CHANGELOG.md [From Source]: http://www.inbucket.org/installation/from-source.html [Google Go]: http://golang.org/ +[Homebrew]: http://brew.sh/ +[Homebrew Tap]: https://github.com/jhillyerd/homebrew-inbucket [Inbucket Website]: http://www.inbucket.org/ [Issues List]: https://github.com/jhillyerd/inbucket/issues?state=open diff --git a/etc/homebrew/inbucket.rb b/etc/homebrew/inbucket.rb deleted file mode 100644 index dfed876..0000000 --- a/etc/homebrew/inbucket.rb +++ /dev/null @@ -1,147 +0,0 @@ -require "language/go" - -class Inbucket < Formula - desc "Disposable webmail service with built in SMTP, POP3, REST servers" - homepage "http://www.inbucket.org/" - url "https://github.com/jhillyerd/inbucket.git", :tag => "1.1.0-rc3" - - head "https://github.com/jhillyerd/inbucket.git", :branch => "develop" - - devel do - url "https://github.com/jhillyerd/inbucket.git", :branch => "master" - version "1.1.1-alpha" - end - - def log_path - var/"log/inbucket.log" - end - - depends_on "go" => :build - - go_resource "github.com/goods/httpbuf" do - url "https://github.com/goods/httpbuf.git", - :revision => "5709e9bb814c932e48b6737e1cf214a6522453a2" - end - - go_resource "github.com/gorilla/context" do - url "https://github.com/gorilla/context.git", - :revision => "1ea25387ff6f684839d82767c1733ff4d4d15d0a" - end - - go_resource "github.com/gorilla/mux" do - url "https://github.com/gorilla/mux.git", - :revision => "acf3be1b335c8ce30b2c8d51300984666f0ceefa" - end - - go_resource "github.com/gorilla/securecookie" do - url "https://github.com/gorilla/securecookie.git", - :revision => "8dacca26977607e637262eb66b15b7d39f2d3009" - end - - go_resource "github.com/gorilla/sessions" do - url "https://github.com/gorilla/sessions.git", - :revision => "8cd570d8b4ed84b18bca9d8c3ae2db55885ccd8b" - end - - go_resource "github.com/jaytaylor/html2text" do - url "https://github.com/jaytaylor/html2text.git", - :revision => "4936b6c2ae7f89f5eeba2473c31fd27ea8f11068" - end - - go_resource "github.com/jhillyerd/go.enmime" do - url "https://github.com/jhillyerd/go.enmime.git", - :revision => "3ea281bf3e00864f4afe2f9a6911af164438b581" - end - - go_resource "github.com/robfig/config" do - url "https://github.com/robfig/config.git", - :revision => "0f78529c8c7e3e9a25f15876532ecbc07c7d99e6" - end - - go_resource "golang.org/x/net" do - url "https://go.googlesource.com/net.git", - :revision => "3e5cd1ed149001198e582f9d3f5bfd564cde2896" - end - - go_resource "golang.org/x/sys" do - url "https://go.googlesource.com/sys.git", - :revision => "7a56174f0086b32866ebd746a794417edbc678a1" - end - - go_resource "golang.org/x/text" do - url "https://go.googlesource.com/text.git", - :revision => "a71fd10341b064c10f4a81ceac72bcf70f26ea34" - end - - def install - package = "github.com/jhillyerd/inbucket" - contents = Dir["{*,.git,.gitignore}"] - gopath = buildpath/"gopath" - (gopath/"src/#{package}").install contents - - ENV["GOPATH"] = gopath - ENV.prepend_create_path "PATH", gopath/"bin" - - Language::Go.stage_deps resources, gopath/"src" - - cd gopath/"src/#{package}" do - system "go", "build" - bin.install "inbucket" - pkgshare.install "themes" - inreplace "etc/homebrew/inbucket.conf" do |s| - # We want the config to use non-versioned paths - s.gsub!(/{{HOMEBREW_PREFIX}}/, HOMEBREW_PREFIX) - end - etc.install "etc/homebrew/inbucket.conf" - end - end - - def caveats; <<-EOS.undent - By default, inbucket listens on the following TCP ports: - 0.0.0.0:2500 - SMTP - 0.0.0.0:1100 - POP3 - 0.0.0.0:9000 - HTTP - - You may change these ports by editing #{etc}/inbucket.conf - - Once inbucket has started, access its web interface at: - http://localhost:9000/ - EOS - end - - test do - system "#{bin}/inbucket", "-help" - end - - plist_options :startup => "true" - - def plist; <<-EOS.undent - - - - - Label - #{plist_name} - RunAtLoad - - KeepAlive - - WorkingDirectory - #{HOMEBREW_PREFIX} - ProgramArguments - - #{opt_bin}/inbucket - #{etc}/inbucket.conf - - StandardErrorPath - #{log_path} - EnvironmentVariables - - LANG - en_US.UTF-8 - - - - EOS - end -end From 7adf3741d300bf77287f9aaa490f4aab893b785b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Wojtun=CC=81?= Date: Wed, 27 Apr 2016 17:54:17 +0200 Subject: [PATCH 4/6] #35 Log error and continue when deleting oldest message fails. --- smtpd/filestore.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/smtpd/filestore.go b/smtpd/filestore.go index 6b6862b..81d9bfd 100644 --- a/smtpd/filestore.go +++ b/smtpd/filestore.go @@ -318,7 +318,7 @@ func (mb *FileMailbox) NewMessage() (Message, error) { for len(mb.messages) >= mb.store.messageCap { log.Infof("Mailbox %q over configured message cap", mb.name) if err := mb.messages[0].Delete(); err != nil { - return nil, err + log.Errorf("Error deleting message: %s", err) } } } From ebde99949e94ceb000a5001b32c403463265e77c Mon Sep 17 00:00:00 2001 From: James Hillyerd Date: Sat, 3 Sep 2016 10:25:44 -0700 Subject: [PATCH 5/6] Update travis build to current Go versions --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index d8af05b..d750ab3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,5 +5,5 @@ before_script: - go vet ./... go: - - 1.5.3 - - 1.6 + - 1.6.3 + - 1.7 From 6d2c2c8dad40d6edba03c4b6793969825021a659 Mon Sep 17 00:00:00 2001 From: James Hillyerd Date: Sat, 3 Sep 2016 11:18:37 -0700 Subject: [PATCH 6/6] Prep for 1.1.0 --- .goxc.json | 1 - CHANGELOG.md | 25 +++++++++++++++++++++++-- inbucket.go | 2 +- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/.goxc.json b/.goxc.json index 2234672..bd8e441 100644 --- a/.goxc.json +++ b/.goxc.json @@ -7,7 +7,6 @@ "Os": "darwin freebsd linux windows", "ResourcesInclude": "README*,LICENSE*,CHANGELOG*,inbucket.bat,etc,themes", "PackageVersion": "1.1.0", - "PrereleaseInfo": "rc2", "ConfigVersion": "0.9", "BuildSettings": { "LdFlagsXVars": { diff --git a/CHANGELOG.md b/CHANGELOG.md index 6c18900..66c454c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,12 +4,15 @@ Change Log All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). -[Unreleased] +[1.1.0] - 2016-09-03 ------------ ### Added - Homebrew inbucket.conf and formula (see README) +### Fixed +- Log and continue when unable to delete oldest message during cap enforcement + [1.1.0-rc2] - 2016-03-06 ------------------------ @@ -46,8 +49,26 @@ This project adheres to [Semantic Versioning](http://semver.org/). specific message. [Unreleased]: https://github.com/jhillyerd/inbucket/compare/master...develop +[1.1.0]: https://github.com/jhillyerd/inbucket/compare/1.1.0-rc2...1.1.0 [1.1.0-rc2]: https://github.com/jhillyerd/inbucket/compare/1.1.0-rc1...1.1.0-rc2 [1.1.0-rc1]: https://github.com/jhillyerd/inbucket/compare/1.0...1.1.0-rc1 [1.0]: https://github.com/jhillyerd/inbucket/compare/1.0-rc1...1.0 -See http://keepachangelog.com/ for instructions on how to update this file. + +Release Checklist +----------------- + +1. Create release branch: `git flow release start 1.x.0` +2. Update CHANGELOG.md: + - Ensure *Unreleased* section is up to date + - Rename *Unreleased* section to release name and date. + - Add new GitHub `/compare` link +3. Update goxc version info: `goxc -wc -pv=1.x.0 -pr=snapshot` +4. Run: `goxc interpolate-source` to update VERSION var +5. Run tests +6. Test cross-compile: `goxc` +7. Commit changes and merge release: `git flow release finish 1.x.0` +8. Upload to bintray: `goxc bintray` +9. Update `binary_versions` option in `inbucket-site/_config.yml` + +See http://keepachangelog.com/ for additional instructions on how to update this file. diff --git a/inbucket.go b/inbucket.go index 30b53a4..5c0cd86 100644 --- a/inbucket.go +++ b/inbucket.go @@ -21,7 +21,7 @@ import ( var ( // VERSION contains the build version number, populated during linking by goxc - VERSION = "1.1.0-rc2" + VERSION = "1.1.0" // BUILDDATE contains the build date, populated during linking by goxc BUILDDATE = "undefined"