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

[BUG-python/deployment] deploying on DNS with prefix #5792

Closed
aleksvercau opened this issue Jan 22, 2025 · 7 comments · Fixed by #5796
Closed

[BUG-python/deployment] deploying on DNS with prefix #5792

aleksvercau opened this issue Jan 22, 2025 · 7 comments · Fixed by #5796
Assignees

Comments

@aleksvercau
Copy link

Describe the bug

I am using the k8s deployment to deploy Argilla. I updated the examples/deployments/k8s/argilla-chart/values.yaml file to use our DNS and use https. The idea is to have it run on our DNS with a specific prefix, like all our other services deployed in kubernetes. However, adding a prefix breaks the application.

Stacktrace and code to create the bug

This is what is specified in my values file for the ingress:

argilla:
  ingress:
    enabled: true
    className: "nginx"
    host: mydns
    tlsSecret: tls-secret
    prefix: /argilla(/|$)(.*)
    annotations:
      kubernetes.io/ingress.class: nginx
      nginx.ingress.kubernetes.io/ssl-redirect: "false"
      nginx.ingress.kubernetes.io/use-regex: "true"
      nginx.ingress.kubernetes.io/rewrite-target: /$2

And this is how I updated the ingress:

{{- if .Values.argilla.ingress.enabled }}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: {{ include "argilla.fullname" . }}
  labels:
    {{- include "argilla.labels" . | nindent 4 }}
  {{- with .Values.argilla.ingress.annotations }}
  annotations:
    {{- toYaml . | nindent 4 }}
  {{- end }}
spec:
  ingressClassName: {{ .Values.argilla.ingress.className }}
  tls:
    - hosts:
        - {{ .Values.argilla.ingress.host | quote }}
      secretName: {{ .Values.argilla.ingress.tlsSecret }}
  rules:
    - host: {{ .Values.argilla.ingress.host | quote }}
      http:
        paths:
          - path: {{ .Values.argilla.ingress.prefix | quote }}
            pathType: Prefix
            backend:
              service:
                name: {{ include "argilla.fullname" . }}
                port:
                  number: 6900
{{- end }}

When I tried deploying on the plain DNS, without the prefix, it all works fine, when navigating to the url I land on the login page, as expected. When I add the prefix however, the p[age cannot be loaded. In the console I see the following issues:

Verify stylesheet URLs: This page failed to load a stylesheet from a URL.
AFFECTED RESOURCES
2 sources
        <link rel="preload" href="/_nuxt/df7f18a.js" as="script">
        <link rel="preload" href="/_nuxt/22e8fc5.js" as="script">

And the following errors for multiple files:

GET https://mydns/_nuxt/3045c38.js net::ERR_ABORTED 404 (Not Found)

when I manually add the prefix to those urls (ex. https://mydns/argilla/_nuxt/3045c38.js net) that cannot be found, the .js is loaded, so it looks like the _nuxt resources are not redirected properly when using a prefix.
I tried adding the BASE_URL environment variable, but that didn't fix it.

            - name: BASE_URL
              value: {{ .Values.argilla.ingress.prefix  }}

Expected behavior

Proper loading and functioning of interface when using a prefix.

Environment

  • Docker Image : argilla/argilla-server:latest

Additional context

No response

@burtenshaw
Copy link
Contributor

@frascuchon This seems like a simple error caused by a missing environment variable or routing to match NUXT resources. What do you think?

@burtenshaw
Copy link
Contributor

@aleksvercau One thing I noticed: In nginx, should rewrite-target be set to your prefix?

@aleksvercau
Copy link
Author

@aleksvercau One thing I noticed: In nginx, should rewrite-target be set to your prefix?

I am using regexes in the prefix, this rewrite target matches the regex.

@frascuchon
Copy link
Member

Hi @aleksvercau! You should define the ARGILLA_BASE_URL with the expected prefix. Here is the doc section about it

@aleksvercau
Copy link
Author

Hi @frascuchon ! Thanks for the tip. However, now I get {"detail":"Not Found"}, so there's still something wrong with the redirects. Any idea what it could be?

@frascuchon
Copy link
Member

Can you check the request URL running the "detail": "Not found" error?

@frascuchon
Copy link
Member

I found an error with the slashes. You should add the final / in the request. I've created a fix here

frascuchon added a commit that referenced this issue Jan 28, 2025
# Description
<!-- Please include a summary of the changes and the related issue.
Please also include relevant motivation and context. List any
dependencies that are required for this change. -->

Closes #5792

**Type of change**
<!-- Please delete options that are not relevant. Remember to title the
PR according to the type of change -->

- Bug fix (non-breaking change which fixes an issue)

**How Has This Been Tested**
<!-- Please add some reference about how your feature has been tested.
-->

**Checklist**
<!-- Please go over the list and make sure you've taken everything into
account -->

- I added relevant documentation
- I followed the style guidelines of this project
- I did a self-review of my code
- I made corresponding changes to the documentation
- I confirm My changes generate no new warnings
- I have added tests that prove my fix is effective or that my feature
works
- I have added relevant notes to the CHANGELOG.md file (See
https://keepachangelog.com/)
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 a pull request may close this issue.

3 participants