We would like to run two microgateway services on the same machine.
# 1 a token endpoint
# 2 an oauth collection of protected services
If possible, how should the <org>-<dev>-config.yaml configurations be set up?
Thanks,
Michael
Solved! Go to Solution.
See here: http://docs.apigee.com/microgateway/latest/operation-and-configuration-reference-edge-microgateway
For example: MG 1 would have
edgemicro: port: 8000 max_connections: 1000 max_connections_hard: 5000 max_times: 300 config_change_poll_interval: 600 proxies: - edgemicro_auth logging: level: error dir: /var/tmp stats_log_interval: 60 rotate_interval: 24 plugins: sequence: headers: x-forwarded-for: true x-forwarded-host: true
The second MG can have:
edgemicro: port: 8001 max_connections: 1000 max_connections_hard: 5000 max_times: 300 config_change_poll_interval: 600 proxies: - edgemicro_proxy1 - edgemicro_proxy2 - edgemicro_proxy3 logging: level: error dir: /var/tmp stats_log_interval: 60 rotate_interval: 24 plugins: sequence: - oauth headers: x-forwarded-for: true x-forwarded-host: true
Note the differences:
1) MG does not load the oauth plugin
2) MG 1 and 2 run on different ports.
Microgateway get target endpoint information from the API Proxy definition.
For ex:
API Proxy 1: name: edgemicro_proxy1, basePath: /api1, target: https://foo1.com
API Proxy 2: name: edgemicro)proxy2, basePath: /api2, target:https://foo2.com
When MG is accessed via localhost:8000/api1, the call is sent to foo1.com.
... and then how might they distinguish the microgateway aware proxy (edgemicro_<unique name>) to use, specify their appropriate target url?
See here: http://docs.apigee.com/microgateway/latest/operation-and-configuration-reference-edge-microgateway
For example: MG 1 would have
edgemicro: port: 8000 max_connections: 1000 max_connections_hard: 5000 max_times: 300 config_change_poll_interval: 600 proxies: - edgemicro_auth logging: level: error dir: /var/tmp stats_log_interval: 60 rotate_interval: 24 plugins: sequence: headers: x-forwarded-for: true x-forwarded-host: true
The second MG can have:
edgemicro: port: 8001 max_connections: 1000 max_connections_hard: 5000 max_times: 300 config_change_poll_interval: 600 proxies: - edgemicro_proxy1 - edgemicro_proxy2 - edgemicro_proxy3 logging: level: error dir: /var/tmp stats_log_interval: 60 rotate_interval: 24 plugins: sequence: - oauth headers: x-forwarded-for: true x-forwarded-host: true
Note the differences:
1) MG does not load the oauth plugin
2) MG 1 and 2 run on different ports.
Are you saying I can put both these in the same <org>-dev-config.yaml file?
No. You will need two {org}-{env}-config.yaml files. However, since it is for the same ORG/ENV, there can only be one file in a folder.
You will see the MG supports an environment variable called: EDGEMICRO_CONFIG_DIR, this variable specifies the path to the config file (default is: ~/.edgemicro).
Before starting MG1, set the variable to "/app/config1" and before starting MG2, set the variable to "/app/config2".
You don't have to use environment variables. The option is also available as a flag on start.
Ex:
edgemicro start -o org -e test -k key -s secret -c /app/config1
edgemicro start -o org -e test -k key -s secret -c /app/config2
Ah, that's perfect. One final question:
How might they distinguish the Edge microgateway aware proxy (edgemicro_<unique name>) to use, specify their appropriate target url?
E.g.
Michael McD.
I'm afraid, I don't quite understand that question. Are you asking how to override a target endpoint or how a consumer will know which MG instance to hit?
Given two microgateway aware proxies, both with unique target urls
How does a microgateway instance choose which microgateway aware proxy's URLs to use as a target?
Microgateway get target endpoint information from the API Proxy definition.
For ex:
API Proxy 1: name: edgemicro_proxy1, basePath: /api1, target: https://foo1.com
API Proxy 2: name: edgemicro)proxy2, basePath: /api2, target:https://foo2.com
When MG is accessed via localhost:8000/api1, the call is sent to foo1.com.