New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation / Information regarding the Drupal 7 Recipe - drupal:settings #1603

Open
frederickjh opened this Issue May 1, 2018 · 5 comments

Comments

Projects
None yet
2 participants
@frederickjh

frederickjh commented May 1, 2018

Q A
Issue Type Question, Feature Request
Deployer Version master
Local Machine OS N/A
Remote Machine OS N/A

Description

The Drupal 7 recipe includes a drupal:settings task. However how to configure it is not clear even tracing through the history of that file. Originally the configuration was in a secrets.yml file. Then this got moved to the servers.yml file.
I found that in version 5 servers was renamed hosts.

@sergiocarracedo is the developer listed in the recipe, so I am hoping that he or another developer can chime in and provide some information that should really be in the documentation. For me a sample of the configuration file would be enough.
Thanks for your time and help!
Frederick

@sergiocarracedo

This comment has been minimized.

Contributor

sergiocarracedo commented May 1, 2018

Hi @frederickjh, I think drupal:settings still working in version 5, but I will test task in version 5, and create clear documentation.

@frederickjh

This comment has been minimized.

frederickjh commented May 2, 2018

@sergiocarracedo A example hosts file with the secrets in it to create a settings.php would enough for me now to move forward. I can test with that if it helps.

@sergiocarracedo

This comment has been minimized.

Contributor

sergiocarracedo commented May 12, 2018

There was a bug in recipe, it tried to use deployer path to find settings.php template, but that is incorrect.
I created a pull request who contains bugfix #1613

Here is my example deployer config:
host('vagrant') ->port('2222') ->user('vagrant') ->set('deploy_path', '/home/vagrant/deployer') ->set('database.name', 'localhost') ->set('settings_template', __DIR__ . DIRECTORY_SEPARATOR . 'settings.php.template') ->set('settings', [ 'database.name' => 'db_name', 'database.username' => 'db_username', 'database.password' => 'db_password', 'database.host' => 'db_host' ]) ->set('branch', 'master') ->set('drupal_site', $drupal_site) ->stage('vagrant');

And settings.php.template contains:
$databases = array ( 'default' => array ( 'default' => array ( 'database' => '{{database.name}}', 'username' => '{{database.username}}', 'password' => '{{database.password}}', 'host' => '{{database.host}}', 'port' => '', 'driver' => 'mysql', 'prefix' => '', ), ), );
Full content https://pastebin.com/4UiRcN6D

You can set other variables in settings array and set {{variablename}} in settings.php

@sergiocarracedo

This comment has been minimized.

Contributor

sergiocarracedo commented May 12, 2018

Merged! #1613

@frederickjh

This comment has been minimized.

frederickjh commented May 14, 2018

Thanks @sergiocarracedo!

Here are the examples with formatting.

example deployer config:

host('vagrant')
     ->port('2222')
    ->user('vagrant')
    ->set('deploy_path', '/home/vagrant/deployer')
    ->set('database.name', 'localhost')
    ->set('settings_template', __DIR__ . DIRECTORY_SEPARATOR . 'settings.php.template')
    ->set('settings', [ 
    'database.name' => 'db_name',
    'database.username' => 'db_username',
    'database.password' => 'db_password',
    'database.host' => 'db_host'
    ])
    ->set('branch',
    'master')
    ->set('drupal_site', $drupal_site) ->stage('vagrant');

database array from settings.php.template

$databases = array (
  'default' =>
    array (
      'default' =>
        array (
          'database' => '{{database.name}}',
          'username' => '{{database.username}}',
          'password' => '{{database.password}}',
          'host' => '{{database.host}}',
          'port' => '',
          'driver' => 'mysql',
          'prefix' => '',
        ),
    ),
);

This should get tagged to be added to the non-existent documentation for the included recipes.

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