Post on 21-Jan-2018
Code DrivenDevelopment in Drupal
ANDRIY YUNDrupal developer, Skilld
Processes & Workflow
DB Driven Development
Something’s wrong, but what?
Productivity after few years
The Goal
Development workflow
+Stable processes of delivery of new features for customer
-Human factor and systematic errors
Deployment to prod by one click
Ability to scale project team
Code Driven Development
What should be moved to code?
- Entity types & fields
- Panels and pages
- Roles & Permissions
- Variables
- Initial content (nodes, taxonomy terms, etc)
Use just the exportable friendly modules
- Views
- Image styles
- Text formats
- Rules
How to use Features module
MANUALS- Bundling site settings using Features https://goo.gl/aijPJT
- Configuration Management with Features http://goo.gl/gat3X7
VIDEO TUTORIALS- Intorduction to Features module https://goo.gl/Jr13O5
- Drupal Features Module https://goo.gl/OQ69TW
- Strongarm module https://goo.gl/z519Wz
Workflow environments
Local environments
Git repository storage (e.g. GitHub/GitLab)
Integration evironment
Build script
Project lifecyclefrom scratch
INITIAL STEPS
- drush dl drupal- copy/paste minimal -> custom- add base set of modules
BUILD
drush site-install customIntegration
environment
Local environment
Profile based way
pre install actions- git pull- delete content file and caches
drop db
drush site install
post install actions- upload translations- import content- frontend build processes
Profile build script
building process
building process
Project lifecycleafter first release
SQL based way
prod_db.sql
git pulldrush updb
git pulldrush updbhook_update_N
custom_deployment.install
pre update actions- git pull
drop current db
upload db from prod
drush updb
post update actions
- registry rebuild- frontend processes- clear cache
SQL build script
prod_db.sql
building process
building process
prod_db.sql
Local devenvs
IntegrationStagePreliveProd
Code review Builds history Tests Sniffers Linters
building process
CodeDrivenDevelopment workflowbuilding process
Typical issues
Using equal environments
Prod = Stage = Integration = Local dev
Code review inside the team
Developers do code review for each other
- Use common approaches for features
- Knowledge exchange inside the team
- Better quality of code
- Increase responsibility for review code
DB manage approach
Use always latest prod db
Preparing prod db for use in development
Daily db backup script from prod
All enviroments should use sinle DB
Profits after using CodeDrivenWorkflow
Fix errors on early phase
Reduce time for bugfixing
Minimizing the impact of the human factor
Simplified everyday deployment
Deployment to prod with Code Driven Development
Continuous Integration tools for Drupal
Self installation solutions
CIbox
https://github.com/propeoplemd/cibox
DrupalCI
https://www.drupal.org/project/drupalci
Code Driven Starter Kithttps://bitbucket.org/deweb-studio/code-driven-starter.kit
Andriy Yun, Kyiv
e-mail: andriy.yun@gmail.com
d.org: drupal.org/u/andriyun
skype: c_cluber
Any questions?