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

Generate Docs failed on MacBook Pro #1490

Open
2 tasks
linxpinx opened this issue Oct 14, 2024 · 7 comments
Open
2 tasks

Generate Docs failed on MacBook Pro #1490

linxpinx opened this issue Oct 14, 2024 · 7 comments
Assignees
Labels
bug Something isn't working hacktoberfest

Comments

@linxpinx
Copy link
Collaborator

./Build/Scripts/runTests.sh -s docsGenerate failed on MacBook Pro.

Acceptance Criteria

  • ./Build/Scripts/runTests.sh -s docsGenerate is running
  • Docs are generated correctly

Additional Information

Errormessage:

adduser: unknown group typo3
su: unknown user typo3
@linxpinx linxpinx added bug Something isn't working hacktoberfest labels Oct 14, 2024
@linxpinx linxpinx self-assigned this Oct 14, 2024
@oliverklee
Copy link
Contributor

If I remember, I encountered a similar problem on my machine quite some time ago.

Are you using Docker or Podman?

@linxpinx
Copy link
Collaborator Author

Hi Oli,
I use https://github.com/abiosoft/colima. But I can try with docker.

@linxpinx
Copy link
Collaborator Author

linxpinx commented Oct 14, 2024

Ok i checked it with docker and it works with or without my changes. So I think we can take my changes into the code.

We also have the composer docs:generate command in the composer.json and in the Documentation.rst.

Maybe we can discuss this with the team.

@sbuerk
Copy link
Collaborator

sbuerk commented Oct 14, 2024

Is the group identifier really needed ?

Literally, instead of adding it dirctly to the command call following check should be investigated:

if [ "$(uname)" != "Darwin" ] && [ "${CONTAINER_BIN}" == "docker" ]; then
# Run docker jobs as current user to prevent permission issues. Not needed with podman.
USERSET="--user $HOST_UID"
fi

if [ "$(uname)" != "Darwin" ] && [ "${CONTAINER_BIN}" == "docker" ]; then
    # Run docker jobs as current user to prevent permission issues. Not needed with podman.
    USERSET="--user $HOST_UID"
fi

First, does the condition not work on your side and leaves USERSET empty ?

I would suggest to add a "DOCUMENTATION_USERSET" here in the condition setting the user along and replace ${USERSET} for the conrainer execution (run) call.

Not sure about the impact doing it in USERSET directly which are used for all container executions. At least should be checked for all if the group is added. In the end, should only target for macos and docker usage (docker command available).

@linxpinx
Copy link
Collaborator Author

The group is needed otherwise the Rendering Process is not working.

First, does the condition not work on your side and leaves USERSET empty ?
yes USERSET is empty cause I have a Mac, so Darwin is true.

I added this in runTests.sh:

if [ "$(uname)" != "Darwin" ] && [ "${CONTAINER_BIN}" == "docker" ]; then
    # Run docker jobs as current user to prevent permission issues. Not needed with podman.
    USERSET="--user $HOST_UID"
    elif [ "$(uname)" == "Darwin" ] && [ "${CONTAINER_BIN}" == "docker" ]; then
        USERSET="--user=$(id -u):$(id -g)"
fi

and extend the composer command:
"docs:generate": "docker run --rm --user=$(id -u):$(id -g) -v $(pwd):/project ghcr.io/typo3-documentation/render-guides:latest --progress --config ./Documentation",
and tested the other commands in runTests.sh where USERSET is used, works on Mac and Colima.

Maybe Windows/Linux can tested by someone else.

@garvinhicking
Copy link

Please note that for the render-guide repository the entrypoint of the Docker file:

https://github.com/TYPO3-Documentation/render-guides/blob/main/entrypoint.sh#L107

does some "magic" to try unifying the system to work on macos, windows and linux due the specialties of Docker in each of them.

We're open to optimizing this, if anyone has ideas on how it should be done so it works accross all systems without too much if-conditions ;)

@garvinhicking
Copy link

(Please note that in https://docs.typo3.org/other/t3docs/render-guides/main/en-us/Installation/Index.html#Setup_Docker we actually have a place that mentions this --user... command argument. Still, it would be great to somehow detect this properly within the container)

garvinhicking added a commit to TYPO3-Documentation/render-guides that referenced this issue Oct 23, 2024
A common problem for macOS users running docker as non-root
is that omitting a '--user' option makes our entrypoint.sh
script try to on-the-fly create a matching user.

(See FriendsOfTYPO3/tea#1490)

This patch adds a verbose error message to hint at the
problem.
garvinhicking added a commit to TYPO3-Documentation/render-guides that referenced this issue Oct 23, 2024
A common problem for macOS users running docker as non-root is that
omitting a '--user' option makes our entrypoint.sh script try to
on-the-fly create a matching user.

(See FriendsOfTYPO3/tea#1490)

This patch adds a verbose error message to hint at the problem.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working hacktoberfest
Projects
Status: No status
Development

When branches are created from issues, their pull requests are automatically linked.

4 participants