You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This command starts an API Gateway that automatically discovers the services running in Marathon.
16
+
The discovered services are exposed on individual VHosts as you can see in the [config file](https://github.com/adobe-apiplatform/apigateway/blob/master/api-gateway-config/conf.d/marathon_apis.conf#L36).
17
+
18
+
#### Accessing a Marathon app
19
+
20
+
For example, if you have an application named `hello-world` you can access it on its VHost in 2 ways:
21
+
1. Edit `/etc/hosts` and add `<docker_host_ip> hello-world.api.localhost` then browse to `http://hello-world.api.localhost`
22
+
2. Sending the Host header in a curl command: `curl -H "Host:hello-world.api.localhost" http://<docker_host_ip>`
23
+
24
+
The [discovery script](https://github.com/adobe-apiplatform/apigateway/blob/master/api-gateway-config/marathon-service-discovery.sh) is provided as an example for a quick-start and it can be replaced with your favourite discovery mechanism.
25
+
The script updates a [configuration file](https://github.com/adobe-apiplatform/apigateway/blob/master/api-gateway-config/environment.conf.d/api-gateway-upstreams.http.conf) containing all the NGINX upstreams that are used in the [config file](https://github.com/adobe-apiplatform/apigateway/blob/master/api-gateway-config/conf.d/marathon_apis.conf#L36).
26
+
27
+
#### Resolvers
28
+
While starting up this container automatically creates the `/etc/api-gateway/conf.d/includes/resolvers.conf` config file using `/etc/resolv.conf` as the source.
29
+
To learn more about the `resolver` directive in NGINX see the [docs](http://nginx.org/en/docs/http/ngx_http_core_module.html#resolver).
30
+
31
+
#### Running the API Gateway outside of Marathon and Mesos
32
+
Besides the discovery part which is dependent on Marathon at the moment, the API Gateway can run on its own as well. The Marathon service discovery is activated with the ` -e "MARATHON_HOST=http://<marathon_host>:<port>/"`.
5
33
6
34
### Developer guide
7
35
@@ -19,25 +47,25 @@ A performant API Gateway based on Openresty and Nginx.
19
47
```
20
48
make docker-run
21
49
```
22
-
The main API Gateway process is exposed to port 8080. To test that the Gateway works see its `health-check`:
50
+
The main API Gateway process is exposed to port `80`. To test that the Gateway works see its `health-check`:
23
51
```
24
-
$ curl http://<docker_host_ip>:8080/health-check
52
+
$ curl http://<docker_host_ip>/health-check
25
53
API-Platform is running!
26
54
```
27
55
If you're up for a quick performance test, you can play with Apache Benchmark via Docker:
28
56
29
57
```
30
-
docker run jordi/ab ab -k -n 200000 -c 500 http://<docker_host_ip>:8080/health-check
58
+
docker run jordi/ab ab -k -n 200000 -c 500 http://<docker_host_ip>/health-check
31
59
```
32
60
33
61
To run docker mounting the local `api-gateway-config` directory into `/etc/api-gateway/` issue:
34
62
35
63
```bash
36
64
$ make docker-debug
37
65
```
38
-
In debug mode docker container starts with `-e "LOG_LEVEL=debug"` which will give you a little more debugging information.
39
-
40
-
To enable the full debug logging in nginx ( using a build configured `--with-debug` ) there will be a separate container.
66
+
In debug mode the docker container starts a special `api-gateway` compiled `--with-debug` providing very detailed debugging information.
67
+
When started with `-e "LOG_LEVEL=info"` the output is quite verbose.
68
+
To learn more about this option visit [NGINX docs](http://nginx.org/en/docs/debugging_log.html).
41
69
42
70
When done stop the image:
43
71
```
@@ -61,7 +89,7 @@ For optimal performance leave the `network` on `HOST` mode. To learn more about
61
89
"container": {
62
90
"type":"DOCKER",
63
91
"docker": {
64
-
"image":"apiplatform/apigateway:latest",
92
+
"image":"adobeapiplatform/apigateway:latest",
65
93
"forcePullImage":true,
66
94
"network":"HOST"
67
95
}
@@ -71,16 +99,8 @@ For optimal performance leave the `network` on `HOST` mode. To learn more about
Copy file name to clipboardexpand all lines: api-gateway-config/conf.d/marathon_apis.conf
+1-1
Original file line number
Diff line number
Diff line change
@@ -33,7 +33,7 @@ server {
33
33
# listen 8080;
34
34
35
35
# listenes on <marathon_app_name>.api.any.domain with the assumption that the marathon_app_name has been defined in marathon. TBD what to do when the app is not found
0 commit comments