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] ARGILLA_BASE_URL variable is working properly #4568

Closed
frascuchon opened this issue Feb 5, 2024 · 1 comment · Fixed by argilla-io/argilla-server#14
Assignees
Labels
area: server Indicates that an issue or pull request is related to the server language: python Pull requests or issues that update Python code team: backend Indicates that the issue or pull request is owned by the backend team type: bug Indicates an unexpected problem or unintended behavior
Milestone

Comments

@frascuchon
Copy link
Member

Describe the bug
The Argilla server is not working when ARGILLA_BASE_URL is defined.

Stacktrace and Code to create the bug
The command

ARGILLA_BASE_URL=/base-url python -m argilla server start

will start the argilla server but the application won't be available at http://localhost:6900/base-url

Related to changes introduced in #3543 cc @gabrielmbmb

Expected behavior
The UI and server API should be available at http://localhost:6900/base-url

Environment:

  • Argilla Version [e.g. 1.0.0]: 1.23.0
  • ElasticSearch Version [e.g. 7.10.2]:
  • Docker Image (optional) [e.g. argilla:v1.0.0]:

Additional context
Add any other context about the problem here.

@frascuchon frascuchon added this to the v1.24.0 milestone Feb 5, 2024
Copy link

dosubot bot commented Feb 5, 2024

🤖

Based on the information you've provided, it seems like the issue might be related to how the ARGILLA_BASE_URL is being used in the configure_app_statics function. This function is responsible for setting up the static files for the application and it uses the base_url to replace a placeholder @@baseUrl@@ in the static files.

In the configure_app_statics function, the base_url is obtained from the settings and any trailing slash is removed:

base_url = helpers.remove_suffix(settings.base_url, suffix="/")

Then, this base_url is used to replace the placeholder @@baseUrl@@ in the static files:

helpers.replace_string_in_file(
    file,
    string=BASE_URL_VAR_NAME,
    replace_by=base_url,
)

If the ARGILLA_BASE_URL is defined as http://localhost:6900/base-url, the trailing slash is removed and the base_url becomes http://localhost:6900/base-url. This might cause issues if the static files are expecting the base_url to end with a slash.

To fix this issue, you could modify the remove_suffix function to not remove the trailing slash from the base_url. Alternatively, you could ensure that the static files are correctly handling the base_url without a trailing slash.

You can find this code in the src/argilla/server/app.py file.

As for the exact role of the ARGILLA_BASE_URL variable in the Argilla codebase, I wasn't able to find specific information within the repository. It's possible that this information is available elsewhere or I may have missed it. If you have more context or information about this, it could help in providing a more accurate answer.

I hope this helps! If you have any more questions or need further clarification, feel free to ask.

Sources


This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

If you want to continue the conversation, start your reply with @dosu-bot.

@frascuchon frascuchon changed the title [BUG-python/deployment] [BUG-python/deployment] ARGILLA_BASE_URL variable is working properly Feb 5, 2024
@dosubot dosubot bot added area: server Indicates that an issue or pull request is related to the server language: python Pull requests or issues that update Python code team: backend Indicates that the issue or pull request is owned by the backend team type: bug Indicates an unexpected problem or unintended behavior labels Feb 5, 2024
frascuchon added a commit to argilla-io/argilla-server that referenced this issue Feb 6, 2024
<!-- Thanks for your contribution! As part of our Community Growers
initiative 🌱, we're donating Justdiggit bunds in your name to reforest
sub-Saharan Africa. To claim your Community Growers certificate, please
contact David Berenstein in our Slack community or fill in this form
https://tally.so/r/n9XrxK once your PR has been merged. -->

# Description

This PR introduces changes to allow configuring a base path using
`ARGILLA_BASE_URL` without requiring an external proxy.

If you want to run argilla behind a proxy without changing base URL
(which means defining a pathRewrite rule in your proxy), you should use
the `UVICORN_ROOT_PATH` env variable. For more info visit
https://fastapi.tiangolo.com/advanced/behind-a-proxy/#behind-a-proxy and
https://www.uvicorn.org/settings/

Related PR: argilla-io/argilla#3543
Closes argilla-io/argilla#4568

**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)
- [ ] Breaking change (fix or feature that would cause existing
functionality to not work as expected)

**How Has This Been Tested**

(Please describe the tests that you ran to verify your changes. And
ideally, reference `tests`)

- [ ] Test A
- [ ] Test B

**Checklist**

- [ ] I followed the style guidelines of this project
- [ ] I did a self-review of my code
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] I filled out [the contributor form](https://tally.so/r/n9XrxK)
(see text above)
- [ ] I have added relevant notes to the `CHANGELOG.md` file (See
https://keepachangelog.com/)

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: server Indicates that an issue or pull request is related to the server language: python Pull requests or issues that update Python code team: backend Indicates that the issue or pull request is owned by the backend team type: bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants