Closed mpoiriert closed 7 months ago
I could work on this but there is a lot of things that need to change.
If everyone is using make it would probably be transparent since docker will be loaded from there.
,I could work on this but there is a lot of things that need to change.
Do you have a list ?
I don't have a detail list but normally all the make task should pass trough docker.
The main issue I have with a Docker setup is that there is performance problem for hard disk access under Mac.
I am on ubuntu myself so it's not a concern, but it might be for many of you (don't know on which computer you are).
There is a way to do some optimization specific to Mac but I will not be able to provide any help for this. I know there's a way to have a docker-compose.override.yaml file that we would put in the gitignore so people could optimize there setup base on their configuration.
We could simply add the docker setup put the minimum make task to use it (install, build, up, down). And connect to the container directly and use the the other make task directly in the container. That way people can keep there set up other's could use docker. This is not the best way to set up a docker stack for development but it would be the most flexible.
We could also ignore the Makefile and provide 2 different file and the person will copy it the one they want (the original or the new one with docker setup).
That is pretty much what I have in mind right now.
We could also ignore the Makefile and provide 2 different file and the person will copy it the one they want (the original or the new one with docker setup).
Yes, I prefer to let the choice to the developer to use docker or directly install everything in his machine like it's already done.
@VincentLanglet Not exactly sure how to proceed. I just need to put some file in the "templates/project" directory and they will automatically get picked up ?
How can I test the "generation" ?
Also if we go with the 2 Makefle (eg.: Makefile.docker, Makefile.local) the main Makefile being now ignore. They will need to copy the one they want. But it's not possible to automate that part of the process since any Make recipes would not exists at that point.
Also I don't know which php extension or services (like databases, etc) are needed for each project.
I presume that we currently cannot serve (via symfony serve) multiple repository at the same time because they would all listen on the same port.
Have you ever consider developing via a monorepo instead ? This is the tendency for big project like this. it would simplify a lot of things.
The dev-kit repository would be pretty much obsolete. All PR would cover compatibility among all official sonata repository (your fix all changes that impact other repositories at the same time, etc.
@VincentLanglet Not exactly sure how to proceed. I just need to put some file in the "templates/project" directory and they will automatically get picked up ?
Yes.
When we need some config, we use this file: https://github.com/sonata-project/dev-kit/blob/master/config/projects.yaml. Then this command: https://github.com/sonata-project/dev-kit/blob/master/src/Command/Dispatcher/DispatchFilesCommand.php is dispatching the files in templates/projects ; and we can use twig to use the project config in it for instance https://github.com/sonata-project/dev-kit/blob/master/templates/project/.gitattributes.twig.
How can I test the "generation" ?
Not sure... We don't have lot of tests https://github.com/sonata-project/dev-kit/blob/master/tests/Command/Dispatcher/DispatchFilesCommandTest.php. I have to say that often we makes mistakes and fix them quickly ^^'.
You can take a look at the last PR https://github.com/sonata-project/dev-kit/pull/1970, jordisala was using this PR https://github.com/sonata-project/SonataAdminBundle/pull/7767 to test the impact on SonataAdmin by manually copy-pasting the code between dev-kit and SonataAdmin.
Also if we go with the 2 Makefle (eg.: Makefile.docker, Makefile.local) the main Makefile being now ignore. They will need to copy the one they want. But it's not possible to automate that part of the process since any Make recipes would not exists at that point.
I don't use docker. Wouldn't it be possible to just have only one Makefile ? And when you use docker-composer, docker automatically copy the makefile so you just have to write docker run make test
or something like that ?
Also I don't know which php extension or services (like databases, etc) are needed for each project.
I presume that we currently cannot serve (via symfony serve) multiple repository at the same time because they would all listen on the same port.
Some projects are more complexe but I generally just need php and composer to work on lot of sonata projects we could start with the simpler ones.
Have you ever consider developing via a monorepo instead ? This is the tendency for big project like this. it would simplify a lot of things. The dev-kit repository would be pretty much obsolete. All PR would cover compatibility among all official sonata repository (your fix all changes that impact other repositories at the same time, etc.
Sure it could be great to have a monorepo, but the migration would require lot of work/time. And with @jordisala1991, we only find enough time to maintain the current state while doing small improvement to those libraries. But we're always open to any motivated contributions.
Also, the monorepo won't solve the fact we need some duplicated files for every project, for instance github actions, and it better to have to update them only once (in the dev-kit) that in every project (even if it's in only one PR thanks to the monorepo).
I don't use docker. Wouldn't it be possible to just have only one Makefile ? And when you use docker-composer, docker automatically copy the makefile so you just have to write
docker run make test
or something like that ?
It might be possible, I don't normally work that way I am using make directly (make test) that call docker, but we could do something like you suggest. I would add a few make recipe to help with docker in that format: make docker-* and would prove a generic: make docker-make {make recipe}. It's a bit redundant but it could namespace things and allow everything to be reusable.
Sure it could be great to have a monorepo, but the migration would require lot of work/time. And with @jordisala1991, we only find enough time to maintain the current state while doing small improvement to those libraries. But we're always open to any motivated contributions.
I think it would reduce the amount of effort to maintain everything and might help developer to contribute. On the long run it would help, but obviously on the short terms it's a lot of work.
Also, the monorepo won't solve the fact we need some duplicated files for every project, for instance github actions,
Not sure, I have a mono repo with 20 packages and I don't need multiple github actions. I have one that test the main repository (like a sandbox) this repository is also the one I load via http to test everything integrated together (when UI is involve). I also have one action that do a "after split" test via a matrix of packages to test the composer.json configuration the automation test of each of them. I am following this: https://tomasvotruba.com/blog/2020/02/10/how-to-test-monorepo-after-split-before-actual-split/
I will try to first do a simple docker setup for dev-kit itself (I presume it's not part of the "projects" list...) and will go one step at the time (having only php so we can do the minimum without having to setup a local environment). And increment what we need when needed.
Also I have some ide file that seem to not be ignored by default. I am using Intellij IDEA Ultimate Edition. I don't see any ignore concerning IDE. Is there something I am missing or people have a bunch of file that they try to not commit ?
For IDE files you normally have a global gitignore and ignore there for all git repositories at once.
About the Makefile thing, IMO we need a way to have task runned through docker and others not, mainly for people that dont want to setup docker (even if it is easier than setup PHP) and to run the github actions.
To help contribution it would be helpful to have a docker (docker-compose) set up in the project instead of installing all the required tools/lib.
Conversion move from https://github.com/sonata-project/SonataAdminBundle/issues/7821