You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Refactor CMS specific logic to make it easier to add/support additional CMSes #535
Out of the gates, ddev was focused on the following 3 CMSs: Drupal 7, Drupal 8, and WordPress. However, that was not the final vision and the goal is to make adding new CMSs a straightforward process through a set of standard interfaces versus leveraging a series of if/then statements (please note that I have not audited the codebase myself, so this is not meant to an indictment or a complaint of what was written thus far because it has served a need).
To that end, the following is suggested:
Inventory locations in the codebase that have WordPress or Drupal specific logic. The biggest area is likely surrounding the creation and maintenance of database config files.
Create a recommendation on how to rework the codebase to make it easier to add additional CMS support and tests against said CMSs.
import-files is going to have to be handled at least for things like pantheon tarballs, so it might as well be handled for the import-files command. So when doing that work we should make sure that pantheon integration works right with it.
We talked about an explicit settings-creator command. That probably isn't absolutely necessary until we find we're pushed on it. Although I might use it in my workflow.
I inventoried where we're using the "apptype" and I think this is what we have. The good news is that it doesn't seem we have anything in the nginx container any more, all code is in ddev.
pkg/ddevapp/config.go has AllowedAppTypes (which actually should be used other places if we're going to control it)
ddevapp/templates.go has templates for hooks for each of the 3 currently supported types. They're just templated example comment code, and they are used in config.go
siteSettingsPath() in ddevapp/config.go (and the Config struct)
Drupal's concept of a local settings path (settings.local.php) is wired in some places, but may not work with other frameworks.
CreateSettingsFile() in local.go of course is wired.
ImportFiles in local.go. This import-files command could actually get lost, since people could just set up the files they want on the host.
Apptype is explicit in cmd/config.go (but only for checking options and giving an error message)
Performance tests have it wired in; this probably doesn't do any harm.
The bottom line is that we are doing these specific things for different app types:
Apptype automatic detection
Create/manage settings file or settings.local.php
Import files
Add comments to config.yaml with suggestions about steps
Add an "" apptype (similar to our "" docroot?) that is not usable for settings.php or files manipulation of any kind.
Change apptype detection to apptype suggestion, where people have to confirm the apptype (or select empty)
Consider removing ddev import-files (but not the underlying capability) because most of our users at this point don't have any way to exactly tell us where the files should go. Even on Drupal the files may not go in sites/default/files. (An alternative to this is to support the apptypes we think we can support, using callbacks, but warn on apptypes we can't handle)
Centralize the concept of supported apptypes in one place.
I'm not sure how to handle settings.local.php outside of Drupal context. But it's so very useful there.
Systematize the provision of commented-out config.yaml post-xxx steps per apptype.
Add config.yaml settings for path of site-managed-files. Wordpress and Drupal do public files fairly similarly. We have never supported private files or other types. I think typo3 has a different approach.
IMO, apptype detection/suggestion should be a progressive enhancement kind of thing. That is, we'd set environment variables with database connection details as the base case, and then if it's an apptype that we have explicit support for, then we can layer on extra stuff (generating settings.php and the like). This way, we can have limited support for all apps in a particular runtime (PHP or whatever), and then do fancy stuff when appropriate.
This approach scales well to other runtimes (for instance Ruby or Python) and doesn't require us to develop explicit support for everything out of the gate.
Between the last two comments and some discussion at our demo day, I think this is coming along well. A few thoughts/clarifications:
I'm not opposed to making the app type dedication a suggestion that they confirm rather than just assuming it and moving on. FWIW, I still think there is value in the detecting.
import-files. We've discussed the possibility of hiding this and keeping it more as an internal function, particularly for provider plugins where it's an essential utility for translating known archive formats/patterns from each provider and passing it through the import-db and import-files with the appropriate flags.
settings.local.php. Wouldn't we be willing/able to address the logic surrounding this within the same function of generating/managing the settings.php files for Drupal 7/8 and Backdrop CMS?
Moving to needs review given that the PR has an approval and I'm assuming there will be no blockers short of getting the follow-up issues filed before this is closed out.
I was about to close this but I see two things that still need work:
import-files is going to have to be handled at least for things like pantheon tarballs, so it might as well be handled for the import-files command. So when doing that work we should make sure that pantheon integration works right with it.
Made a few modifications. We're still trying to bust through v1.0.0 due to the Semver commitment, but I tagged this with v1.2.0 because that's where the current roadmap states it belongs and we can cherry pick, bring it in and complete it earlier if time permits.
Activity
rfay commentedon Nov 20, 2017
I inventoried where we're using the "apptype" and I think this is what we have. The good news is that it doesn't seem we have anything in the nginx container any more, all code is in ddev.
The bottom line is that we are doing these specific things for different app types:
rfay commentedon Nov 20, 2017
It looks to me like we could
rfay commentedon Dec 4, 2017
Proposal:
ddev import-files(but not the underlying capability) because most of our users at this point don't have any way to exactly tell us where the files should go. Even on Drupal the files may not go in sites/default/files. (An alternative to this is to support the apptypes we think we can support, using callbacks, but warn on apptypes we can't handle)cweagans commentedon Dec 4, 2017
IMO, apptype detection/suggestion should be a progressive enhancement kind of thing. That is, we'd set environment variables with database connection details as the base case, and then if it's an apptype that we have explicit support for, then we can layer on extra stuff (generating settings.php and the like). This way, we can have limited support for all apps in a particular runtime (PHP or whatever), and then do fancy stuff when appropriate.
This approach scales well to other runtimes (for instance Ruby or Python) and doesn't require us to develop explicit support for everything out of the gate.
rickmanelius commentedon Dec 15, 2017
Between the last two comments and some discussion at our demo day, I think this is coming along well. A few thoughts/clarifications:
import-dbandimport-fileswith the appropriate flags.rickmanelius commentedon Dec 26, 2017
Moving to needs review given that the PR has an approval and I'm assuming there will be no blockers short of getting the follow-up issues filed before this is closed out.
Generic multi-apptype support, for #535 (#574)
rfay commentedon Jan 4, 2018
I was about to close this but I see two things that still need work:
rickmanelius commentedon Jan 4, 2018
@rfay Updated the issue summary to reflect the additional two todo items. Updated the board status to reflect it's back as WIP.
rfay commentedon Jan 23, 2018
Explicit settings creation is punted to #603 - it doesn't need to be part of this.
The remaining thing is to handle import-files, which has been neglected and needs not to be.
rickmanelius commentedon Jan 31, 2018
Made a few modifications. We're still trying to bust through v1.0.0 due to the Semver commitment, but I tagged this with v1.2.0 because that's where the current roadmap states it belongs and we can cherry pick, bring it in and complete it earlier if time permits.
rickmanelius commentedon Mar 9, 2018
Closing this out because the import-files is now being handled in #666. Settings file creation has also been moved to the WIP issue #692.