-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Edit php configuration wp-env #28703
Comments
This unfortunately highlights an issue with a high-level wrapper such as This is a problem that is (partly) solved by Docker and One hypothesis here could be: Our use case here isn't that special; there might be precedent out there where people need to configure their |
I think the use case of Personally, I am a devOps who are using it for my team who don't know how to use docker. The learning curve is too much for them. It's easier for them to look at the documentation of That's how I see I think the way to go with this issue is to offer the possibility to add configuration in the Another interesting command could be a |
Docker containers are meant to be immutable: The environment is declaratively defined in a As far as I know, the So either we let users modify |
If we decide to go the |
If you need the |
This worked for me: php.ini
.wp-env.json {
"mappings": {
"php.ini": "./php.ini"
}
}
|
I think we should move forward with the
|
I agree that's the premise that
My point is, they wouldn't. I agree that we want to give people simple recipes to follow, which don't require them to learn about the underlying tooling. But I think that can be done just as fine if we remove the We'd basically just change a few lines in what is now the diff --git a/packages/env/README.md b/packages/env/README.md
index 2b66a6da75..549ae2f903 100644
--- a/packages/env/README.md
+++ b/packages/env/README.md
@@ -76,7 +76,7 @@ $ cd ~/gutenberg
Then, start the local environment:
```sh
-$ wp-env start
+$ docker-compose up
```
Finally, navigate to http://localhost:8888 in your web browser to see WordPress running with the local WordPress plugin or theme running and activated. Default login credentials are username: `admin` password: `password`.
Most of that could be contained in a And BTW, the abstraction is kind of leaking already: The
I agree that we'd want to retain functionality that provides e.g. a set of themes and plugins OOTB. But if we base that on a WP dependency manager, there might be a number of options that don't involve dynamically generating a
This sheds light on an important problem: People can't simply "graduate" from Or -- and perhaps more realistically -- they will file an issue or PR, requesting for this feature to be added. Which is what we're seeing, and what I predict we'll continue to see. And we can't just say, oh, we won't implement this since we don't think there's enough demand for this feature, but you can do xyz in your So we're currently in this constant state of playing catch-up with feature and extension requests for Meanwhile, the whole thing is kind of a pain to maintain already -- which I attribute mostly to its many layers of indirection. See e.g. this comment for a 🐰 🕳️ I went down earlier (and which seems to be making some PHP unit tests unreliable).
🤷♂️ Anything that removes some of the current indirection is fine in my book. This could be a start; though I think the bigger question is how to properly isolate the concern of dependency management, and integrate that cleanly with Docker/docker-compose. If we solve that problem, we might not need to scaffold or generate the |
Thank you for raising this conversation Bernie; I definitely think it's valuable to talk about. I agree with a lot of your pain points. It is a pain to maintain. It is tricky to know what features to add. However, I remember back to why this was introduced in the first place, and the reality was that if you wanted to use Docker, you either had to roll your own I think
I think I might agree with you more if Additionally, the big problem In other words, I think wp-env is trying (sometimes successfully, sometimes unsuccessfully) to make a docker-compose/docker set up that installs everything you need so that you don't have to tweak it. You don't have to do bug fixes so long as they are fixed in wp-env and updates are published frequently. (This is one area where the project needs improvement. It needs more devs and independent npm updates.) In even plainer words, I think the best DX is getting an environment which has everything you need out of the box, without you having to work for it. I think there are two parts of that:
I don't think that item 1 is solved with docker-compose. I think it is partially solved by wp-env. I think there is so much potential for wp-env to do more and better in this area. I think parts of item 2 are solved by docker-compose. You get a similar interface as wp-env for several commands. I think wp-env is still a slight bit nicer to use for most things, but it's not as clear of a difference as the first item. All that said, I want to be clear about my own limitations. I'm maintaining this project because it was painful as a plugin maintainer to set up a dev environment, and because it was painful as a plugin developer to use existing dev environments. I'm new to both WordPress and Docker (as of a couple years ago), so there's lots of stuff I don't have an advanced understanding of. So are there better solutions?
Finally, I'm excited to continue this conversation. We definitely need to determine the motivating goals for this project and then stick to them going forward.
IMO, we could even remove that line. wp-env tends to fail pretty spectacularly if things go wrong.
In my opinion, this is more to do with how we have to use wp-phpunit to make the WP test library available. I think we could fix that problem, I'm not sure it's completely related to wp-env. It might be more because I didn't/don't know much about phpunit when I set it up. I made an issue and PR a while ago for automagically installing the test library from WP which matches the version of WordPress you have installed. That would reduce a lot of the indirection required to get phpunit up and running. |
Thanks @noahtallen for your thoughtful reply! I truly appreciate the work and thought you've put into
Thanks for bringing that up, and great point 👍 I've long thought that it'd be great to have a standardized developer environment that can be used by a number of different projects. It's great that
This is a double-edged sword, however: IMO,
Yes, absolutely. But to be clear, this is a goal I wouldn't compromise on for whatever alternative solution we'd be able to come up with.
This is a statement that IMO deserves closer scrutiny 😬 What are the things that people have to tinker with? After all, To make this more concrete, I think we should have a look at the
I'm afraid that this is where I believe that theory and practice disagree: Of course wp-env would benefit from more devs and resources, but barring that, we should make the entry barrier for new devs lower. (And I selfishly include myself there: Having worked with
Yes -- I hope I've made it clear that I share this goal! Where I do believe I differ is the "next step" for people that want that, but want to make some minor tweaks on top of that setup: I want them to be able to "graduate" from their initial OOTB setup; requiring a minor tweak should map to changing only few lines, if it's only a few lines of configuration that the underlying tool needs changed. In order to contribute a fix like that to
I think that those are great questions to ask! Let's start exploring; I'll file a PR as mentioned above to serve as a starting point 👍
👍 👍 👍
Sounds good, I'll have a look into that issue and PR! |
Fantastic reply Bernie, thanks! It sounds like we're on the same page about the desired DX -- so the question is what to do to get there. Thanks for opening that PR, I'll be happy to continue the conversation there.
Digging into this scenario a bit, I'm apprehensive about the docker-compose approach because it feels like it's not upgrade-able. Then, any fixes or improvements become the burden of individual plugin maintainers, rather than just updating the environment tool. |
Would it? 🤔 We'd probably still be shipping a |
I think I might misunderstand your suggestion! Let me see if I get this right: Your thought is to have wp-env provide a default docker-compose.yml file, which is "hidden". (Like we currently do, though we won't generate it from the config anymore.) The way users replicate ".wp-env.json" is by creating the In that case, I'm getting much more on board with the idea. I originally thought you meant that each project would have the entire docker-compose in VCS. I do think it would simplify things a great deal. Though, how do we replicate .wp-env.override.json now? Is there a second level of override possible with docker-compose? |
Interesting ideas and discussion. I really like the idea of having the docker configuration closer to me and starting out might have been a little easier for my brain to understand. Then I knew little of WordPress and only enough about Docker to tinker. . .wp-env.*.json is comfortable to me now, though and I would really miss the feature of unzipping/unpacking resources, something I don't know how you could replicate without that kind of configuration. |
Yep, that's pretty much the idea! 😄
No, I think it makes sense to provide a 'packaged' baseline config for WP development -- this would continue to be
Yeah, that seems to be possible; although I'm not totally sure how ergonomic it would be:
There's another (albeit legacy) way to modularize But it seems like there are enough options that we'll be able to figure something out 😄 |
@hjvedvik |
This took me a while to figure out, so I'm leaving a comment with a solution that worked for me.
{
"mappings": {
".htaccess": "./.htaccess"
}
}
I got the idea from the unmerged pull request #32363. There's another issue #29430 regarding the same question as this one #28703, about how to increase the default upload size limit. Both of these have been unresolved for two years, even though there's a pull request that addresses them. I understand there's a discussion about the ideal design of
|
I've made a few contributions to wp-env and created like 3 forks in order to suit my purposes. Honestly, in my opinion, you should just not use wp-env at all in its current state. If you do, you're about to have lots of fun as soon as you need more advanced configuration. I rather use LocalWP with its Blueprints and custom Just my recommendation for anyone who comes across this comment. People may disagree. |
You both definitely make good points -- wp-env so far just doesn't have enough maintainers to really make it a very advanced tool. I still think that it's great for simple local environments, but I'm happy to admit there are many tools that provide more advanced functionality! (And happy to admit there are plenty of shortcomings to wp-env.) Here's where I think this stands:
This makes php config easily editable and hopefully reduces how much it's needed in the first place |
Going back to the top of this issue report, I actually think it was a sensible decision to not add the option
I can see the value in keeping And it turned out that there is a solution using an existing feature, of mapping So it seems that providing such "escape hatches" (and documenting them) is a good way to support advanced use cases, for people who need to configure the underlying parts. That would give a lot of flexibility, while still keeping things simple for I also like the idea that was getting developed through discussion, some way to modularize and customize the generated |
What problem does this address?
I need to increase the
max_upload_filesize
and I can't find how to edit the php.ini. I've tried to edit the~/.wp-env/{HASH_OF_MY_PROJECT}/Dockerfile
by addingRUN echo 'upload_max_filesize="512M"' >> /usr/local/etc/php/php.ini
but when I do awp-env start --upgrade
, it replace the entireDockerfile
.What is your proposed solution?
I think the best solution should be to add php configuration params in the
.wp-env.json
. Something like :An other idea should be to Specified a customer
Dockerfile
to use. The only downside of this one is auto configuration like wordpress version, core version or xDebug configuration won't work.The text was updated successfully, but these errors were encountered: