Skip to content
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

Drop database connection information into settings.php file for new codebase #12

Closed
geerlingguy opened this issue Jan 5, 2019 · 1 comment

Comments

@geerlingguy
Copy link
Owner

This way the container can be scaled to more than 1 replica in Kubernetes (see geerlingguy/raspberry-pi-dramble#111), and it can also be replaced and still use an existing database.

Basically, the entrypoint script, if it needs to download the Drupal codebase, should also copy default.settings.php over to settings.php and append environment-variable DB connection information, like:

$databases['default']['default'] = [
  'driver' => 'mysql',
  'database' => getenv('DRUPAL_DATABASE_NAME'),
  'username' => getenv('DRUPAL_DATABASE_USERNAME'),
  'password' => getenv('DRUPAL_DATABASE_PASSWORD'),
  'host' => getenv('DRUPAL_DATABASE_HOST'),
  'port' => getenv('DRUPAL_DATABASE_PORT'),
];

I also need to do a site install and see what else is added to the default settings.php—I think it also drops some sort of encryption key in there. That should be set as an env variable as well, if that's the case, with instructions for how to generate it.

@geerlingguy
Copy link
Owner Author

Got this pretty much working. So much nicer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant