Giter VIP home page Giter VIP logo

nginx-haconiwa's Introduction

FastContainer: Nginx with Haconiwa

This is an example of FastContainer implementation by nginx, ngx_mruby and haconiwa.

overview

Requirement

  • docker >= 18.06.0-ce
  • vagrant >= 2.1.1

Usage

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

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

SSH container starts

$ ssh [email protected] -p 8022
# => password: screencast

SMTP

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

Multitenancy

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.

multitenancy

SMTP AUTH uses ngx_mail_core_module.

Todo

  • Multitenancy
  • Auto Scaling
  • Multi Host

Author

License

This project is under the MIT License.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.