Skip to content

Create ddev config command #57

Closed
Closed

Description

@beeradb

What happened (or feature request):

Feature Request

What you expected to happen:

We need to develop a ddev config command to create and modify the config.yaml file through the CLI.

How to reproduce it (as minimally and precisely as possible):

As defined in our workflow outline

Check out the git repository and config a ddev site.

$ cd ~/Projects
$ git clone <git-url>/drud-d8.git
$ cd drud-d8 
$ ddev config
Name (drud-d8):
Type [drupal7, drupal8, wordpress]: drupal8
Docroot location: src

Your ddev configuration has been written to .ddev/config.yaml

Reconfigure an existing site

$ pwd
/Users/username/Projects/drud-d8

$ ddev config
Existing configuration detected. Using defaults from /Users/username/Projects/drud-d8/.ddev/config.yaml

Name (drud-d8):
Type [drupal7, drupal8, wordpress] (drupal8):
Docroot location (src): src

Your ddev configuration has been written to .ddev/config.yaml

Deal with bad configuration file.

$ pwd
/Users/username/Projects/drud-d8

$ ddev config
Existing configuration exists at /Users/username/Projects/drud-d8/.ddev/config.yaml but cannot be read. Please delete the file and re-run "ddev config".

Anything else do we need to know:

Part of this is defining a config file spec. Neither the workflow outline documentation nor the existing dcfg work fully account for this.

Proposed from example workflow
$ cat .ddev/config.yaml
---
version: 1
name: drud-d8
type: drupal8
docroot: src
webimage: drud/nginx-php-fpm7:0.1.0
dbimage: drud/mysql-local:5.6-0.1.0
Currently in dcfg PRs
- name: pre-start
  env:
    DEPLOY_URL: $DEPLOY_URL
    DB_HOST: $DB_HOST
    appType: drupal
  tasks:
    - action: template
      app: '{{.appType}}'
      core: 8.x
      siteURL: '{{.DEPLOY_URL}}'
      databaseHost: '{{.DB_HOST}}'
      configPath: docroot/sites/default/
      docroot: docroot
      publicFiles: docroot/sites/default/files

Notes

Neither are a drop-in solution as-is. the DCFG work fails to cover things like container versions or site-name. The example worfklow fails to account for things like public files directories and configpath. Any solution we come up with needs to combine the information contained in both examples.

We also need to keep in mind that a goal here is for advanced users to be able to hand create and edit these files. To that end, simplicity would serve us well.

Questions

  • Can we live with either of these solutions (mostly) as-is?
    • Even if imperfect, does the dcfg PR unblock us for now, realizing we don't have users, and can always revisit the config file structure before a 1.0?
  • Can dcfg currently be intermingled with top-level keys?
    • If so, can we live with the dcfg based approach and a couple top level keys (like site-name)?
  • Whats the level of effort to have dcfg use shared top-level keys?
  • Should configuration of things like docroot be the concern of the ddev tool, or of our containers?
    • If containers, we can do it the same way in-cluster as out of cluster, which is very nice! This comes at the cost of adding overhead (requirements) to anyone wanting to customize a container.
    • If ddev, we potentially need to mirror functionality in several places. However, we simplify our lives by just being able to change the mount point into the containers.

Related source links or issues (like source JIRA issue):

The existing dcfg work is in #24

Activity

  1. added this to the milestone on Mar 10, 2017
  2. rfay commented on Mar 10, 2017

    @rfay
    Member

    Nice job writing this up.

    One key thing I note from trying to follow circle.yml's v2 config changes, is that more complex yaml is hard for naive users. So the difference between lists and objects is really hard. So if we can keep to simple keys like the initial example we'll have less support trouble. It also constrains us pretty badly to a very simple model, and that also sounds problematic.

    This was the "example workflow" above that would be the simple way that people could probably learn and be successful with more quickly.

    version: 1
    name: drud-d8
    type: drupal8
    docroot: src
    webimage: drud/nginx-php-fpm7:0.1.0
    dbimage: drud/mysql-local:5.6-0.1.0
    
  3. rfay commented on Mar 10, 2017

    @rfay
    Member

    Let's not forget both public file path and private file path.

  4. beeradb commented on Mar 10, 2017

    @beeradb
    ContributorAuthor

    We discussed this as a team over google hangouts today. We were able to come to a consensus that for now, we will use the simpler "example workflow" format as-is.

    This means that initially we will only support changing the docroot for all apps, and will not support app-type specific things like configurable publicFiles locations and configPath. We feel that this will address the 90%+ use case, and we can come back at a later date and add configurability for those additional items.

    We will achieve changing the docroot by simply modifying the mount point for the docker containers, so that regardless of what the docroot is within the git checkout, it also gets mounted to /var/www/html

  5. self-assigned this
    on Mar 10, 2017
  6. beeradb commented on Mar 21, 2017

    @beeradb
    ContributorAuthor

    Merged in #63

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions