Skip to content

Refactor CMS specific logic to make it easier to add/support additional CMSes #535

Closed

Description

@rickmanelius

What happened (or feature request):

  • Feature Request

What you expected to happen:

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.

Anything else do we need to know:

Related source links or issues:

Activity

  1. self-assigned this
    on Nov 20, 2017
  2. rfay commented on Nov 20, 2017

    @rfay
    Member

    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
  3. rfay commented on Nov 20, 2017

    @rfay
    Member

    It looks to me like we could

    • Drop apptype detection (it seems like a hard road for the future). We might try apptype suggestion
    • Add a "don't do anything to settings files" apptype. IMO apptype: "" would be right.
    • Handle settings-files per apptype. We could have a map of apptype to settings-file location and format and do it that way. Tanner had suggested moving settings file management into its own command: Settings.php: Remove automatic creation and make it a separate ddev command #517
    • Consider dropping the file import
  4. rfay commented on Dec 4, 2017

    @rfay
    Member

    Proposal:

    • 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.
    • Create a new settings-file-creation command so that we aren't doing it automatically (and only) on import-db. This would work only for officially supported apptypes. As suggested by @tannerjfco in Settings.php: Remove automatic creation and make it a separate ddev command #517. settings-file-creation would provide callbacks for each supported apptype.
    • 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.
  5. cweagans commented on Dec 4, 2017

    @cweagans
    Contributor

    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.

  6. rickmanelius commented on Dec 15, 2017

    @rickmanelius
    ContributorAuthor

    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?
  7. rickmanelius commented on Dec 26, 2017

    @rickmanelius
    ContributorAuthor

    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.

  8. added a commit that references this issue on Dec 27, 2017
  9. rfay commented on Jan 4, 2018

    @rfay
    Member

    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.
    • 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. (punted to Create explicit ddev command to create settings.php or settings.local.php #603)
  10. rickmanelius commented on Jan 4, 2018

    @rickmanelius
    ContributorAuthor

    @rfay Updated the issue summary to reflect the additional two todo items. Updated the board status to reflect it's back as WIP.

  11. rfay commented on Jan 23, 2018

    @rfay
    Member

    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.

  12. added this to the v1.2.0 milestone on Jan 31, 2018
  13. rickmanelius commented on Jan 31, 2018

    @rickmanelius
    ContributorAuthor

    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.

  14. rickmanelius commented on Mar 9, 2018

    @rickmanelius
    ContributorAuthor

    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.

  15. modified the milestones: v1.2.0, v0.15.0 on Mar 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions