This is an example of FastContainer implementation by nginx, ngx_mruby and haconiwa.
- docker >= 18.06.0-ce
- vagrant >= 2.1.1
To create an image to use in this implementation, run GNU make and vagrant to run the VM on the Virtualbox.
# Create nginx and container images to `./provision/dist`
$ make
# Create instance, and provision by `./provision/provisioner.sh`
$ vagrant up
When the VM starts up, let's start the container with the request trigger in the following way.
HTTP container starts
$ curl http://127.0.0.1:8080/
# HTTP foo container responds
$ curl -H 'Host: foo.test' http://127.0.0.1:8080/
# HTTP bar container responds
$ curl -H 'Host: bar.test' http://127.0.0.1:8080/
SSH container starts
$ ssh root@127.0.0.1 -p 8022
# => password: screencast
SMTP container starts
$ printf "%s\0%s\0%s" foo foo password | openssl base64 -e
Zm9vAGZvbwBwYXNzd29yZA==
$ telnet 127.0.0.1 8025
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 ubuntu-xenial ESMTP ready
HELO local
250 ubuntu-xenial
AUTH PLAIN Zm9vAGZvbwBwYXNzd29yZA==
235 2.0.0 OK
# SMTP foo container responds
$ printf "%s\0%s\0%s" bar bar password | openssl base64 -e
YmFyAGJhcgBwYXNzd29yZA==
$ telnet 127.0.0.1 8025
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 ubuntu-xenial ESMTP ready
HELO local
250 ubuntu-xenial
AUTH PLAIN YmFyAGJhcgBwYXNzd29yZA==
235 2.0.0 OK
# SMTP bar container responds
HTTP determines the domain from the request host and SMTP determines the domain from SMTP AUTH. Then, upstream containers are dynamically selected from the discrimination.
SMTP AUTH uses ngx_mail_core_module.
- Multitenancy
- Auto Scaling
- Multi Host
This project is under the MIT License.