Support for bundle inline recipe configuration
Now that Flex has matured a bit, I would like to bring this point up again. Currently, having dozens of internal bundles (and several open-source), having dozens of applications using those bundles, we prefer to follow the recommendations and standards as much as possible. This means that we will start using Flex from 4.0 on.
The selling point of flex, is the ability to provide an "installation" into the application by using manifests. However, this being in an external repository, poses several issues:
- It doesn't work for closed source bundles, I can't add them.
- Double bookkeeping, if I add a new configuration option or provide something new, I have to remember to update the recipe in another repository as well.
- If I would use a closed source variant, I'd need to set this up and maintain this repository
To me, these are a few blockers that prevent Flex from being useful for me. I have dozens of bundles that have a mandatory configuration, but I won't be able to utilize flex to increase the Developer experience. It will actually make behavior different between the recipe'd packages and internal packages when it comes to installing, making it annoying to find out whether or not you still have to add some config file for example.
Recipes must be stored on their own repositories, outside of your Composer package repository https://github.com/symfony/recipes/blob/master/README.rst#creating-recipes
I'm not sure if this is a technical limitation, but I would love to be able to do the exact opposite, inline the configuration in my package. This gives me several benefits:
- My package provides optional integration into flex (if used).
- I can control multiple version based on the current version of the files, rather than making a directory per version.
- When I release my bundle version, I don't have to rely on the recipe repository to make it possible to install the newest config, I control the release.
- I won't forget to update the recipe repository, nor does someone else have to do this when a new feature is introduced.
- No need for privately hosted repositories, mirrors or proxies.
The directory structure of an inlined flex config could be as simple as adding a .flex directory or something similar.
I think this is a must have. A simple solution would be to add a flex.json file within a project.
Then, when we do a composer require the post-package-install hook will look for this file and run the recipe if needed.
It's more convenient for a developer to manage the recipes from his repository. And it will allow private recipes easily.
I'll have a look at the source code this week to see if it's something that could be implemented easily or not.
To me, inline recipes are like DI by annotations: something we don't want to support because it's putting the responsibility in the wrong hands. Configuration/wiring belongs to the consumer side, not to the code author's. Having configuration in dedicated repositories proves every day to be improving a lot the quality of the ecosystem, by forcing authors to have a discussion about how they shaped their bundles. See what's happening here, that's real. This way more important than providing convenience, but a very loose one in end.
To me, inline recipes are like DI through annotations: something we don't want to support because it's putting the responsibility in the wrong hands.
I disagree on the DI through annotations part, it feels more like configuring routes to me, it provides the link between the bundle (a route) and the framework (router). The responsibility is not in the wrong hands, it's still the author's responsibility to make it work, except that inlining it, will make the author's life a lot easier.
Configuration/wiring belongs to the consumer side, not to the code author's.
The consumer won't even notice this unless the consumer opens the directory containing this config.
Having configuration in dedicated repositories proves every day to be improving a lot the quality of the ecosystem.
Having them in different git repositories is quite cumbersome, a lot of extra work and a lot of problems keeping things in sync and test them properly. With a dedicated repository, there's need for a staging environment to test if your recipe works. With inline repositories, you merely have to install the fork or branch.
by forcing authors to have a discussion about how they shaped their bundles. See what's happening here, that's real.
Yes, this is indeed a benefit of the collective repository.
Long story short: I don't want the repository to be removed, I think it should still be leading. However, Symfony is recommending us to use flex, supply all kind of fancy tools, and we still have to do it the old fashioned way, because we can't open-source the majority of our bundles. We can't use a private github repository either, because then we still have to place our code external, rather than in-house. On top of that, maintaining an in-house repository, still has all the overhead I've mentioned, which we are not looking for.
When we have version 10.0.0 of a bundle, we have no need to keep the config of 3.0.0. Yes, we can delete those directories, but if we have 2 majors running side-by-side (for a few days max), there's so much extra work and overhead, that maintaining it, is not worth it. There's just too much that can (and thus will) go wrong when you keep it in an external repository.
"We can't use a private github repository either, because then we still have to place our code external": only the recipes repository must be on Github.
@fabpot You're right, but it would still "leak" outside, which is the problem
If you think it's a security problem to let developer manage their configuration (without being validated) we could make this option optin or ask the end user if he really wants to use the recipe (like you did for contrib https://github.com/symfony/flex/blob/master/src/Flex.php#L158)
There are 3 types of packages:
- Packages, useful for many people
- Set-of-files, useful only for their owner/creator
- Private packages
I think, that recipes and recipes-contrib are only for a first type. For the rest - keeping "recipes" in a same repository is the only way to re-use it with Fiex. So now, i have two options:
- Keep my own symfony-standard-edition with all my files
- Split my SE into parts and install them with my own composer plugin over Flex, when necessary
But, I do not like any: SE contains a lot of extra files, and plugin is a crutch =(
@Pierstoval copy-from-package is a great feature, somehow i missed it when I read it for the first time about recipes. It is suitable for all kinds of packages, except private of course.
Anyway, i've created a composer command, that allows to apply recipe manually right from the package. That command does not use symfony.sh, recipes and recipes-contrib. It just reads manifest.json from package and installs a "recipe". And it does not update composer.json after applying. How do you think, is there a place for such command in Flex?
@covex-nn There is now a solution for private repositories, but read my entire comment to know the limitations.
@iltar, @Grafikart I had already explained the problem of private repositories and presented solutions, but the Symfony team explained very well their motivations and their reasons for refusing to use any other means than the official and contrib recipes on Symfony.sh.
Of course, like you, I proposed the addition of the manifest in the component, what you call an 'inline configurationwith theflex.json` file, to be able to use Symfony Flex with private repositories (issue #71). Very good, a solution has been recently introduced for private repositories, but it is limited to private Github repositories, and connected to Symfony.sh's Github application. The problem is that repositories can be present on other platforms like Gitlab, Bitbucket, AWS CodeCommit, Mercurial, Fossil, SVN, CVS, local, etc ..., and in this case, it does not exist of solution currently.
@fabpot only the recipes repository must be on Github., yes I agree with you, however, you add a useless cost of $300/year for private repositories, and unnecessary complexity in the process of a team not using Github.
I understand that the Symfony team wants to talk with the developers of third-party components to make the Symfony ecosystem better, and therefore to lock it as it wishes, it is legitimate, but debatable.
Given that the Symfony team does not want to take responsibility for a likely bad quality on the configuration of the third-party component (because not verified by them or the community), I tried to express my vision of what Symfony Flex can represent for the third-party developers. I invite you to read my very (too?) long comment) in the issue #70, as well as the following different answers. I sincerely believe that Symfony Flex should move in this direction, despite the reluctance of the Symfony team.
@nicolas-grekas On this subject, and with all due respect, say that To me, inline recipes are like DI by annotations: something we don't want to support because it's putting the responsibility in the wrong hands. this is really a pseudo argument. Who better than the developers of the component to propose a configuration??? Of course, the community can make excellent proposals to projects, but also to components.
@nicolas-grekas Configuration/wiring belongs to the consumer side, not to the code author's. I agree and disagree with you on this point. It's good that the recipe is not in the component that wants to be generic and not oriented for a dedicated framework, but it is also interesting to have the recipe in the component for components dedicated to a project, such as plugins, themes, etc. of a modular project.
Of course, Symfony Flex should not offer everything and anything, but I think it should purpose a common base, and that's why I see much more Symfony Flex as a great automation tool to standardize the project configuration system, than a simple tool dedicated to the simplification of the Symfony's project configurations, despite what the team say, and even if you have added directly into the plugin a special configurator for the Symfony Bundles (Symfony\Flex\Configurator\BundlesConfigurator).
From this discussion, I therefore proposed in the issue #173 to add the ability to extend Symfony Flex, just as we can extend Composer, and I have propose in the PR #174, a simpler implementation than that presented in this issue. Several advantages to this solution:
- There is no need to reinvent the wheel and forked the Symfony Flex, but have a common and standardized base
- Add new configuration features not originally planned, like as adding new Configurators and Downloaders (such as using recipes in the component folder or on a private server, or other)
- All recipes added by a plugin are considered like a recipes-contrib, so, developers may or may not agree to use it
- Other examples and arguments are in this comment and his answers
Of course, the Symfony team does not agree to add a feature that for them, will not be used by the community. This results in an unnecessary maintenance cost for a feature that is not really useful for the majority of developers, and I can understand if they are right. In ths case, it's up to us developers of the Symfony community, to show that this feature is claimed, if you find it interesting.
And yes, I come back to the charge on this subject, but it's for a good cause ;-). I sincerely believe that this feature will be widely used for many projects, especially large open source or private modular projects. Symfony Flex could become an excellent tool for the configuration of projects and allow the community to design new Flex-based tools to do things that the Symfony's team did not initially envision or want to support, such as a plugin that supports recipes installed in the component.
It is obvious that I will still be satisfied if you only accept the inline configuration, although I think that giving the opportunity to extend Flex would be better.
Thank you for your great works, and have a good end-of-year parties :-)
Hi, I totally agree on the fact that limiting the flex server to Github only will be an issue especially for private projects/repositories that may not necessarily be stored on Github. Allowing either inline manifest config (which may be used only by those interested by said feature) or making a version of the app available for other systems (which may not be practical because it wouldn't be simple to maintain) is a must in order to give all potential flex users access to the full potential of this amazing tool. Personally I find this tool very useful but unfortunately I just can't use it on a vast majority of my projects because part of said projects use private code and I do not use nor do I want to use Github for my projects. Therefore I'd be very interested by having this inline manifest configuration available ; such a feature could be used by the projects that can't used the contrib or official recipes repository for legal or other reasons. Another option could be to allow a configuration variable to specify the package recipe repository url.
Flex recipes are validated and that's 100% part of the Flex experience. Inline recipes bypass any such validation. Also, asking contributors of a free plugin to develop and maintain a set of features for private needs is an economic nonsense. You can create your own plugin if you want to propose an alternative way to ship default configuration. I wish you all the best to justify the time you're going to spend on it for private projects. GitHub is also a false issue: only recipes must be on it, not projects themselves.
@nicolas-grekas : True, only recipes are placed on github but what is the sense in putting a recipe on a github repository when the only projects that would be using it are in a private self hosted gitlab intance for example... quick example : you're creating a proprietary application that uses symfony and want to use symfony-flex. I truly don't get what would be the point in putting the related recipes on a github project (even privately owned, thus paying a fee for something that you could host on your self hosted server for free...) Don't get me wrong the recipes and recipes-contrib are a great thing for shared packages recipes but not for private ones and enforcing the use of a non free private repository on github is not the solution IMHO. Also based on the fact that since the packages maintainers are the ones who should write the recipes, I just don't get why giving them the ability to add them directly in the package if they want is wrong. Sure it bypasses the whole recipes-contrib checks but a simple warning on the package install should suffice to warn about it. If an end user installs it, he will be made aware that it was not validated as packages from recipes or recipes-contrib are.
P.S. : Then again I might be wrong but I don't think I would be the only one thinking that way. Only time will tell. But I strongly believe that not giving an alternative for private packages (and by that I mean not just a non free one) will be somewhat a blocker for the maintainers of privately owned packages.
Note : the issue could also be approached the other way around : the symfony.sh process could be adapted to either be able to run on a remote git based repository or to be able to run against recipes from a remote git based repository (publicly available by connecting to it using credentials, which could be those of a github account)...
I do not have any insights on how the process in question works so I can only make suggestions, which could be possible or not.
I strongly agree with @rrajkomar - not being able to use our private packages in the build process is a strong blocker. We have a lot of internal packages that we cannot (not permitted by the customers) host anywhere else but that need to be integrated in Symfony. Think of a monitoring package, some connection to internal systems and so on. If we can't load them via Flex, this takes the fun out of it and will possibly break Flex, because we still need to register stuff manually (which is by far more prone to errors than having our own flex recipes and packages which we take our own responsibility for.
As an alternative to this, we could of course maintain our own standard edition of Symfony, but that's kind of the opposite of what Symfony 4 should become...
For us, the ability to load internal packages that we maintain on our local gitlab server is a deal breaker for Flex usage.
I think inline recipes would be great and when detected it could ask the user if it wants to use them. I'm too very interested in creating recipes for some of our internal bundles.
The alternative solution which I'm testing with now is to run a custom version of flex server https://github.com/aurimasniekis/flex-server and a private (non-github) repository where I store the recipes. This seems to work very good but I run into issues with recipes which would require sessions and security changes which is currently unsupported.
The current private recipes beta does mention a future price of 249€/month. You can check by yourself: https://symfony.sh/z/register
If the unconfirmed intention of having private recipes as a paid feature, It would make sense they are opposing any inline recipe configuration.
It would be sad, as I was hoping to use this feature for our private repositories.
@tseho Thank you for your link, I thought the integration would be free as nothing was mentioned in this way in the links provided by @fabpot in my issue #71, and that your page is not referenced on the Symfony.sh website. So now I understand better their confirmed intentions, and this justifies much more the unwillingness of the Symfony team to add other solution allowing to use recipes for private packages.
This remains a choice, and I do not despair to see the Symfony team reconsider their choice, allowing the community to add functionality to Flex with plugins (#174), if they do not want to support them natively (this issue).
However, other service with the same principle, does not force their users to subscribe to a paid offer to use an open source tool with private repositories. Take for example Composer and Packagist, they propose the service Private Packagist to manage private packages, but it is still possible to use VCS Repositories, private servers Satis or Packagist, "inlines" packages, Artifacts, Path directories, etc. ... to manage private dependencies. Same for NPM with NPM Registry, they offer to manage private packages with a paid subscription, but you can still use Git/Github/etc links in the dependencies. In both cases, we do not have to use their servers if we wish. Consequently, we subscribe to their services by choice (simplicity, speed, security, serenity, etc ...) and not because we are constrained technically.
I think that Symfony Flex should offer the same principle, and provide a solution that does not impose their proprietary Symfony.sh service. Of course, I understand and I encourage the promotion of this service, because it is important for SensioLabs SAS to diversify its income, allowing in return, to provide open source and proprietary quality tools (and everything that goes around). For example, SensioLabs' Blackfire is a great proprietary SaaS tool that is priced right. But concerning Flex and Symfony.sh, impose the service and propose it at a price of 249 EUR / mounth (297 USD), it's simply incomprehensible, especially since the services of the same type are rather between 7 and 16 USD per month.
@nicolas-grekas To answer your sentence
You can create your own plugin if you want to propose an alternative way to ship default configuration. I wish you all the best to justify the time you're going to spend on it for private projects.
For a service at 297 USD / month (in case it would be the final price, and not counting the 25 USD / month for Github if I use another service), I quickly justify the development of a plugin to work with private repositories. And I did not wait to realize it: Less than 4 hours on my free time to make a Composer plugin to use inline recipes, to define a package in require-dev as repository of recipes (like symfony/recipes), and allow to other plugins to add custom configurators or new type of recipe repositories. As I already told you, it's stupid to reinvent the wheel, because Flex is a very good base to build custom tools, and that's why I opted for the hack solution, even if it's not the one I prefer. The only disadvantage is that I have to use the reflection on 4 properties (and therefore subject to your changes), because you refuse to give the possibility to a Composer plugin to extend the functionalities of Flex (configurator and recipe repository).
So I do with, because in the end, my profitability is much higher, but I will prefer to see this capability natively integrated in Flex. It goes without saying that I am always open to making changes to my PR if you want to offer the capability to extend Flex for other plugins. Of course, I know that the Flex's extensibility is another issue, but it is closely related to this one.
@fabpot, @nicolas-grekas, the Symfony Core' team, please, reconsider the orientation of Symfony Flex.
Thank you
@francoispluchino did you consider the flex server I mentioned before? I think it does exactly what you want I guess.
I will just mention one thing: there is no relationships between this issue and the paid offering.
I've given the reasons why I'm opposed to this proposal. I still stand by them. I don't see why I would need to change the orientation of Flex. I have good reasons to think that the direction you want to take is not the right one.
Now, discussions are good. Discussions are open. I'm demonstrated more than once that people can convince me to change my initial plans.
But quite frankly, I don't even understand why one would think that I would consciously limit a tool just to be able to propose a paid offering. 14 years of free work for the community. Think about this. Anyway, have a good day. I'm done for now. I will go out, take a break.
@fabpot Sorry I joined the conversation with an unrelated pricing. I was surprised by the amount since pricing of SensioLabs tools, like Blackfire, have always been fair. It was not an attack, I have a lot of respect for you and your work. I'm using tools you created and contributed to everyday.
I have been following the progress of Flex since you announced it and I have great hopes for it. Without inline recipes, which are against your vision, I understand it's not a tool for me (and for a few others commenting here), and that's fine.
Flex will still be a welcome tool for open-source projects and curated recipes.