Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Local ansible deployment API gateway error 502 #5469

Open
nslvn opened this issue Mar 7, 2024 · 0 comments
Open

Local ansible deployment API gateway error 502 #5469

nslvn opened this issue Mar 7, 2024 · 0 comments

Comments

@nslvn
Copy link

nslvn commented Mar 7, 2024

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
  1. Create an action wsk -i action create test test.py
  2. Create an API route wsk -i api create /test get /guest/test
  3. 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 (apache/openwhisk-apigateway#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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant