Local ansible deployment API gateway error 502
- Dominant language
- Scala
- Stars
- 6.8k
- Forks
- 1.2k
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 2
Description
## Environment details:
* local deployment, native ubuntu, Mac OS, Kubernetes, ...
Local deployment using ansible with apigateway
* version of docker, ubuntu, ...
Docker version 24.0.7, build afdd53b
Ubuntu 22.04.3 LTS
## Steps to reproduce the issue:
1. Deploy openwhisk using ansible
```
export ENVIRONMENT=local
# Export Keys
ansible-playbook -i environments/$ENVIRONMENT prereq.yml
ansible-playbook -i environments/$ENVIRONMENT setup.yml
# couchdb is still needed to store subjects and actions
ansible-playbook -i environments/$ENVIRONMENT couchdb.yml
ansible-playbook -i environments/$ENVIRONMENT initdb.yml
ansible-playbook -i environments/$ENVIRONMENT wipe.yml
ansible-playbook -i environments/$ENVIRONMENT openwhisk.yml \
-e skip_pull_runtimes=True \
-e limit_action_memory_max=4294967296 \
-e limit_action_memory_std=2147483648 \
-e limit_invocations_per_minute=999999 \
-e limit_invocations_concurrent=9999999 \
-e limit_fires_per_minute=9999999 \
-e limit_sequence_max_length=1000 \
-e namespace_default_limit_action_memory_max=8192 \
-e lean=true \
-e invoker_user_memory="16384m" # Too much here is an issue when it creates too many concurrent processes!
# to use the API gateway
ansible-playbook -i environments/$ENVIRONMENT apigateway.yml
ansible-playbook -i environments/$ENVIRONMENT routemgmt.yml
ansible-playbook -i environments/$ENVIRONMENT edge.yml \
-e cli_installation_mode=remote \
-e openwhisk_cli_home="$OPENWHISK_HOME/../openwhisk-cli"
# installs a catalog of public packages and actions
ansible-playbook -i environments/$ENVIRONMENT postdeploy.yml
```
2. Create an action `wsk -i action create test test.py`
3. Create an API route `wsk -i api create /test get /guest/test`
4. Curl the action -> Error 502
## Provide the expected results and outputs:
A working response (not 502)
## Provide the actual results and outputs:
```
{"code":502, "message":"Oops. Something went wrong. Check your URI and try again."}
```
## Additional information you deem important:
I've found this issue (https://github.com/apache/openwhisk-apigateway/issues/370) for the apigateway already. However, I think the bug is with the deployment script, not the gateway itself. Adding "BACKEND_HOST" in the apigateway task deploy role file fixes this issue, but I'm not sure if this is correct for other deployments as well. Note that using "http" as a scheme (as seems to be used by the standalone version) does not work because the proxy does forward the 308 redirect to https instead of handling it in-line.
```
- name: (re)start apigateway
docker_container:
name: apigateway
image: "{{ apigateway.docker_image | default('openwhisk/apigateway:' ~ apigateway.version) }}"
state: started
recreate: true
restart_policy: "{{ docker.restart.policy }}"
hostname: apigateway
env:
"REDIS_HOST": "{{ groups['redis'] | first }}"
"REDIS_PORT": "{{ redis.port }}"
"REDIS_PASS": "{{ redis.password }}"
"PUBLIC_MANAGEDURL_HOST": "{{ ansible_host }}"
"BACKEND_HOST": "https://{{ groups['controllers'] | map('extract', hostvars, 'ansible_host') | first }}" # Added to avoid gateway issues
"PUBLIC_MANAGEDURL_PORT": "{{ apigateway.port.mgmt }}"
"TZ": "{{ docker.timezone }}"
ports:
- "{{ apigateway.port.mgmt }}:8080"
- "{{ apigateway.port.api }}:9000"
pull: "{{ apigateway_local_build is undefined }}"
- name: wait until the API Gateway in this host is up and running
uri:
url: "http://{{ groups['apigateway'] | first }}:{{ apigateway.port.api }}/v1/apis"
register: result
until: result.status == 200
retries: 12
delay: 5
```
Contributor guide
Assessment
This issue has not been assessed yet.