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

chatqna-ui helm chart - nginx reverse proxy #305

Closed
wants to merge 2 commits into from

Conversation

SeanCondon
Copy link

@SeanCondon SeanCondon commented Aug 14, 2024

Description

This PR adds an nginx reverse proxy to the ChatQnA UI helm chart which allows the path to the chatqna pod and the data-prep pod to be configured at deploy time. This also has the benefit that it removes CORS errors

Issues

#276

Type of change

List the type of change like below. Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds new functionality)
  • Breaking change (fix or feature that would break existing design and interface)

Dependencies

List the newly introduced 3rd party dependency if exists.

Tests

Describe the tests that you ran to verify your changes.

@lianhao
Copy link
Collaborator

lianhao commented Aug 15, 2024

@SeanCondon please fix the DCO failure. You may need to 'git commit -s' to add the sign-off-by line in your commit message

@lianhao
Copy link
Collaborator

lianhao commented Aug 15, 2024

I think we also need to disable the 'helm test' for this case(i.e. delete the testpod definition). Since we can't have a backward dependency from ui to backend in this repo layout.

Copy link
Collaborator

@yongfengdu yongfengdu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It took me sometime to figure out how to use this, so a README is welcome for the UI.


location {{ .Values.BACKEND_SERVICE_ENDPOINT }} {
proxy_pass {{ .Values.backend.scheme }}://{{ .Release.Name }}-{{ .Values.backend.name }}:{{ .Values.backend.port }}/;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would prefer to keep the meaning of BACKEND_SERVICE_ENDPOINT as the same, because docker-compose is also using it.
Also, the {{ .Release.Name }} is not necessary part of the ENDPOINT, since it's possible chatqna-ui and backend have different release name. We need to give user options to change that.
Hardcode the location shouldn't be a problem, if that is, let's define a new variable to do that.
Recommend this way:
location "/chatqna/" {
{{- if .Values.BACKEND_SERVICE_ENDPOINT }}
proxy_pass {{ .Values.BACKEND_SERVICE_ENDPOINT }}
{{- else }}
proxy_pass {{ .Values.backend.scheme }}://{{ .Release.Name }}-{{ .Values.backend.name }}:{{ .Values.backend.port }}/;
}

proxy_pass {{ .Values.backend.scheme }}://{{ .Release.Name }}-{{ .Values.backend.name }}:{{ .Values.backend.port }}/;
}

location {{ .Values.DATAPREP_SERVICE_ENDPOINT }} {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

# chatQnA Mega service URL, e.g. http://<service-name>:<port>
BACKEND_SERVICE_ENDPOINT: ""
BACKEND_SERVICE_ENDPOINT: "/chatqna/"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No change of this variable's meaning as said above.


# data preparation service URL, http://<service-name>:<port>
DATAPREP_SERVICE_ENDPOINT: ""
DATAPREP_SERVICE_ENDPOINT: "/chatqna-data-prep/"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

@Ruoyu-y
Copy link
Collaborator

Ruoyu-y commented Aug 16, 2024

Thanks @SeanCondon for creating this PR. Regarding this, I saw @jaswanth8888 has fixed the issue opea-project/GenAIExamples#493 on defining the urls during build. But it does not clean up the CORS issue. Maybe can @SeanCondon and @jaswanth8888 get aligned here? So that we would have same logic for the UI in both docker and kubernetes case?

@SeanCondon
Copy link
Author

I think we also need to disable the 'helm test' for this case(i.e. delete the testpod definition). Since we can't have a backward dependency from ui to backend in this repo layout.

This is correct - it is a side effect of the strict checking of downstream dependencies by nginx pod.

@SeanCondon
Copy link
Author

Thanks @SeanCondon for creating this PR. Regarding this, I saw @jaswanth8888 has fixed the issue opea-project/GenAIExamples#493 on defining the urls during build. But it does not clean up the CORS issue. Maybe can @SeanCondon and @jaswanth8888 get aligned here? So that we would have same logic for the UI in both docker and kubernetes case?

@Ruoyu-y I have created a PR in GenAIExamples/ChatQnA that addresses this in the docker-compose case. I will come back and adjust this PR is that one is merged.

@lianhao
Copy link
Collaborator

lianhao commented Sep 9, 2024

@SeanCondon @Ruoyu-y has merged a PR #377 to add the nginx reverse proxy at chatqna e2e level. So I'm wondering if this PR is still needed or not?

@SeanCondon
Copy link
Author

@SeanCondon @Ruoyu-y has merged a PR #377 to add the nginx reverse proxy at chatqna e2e level. So I'm wondering if this PR is still needed or not?

Thanks for letting me know about #377 - I had not seen it. If the problem is solved then this change is not needed. Please feel free to reopen if needed. cc @Ruoyu-y.

Please see opea-project/GenAIExamples#616 where I address this for docker compose.

@SeanCondon SeanCondon closed this Sep 9, 2024
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

Successfully merging this pull request may close these issues.

4 participants