Skip to content

Dynamically change UID and GID of PHP-FPM process#14

Closed
pierlon wants to merge 2 commits into
WordPress:masterfrom
pierlon:feature/dynamic-gid-uid
Closed

Dynamically change UID and GID of PHP-FPM process#14
pierlon wants to merge 2 commits into
WordPress:masterfrom
pierlon:feature/dynamic-gid-uid

Conversation

@pierlon
Copy link
Copy Markdown

@pierlon pierlon commented Sep 2, 2019

Closes #13.

This PR allows for the PHP-FPM process to have a dynamic UID/GID upon startup for the PHP container. This is accomplished by creating a user and group that matches the UID and GID of the host user.

By default, a user and group called wp_php is created with a UID/GID of 1000. PHP-FPM is then configured to run under this user and group. The UID and GID can be overriden upon startup of the container if needed by setting the PHP_FPM_UID and PHP_FPM_GID environment variables.

@pento
Copy link
Copy Markdown
Member

pento commented Sep 3, 2019

Thank you for the PR, @pierlon!

It's important that systems weirdness be abstracted away as much as possible, I'm concerned about how this change would bring it to the fore. Do you have thoughts on how PHP_FPM_UID and PHP_FPM_GID could be automatically populated with the correct values?

@pierlon
Copy link
Copy Markdown
Author

pierlon commented Sep 3, 2019

The UID/GID of the user could be retrieved upon running npm run env:start and then be provided as env vars when starting the PHP container.

Otherwise, the user could set override those env vars in the .env file.

@pierlon
Copy link
Copy Markdown
Author

pierlon commented Sep 14, 2019

Hey @pento, how can I proceed to get this merged?

@pento
Copy link
Copy Markdown
Member

pento commented Sep 26, 2019

Thank you for your patience here, @pierlon. 🙂 Could I get you to have a look at #16? I've been working on it there, simplifying a lot of the generic code that we don't really need. I've been working on it in conjunction with some (currently hacky, as a proof of concept) testing on WordPress/gutenberg#17518.

The Gutenberg PR shows that the permission fixes work, as I've been able to remove the old permission hacks from .travis.yml.

@pento
Copy link
Copy Markdown
Member

pento commented Sep 26, 2019

To keep things moving, I'm going to close this PR, and merge #16, it can be iterated on later if needed.

@pento pento closed this Sep 26, 2019
@pierlon
Copy link
Copy Markdown
Author

pierlon commented Sep 26, 2019

Hey @pento, glad to see this getting some traction. I see no problems with #16 and don't think any more changes need to be made there.

I'll see how I can help with WordPress/gutenberg#17518.

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 this pull request may close these issues.

Plugins and themes can't be installed

2 participants