2016-06-16 19:32:12 -07:00
2015-07-22 00:01:54 -07:00
2016-06-16 19:32:12 -07:00
2016-06-16 19:32:12 -07:00
2013-04-02 16:50:35 -07:00
2015-10-09 18:22:32 -07:00
2015-10-20 14:02:28 -07:00
2016-06-16 19:32:12 -07:00
2016-06-16 19:32:12 -07:00
2016-06-16 19:32:12 -07:00
2015-10-20 14:02:28 -07:00
2016-06-16 19:32:12 -07:00
2015-10-20 14:02:28 -07:00
2016-06-16 19:32:12 -07:00

MicroServices Gateway / API Gateway

First things first, register an app:

curl -H "Content-Type: application/json" -X POST -d '{"name":"myapp","password":"xyz"}' http://localhost:8080/test/1/projects/123/apps

Now add routes to the app. First we'll add a route to the output of a docker container:

curl -H "Content-Type: application/json" -X POST -d '{"path":"/hello.rb","image":"treeder/hello.rb", "type":"run"}' http://localhost:8080/test/1/projects/123/apps/myapp/routes

curl -H "Content-Type: application/json" -X POST -d '{"path":"/helloiron","image":"iron/hello", "type":"run"}' http://localhost:8080/test/1/projects/123/apps/myapp/routes

Test out the route:

curl -i -X GET http://localhost:8080/hello.rb?app=myapp

Now try mapping an app endpoint:

curl -H "Content-Type: application/json" -X POST -d '{"path":"/sinatra","image":"treeder/hello-sinatra", "type":"app", "cpath":"/"}' http://localhost:8080/test/1/projects/123/apps/myapp/routes

And test it out:

curl -i -X GET http://localhost:8080/sinatra?app=myapp

And another:

curl -H "Content-Type: application/json" -X POST -d '{"path":"/sinatra/ping","image":"treeder/hello-sinatra", "type":"app", "cpath":"/ping"}' http://localhost:8080/test/1/projects/123/apps/myapp/routes

And test it out:

curl -i -X GET http://localhost:8080/sinatra?app=myapp

You'all also get a custom URL like this when in production.

appname.projectid.iron.computer

Building/Testing

Build:

# one time:
glide install
# then every time
./build.sh

Test it, the iron token and project id are for cache.

docker run -e "IRON_TOKEN=GP8cqlKSrcpmqeR8x9WKD4qSAss" -e "IRON_PROJECT_ID=4fd2729368a0197d1102056b" --rm -it --privileged -p 8080:8080 iron/gateway

Push it:

docker push iron/gateway

Get it on a server and point router.iron.computer (on cloudflare) to the machine.

After deploying, running it with:

docker run -e "IRON_TOKEN=GP8cqlKSrcpmqeR8x9WKD4qSAss" -e "IRON_PROJECT_ID=4fd2729368a0197d1102056b" --name irongateway -it --privileged --net=host -p 8080:8080 -d --name irongateway iron/gateway
Description
The container native, cloud agnostic serverless platform.
Readme Apache-2.0 170 MiB
Languages
Go 97.4%
Shell 1.2%
Ruby 0.5%
Makefile 0.4%
Dockerfile 0.4%
Other 0.1%