GithubHelp home page GithubHelp logo

mars / tinyrobot-science-mesh-web-ui Goto Github PK

View Code? Open in Web Editor NEW
1.0 3.0 0.0 108 KB

๐Ÿšง๐Ÿ”ฌ experiment using Kong service mesh in a Heroku app

License: MIT License

Shell 2.43% JavaScript 97.57%

tinyrobot-science-mesh-web-ui's Introduction

๐Ÿšง๐Ÿ”ฌ tinyrobot.science "Kong 1.0 Mesh" experiment

Based on this microservices example app.

Let's discover how Kong's new sidecar deployment style integrates with Heroku.

Results

Kong's actual mesh networking (service-to-service, mutual TLS) features are facilitated by changing iptables configuration on the hosts, which is not possible on Heroku.

Even without the true mesh networking, deploying Kong sidecar-style does still provide some benefits:

  • less latency than a separate Kong proxy app (the proxy-backend connection is on localhost)
  • Kong cluster inherently scales with the app's dyno scaling

Open questions

Can a single Kong controller operate many apps worth of Kong sidecars?

  • Do backend PORT values conflict?
  • Does the KONG_ORIGINS config solve this? (Setting hostnames into config vars is gross ๐Ÿ˜ฃ)

Deployment

First, deploy a Kong app as the mesh controller.

Then, deploy this app:

heroku create tinyrobot-science-mesh-web-ui
heroku buildpacks:add heroku/nodejs
heroku buildpacks:add heroku-community/kong
heroku buildpacks:add https://github.com/danp/heroku-buildpack-runit

# Attach the ID of the mesh controller's Postgres add-on.
heroku addons:attach postgresql-cylindrical-98791

git push heroku master

Then, create the mesh service & route:

(Note: port 5000 is the local listener set in bin/start-app)

## Create mesh service
curl -X "PUT" "https://tinyrobot-science-mesh-control.herokuapp.com/kong-admin/services/web-ui" \
     -H 'apikey: xxxxx' \
     -H 'Content-Type: application/json; charset=utf-8' \
     -d $'{
  "url": "http://127.0.0.1:5000"
}'

## Create mesh route
curl -X "POST" "https://tinyrobot-science-mesh-control.herokuapp.com/kong-admin/services/web-ui/routes" \
     -H 'apikey: xxxxx' \
     -H 'Content-Type: application/json; charset=utf-8' \
     -d $'{
  "name": "web-ui",
  "hosts": [
    "tinyrobot-science-mesh-web-ui.herokuapp.com"
  ],
  "protocols": [
    "https"
  ]
}'

## Add the current app name as the origin for the web-ui services
heroku config:set KONG_ORIGINS=https://tinyrobot-science-mesh-web-ui.herokuapp.com:443=http://localhost:5000

โœจ Visit the app's URL https://tinyrobot-science-mesh-web-ui.herokuapp.com/ in a web browser.

tinyrobot-science-mesh-web-ui's People

Contributors

mars avatar greenkeeper[bot] avatar joejknowles avatar

Stargazers

Ayeshmantha Perera avatar

Watchers

 avatar James Cloos avatar  avatar

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.