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

/composer directory does not have updated permissions after running "docker-php-serversideup-set-file-permissions" #502

Open
yusufkandemir opened this issue Dec 13, 2024 · 1 comment
Labels
🐛 Bug: Confirmed Bugs that are able to be replicated.

Comments

@yusufkandemir
Copy link

When installing anything with Composer, it shows this warning:

Cannot create cache directory /composer/cache/files/, or directory is not writable. Proceeding without cache. See also cache-read-only config if your filesystem is read-only.

At some point, I even started experiencing errors when installing certain packages, so that was the moment I had enough of this and started investigating it.

The base image sets the user and group for /composer to www-data, as expected:

# Make composer cache directory
mkdir -p "${COMPOSER_HOME}" && \
chown -R www-data:www-data "${COMPOSER_HOME}" && \

However, after using docker-php-serversideup-set-id www-data $USER_ID:$GROUP_ID, the ownership gets out of sync, and there are no checks to avoid this from happening.

Workaround/Fix:
Currently, the fix is running chown for that folder manually, e.g.

# Set the user ID and group ID for www-data
RUN docker-php-serversideup-set-id www-data $USER_ID:$GROUP_ID  && \
  docker-php-serversideup-set-file-permissions --owner $USER_ID:$GROUP_ID --service nginx && \
  chown -R $USER_ID:$GROUP_ID /composer
  # ^^^ add this line

Possible solutions:

Bonus question, which should belong to the image repo: /var/cache/nginx seems to exist and is owned by www-data, but it's only chown'd in docker-php-serversideup-set-file-permissions for Debian, not others. I am not sure whether it is used or not on other ones, e.g. Alpine.

@jaydrogers jaydrogers transferred this issue from serversideup/spin-template-laravel-basic Dec 14, 2024
@jaydrogers jaydrogers changed the title /composer directory does not have updated permissions /composer directory does not have updated permissions after running "docker-php-serversideup-set-file-permissions" Dec 14, 2024
@jaydrogers
Copy link
Member

Thanks for reporting this! I will get /composer added to the list of directories changed during docker-php-serversideup-set-file-permissions.

@jaydrogers jaydrogers added the 🐛 Bug: Confirmed Bugs that are able to be replicated. label Dec 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 Bug: Confirmed Bugs that are able to be replicated.
Projects
None yet
Development

No branches or pull requests

2 participants