diff --git a/argilla-server/docker/argilla-hf-spaces/Dockerfile b/argilla-server/docker/argilla-hf-spaces/Dockerfile index 1fb2419e81..131b0a9e6b 100644 --- a/argilla-server/docker/argilla-hf-spaces/Dockerfile +++ b/argilla-server/docker/argilla-hf-spaces/Dockerfile @@ -44,7 +44,9 @@ RUN \ apt-get remove -y wget gnupg && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* && \ - rm -rf /packages + rm -rf /packages && \ + # Install pwgen curl and jq + apt-get update && apt-get install -y curl jq pwgen COPY config/elasticsearch.yml /etc/elasticsearch/elasticsearch.yml diff --git a/argilla-server/docker/argilla-hf-spaces/scripts/start.sh b/argilla-server/docker/argilla-hf-spaces/scripts/start.sh index 28b5e2a1e1..cc29f104d3 100644 --- a/argilla-server/docker/argilla-hf-spaces/scripts/start.sh +++ b/argilla-server/docker/argilla-hf-spaces/scripts/start.sh @@ -8,8 +8,11 @@ export OAUTH2_HUGGINGFACE_CLIENT_ID=$OAUTH_CLIENT_ID export OAUTH2_HUGGINGFACE_CLIENT_SECRET=$OAUTH_CLIENT_SECRET export OAUTH2_HUGGINGFACE_SCOPE=$OAUTH_SCOPES -# Set the space author name as username if no provided. +# Set the space creator name as username if no name is provided, if the user is not found, use the provided space author name # See https://huggingface.co/docs/hub/en/spaces-overview#helper-environment-variables for more details -export USERNAME="${USERNAME:-$SPACE_AUTHOR_NAME}" +DEFAULT_USERNAME=$(curl -L -s https://huggingface.co/api/users/${SPACES_CREATOR_USER_ID}/overview | jq -r '.user' || echo "${SPACE_AUTHOR_NAME}") +export USERNAME="${USERNAME:-$DEFAULT_USERNAME}" +DEFAULT_PASSWORD=$(pwgen -s 16 1) +export PASSWORD="${PASSWORD:-$DEFAULT_PASSWORD}" honcho start diff --git a/argilla/docs/getting_started/how-to-configure-argilla-on-huggingface.md b/argilla/docs/getting_started/how-to-configure-argilla-on-huggingface.md index a256f5d15c..7a0c46516a 100644 --- a/argilla/docs/getting_started/how-to-configure-argilla-on-huggingface.md +++ b/argilla/docs/getting_started/how-to-configure-argilla-on-huggingface.md @@ -82,10 +82,7 @@ Creating an Argilla Space within an organization is useful for several scenarios - **You want manage the Space together with other users** (e.g., Space settings, etc.). Note that if you just want to manage your Argilla datasets, workspaces, you can achieve this by adding other Argilla `owner` roles to your Argilla Server. - **More generally, you want to make available your space under an organization/community umbrella**. -The steps are very similar the [Quickstart guide](quickstart.md) with two important differences: - -!!! tip "Setup USERNAME" - You need to **set up the `USERNAME` Space Secret with your Hugging Face username**. This way, the first time you enter with the `Hugging Face Sign in` button, you'll be granted the `owner` role. +The steps are very similar the [Quickstart guide](quickstart.md) with one important difference: !!! tip "Enable Persistent Storage `SMALL`" Not setting persistent storage to `Small` means that **you will loose your data when the Space restarts**. @@ -118,16 +115,6 @@ client = rg.Argilla( ## Space Secrets overview -There's two optional secrets to set up the `USERNAME` and `PASSWORD` of the `owner` of the Argilla Space. Remember that, by default Argilla Spaces are configured with a *Sign in with Hugging Face* button, which is also used to grant an `owner` to the creator of the Space for personal spaces. - -The `USERNAME` and `PASSWORD` are only useful in a couple of scenarios: - -- You have [disabled Hugging Face OAuth](#how-to-configure-and-disable-oauth-access). -- You want to [set up Argilla under an organization](#how-to-deploy-argilla-under-a-hugging-face-organization) and want your Hugging Face username to be granted the `owner` role. +Remember that, by default, Argilla Spaces are configured with a *Sign in with Hugging Face* button, which is also used to grant an `owner` to the creator of the Space. There are two optional secrets to set up the `USERNAME` and `PASSWORD` of the `owner` of Argilla Space. Those are useful when you want to create a different owner user to login into Argilla. -In summary, when setting up a Space: -!!! info "Creating a Space under your personal account" - If you are creating the Space under your personal account, **don't insert any value for `USERNAME` and `PASSWORD`**. Once you launch the Space you will be able to Sign in with your Hugging Face username and the `owner` role. -!!! info "Creating a Space under an organization" - If you are creating the Space under an organization **make sure to insert your Hugging Face username in the secret `USERNAME`**. In this way, you'll be able to Sign in with your Hugging Face user. \ No newline at end of file