Install
Profiles with Config Devel
(and Ansible)
London Drupal Developers
10 October 2018
Jeni Tehan
Whoami
- Jeni Tehan
- Delicious Creative
- Drupal! 2006-2007ish
Frankie is the best!
1. Jackawawa
2. South Downs
3. Wu-Tang Clan
What are Install
Profiles?
- Preconfigured Drupal sites
- Content types, user roles, menu links
- Starting point, or fully featured site
- Repeatable
- Mostly configuration
Who uses install profiles?
If you use Drupal, you do!
Using install profiles for client sites
- Takes the DB out of development
- Entire site is in code from the start
- Nothing is precious
- Test new approaches and modules
- Worry free migrations
Using install profiles for client sites
- No 'top site'
- 'Top site' is a live site
- Dev is for dev
- Something goes wrong? (it will)
- Rebuild!
Did someone say
"rebuild"?
(I did)
Did someone say
"rebuild"?
- Rebuild/reinstall is necessary
- Don't do it manually!
Reset your site
- Drop the database
- Remove settings file and create a new one ready for Drupal to write to during install
- Clear out files directory, make sure it's empty and writable
- Clear out config directory, make sure it's empty and writable
- Remove twig debugging
Install
- Fill out the form, submit it, yawn...
- Make sure settings.php isn't writable any more
- Set config directory in settings.php
- Additional databases?
Development setup
- Add settings.local.php file
- Set null cache backends
- Additional lines in settings files
- Enable twig debugging
- Enable development modules
Post install
- Enable additional modules (default content)
- Run migrations
- Build search index
- Generate test orders
- Add additional users
Configuration
Development
(Config Devel)
https://www.drupal.org/project/config_devel
Config devel
- Easily export config into your profile's config/install directory
- drush cde profile_name
- Removes stuff like UUIDs for you
- Keeps track of all config needed for your profile
Install Profile Dev
Workflow with
Config Devel
- Click around and do stuff
- Add config to profile info.yml file
- Export config with drush
- Profit!
- Reinstall if you like (or do it on a staging server)
Where's the config?
- Manually get it through the UI (slow)
- Configuration -> Development -> Configuration Synchronization -> Export
- drush cex
- Exports all config
- Export all after install, then you'll see whats new/updated
Where's the config?
- grep it good
- ls -1 config/sync | grep content_type
- Get the knowledge!
Config devel features
- Import a single item
- drush cdi1 path/to/your/config.yml
- Useful for migrations
- Fix weird config that doesn't install
Config devel features
- Import items on each page load
- Add paths to config in UI
- Also useful for migrations
Config devel features
- Import all config from a module
- drush cdi module_name
- Useful to go back to default state
Using config devel is fun!
- As you make chanages, just export again
- New permissions added to role? drush cde
- Tweaked a field display? drush cde
- Edited a view? drush cde
- Dog did a poo on the carpet? BAD DOG!
- Changed module settings? drush cde
All those changes make nice commits
Downsides(?)
- Reinstall wipes it all out
- Default content module
- Clients can't add content during dev
- That's a GOOD thing! It's not a live site
- Profile info file can get messy
- Migrations can take a while
Thank You!
Jeni Tehan
deliciouscreative.com
jeni@deliciouscreative.com
@DelishCreative
jeni_dc
Just one more thing...