Check it out here: https://burner.kiwi
Burner.kiwi is designed to be able to run on both AWS Lambda and normal machines. The goal is to have several backing database implementations and flexible configuration.
At this point it's working on normal machines and in Lambda. There is one production-ready database implementation - DynamoDB and a dev/testing implementation - InMemory.
This is definitely still a work in progress, see the To Do section.
Deploy Your Own!
You will need to:
- Buy at least one domain
- Sign up for a Mailgun account
- Add your new domain(s) to your Mailgun account
- Ensure you can receive email through Mailgun on that domain
Deploy your own straight to AWS Lambda and DynamoDB.
Deploy to ap-southeast-2 (Sydney):
Deploy to us-east-1 (N. Virginia):
Deploy to eu-west-1 (Ireland):
If you want to deploy to another AWS region you will modify the provided cloudformation.json template and upload your code to a bucket in that region.
Or run it on your own server. Build a binary, set up with the configuration parameters detailed below and run it.
To build for development just run
go build - nothing special here.
Building for production is a different beast. We need to give assets cache friendly names, minify them and add their
new names to the binary. Check out the included
To build run
./build.sh from the root of the project. This will create and populate a
containing the binary file and minified/renamed static assets.
These are all set as environment variables.
|LAMBDA||Boolean||Whether or not the binary is being hosted on AWS Lambda|
|KEY||String||Key used to sign cookies and keys. Make this something strong!|
|WEBSITE_URL||String||The url where the binary is being hosted. This must be internet reachable as it is the destination for Mailgun routes|
|STATIC_URL||String||The url where static content is being hosted. Set to
|DOMAINS||String||Comma separated list of domains connected to Mailgun account and able to receive email|
|MG_KEY||String||Mailgun private API key|
|MG_DOMAIN||String||One of the domains set up on your Mailgun account|
If you are using DynamoDB a non AWS environment you need to set these. If you are on AWS you should, of course, should use IAM roles.
|AWS_ACCESS_KEY_ID||String||Your AWS access key ID corresponding to an IAM role with permission to use DynamoDB|
|AWS_SECRET_ACCESS_KEY||String||AWS secret access key corresponding to your access key ID|
|AWS_REGION||String||The AWS region containing the DynamoDB table. Use the appropriate value from the Region column here.|
Deleting Old Routes
Burner.kiwi creates a new Mailgun route for every inbox and email address. This allows us to delete these routes once the inbox expires and prevents the server being unnecessarily burdened by webhooks for inboxes that don't exist anymore.
Old routes are deleted in the background every time the binary is started. In a Lambda context this means every time we have a cold start, the CloudFormation template sets up a CloudWatch event to call the handler every 6 hours. However, because of the fact that burner.kiwi is designed to be platform agnostic we can't differentiate between these CloudWatch events and normal http requests. This means if the CloudWatch event hits a frozen container rather than causing a new container to be spawned, we wont trigger the deletion of old routes. Hopefully, a normal http request or CloudWatch event will cause a new container to be spawned often enough that old routes are cleared out.
If you are deployed on a normal machine you can explicitly cause deletion of old routes without starting the http server.
You can set up a cron to run the binary every 6 hours, like so:
burnerkiwi -delete-old-routes. You will need to ensure
the binary can still access the environment variables.
If you notice any issues or have anything to add, I would be more than happy to work with you. Create an issue and outline your plans or bugs.
- More tests for server package
- More database implementations (PSQL, SQLite, etc)
- Night theme
- Print html errors rather than just plain text
- Better configuration
- Noob friendly setup tutorial
Again, if you think you can help, then create an issue and outline your plans.
Copyright 2018 Hayden Woodhead
Licensed under the MIT License.
The Roger logo is drawn by Melissa Bather, used with permission, and licensed under Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0).