drupal 7 deployment using apache ant. dmitriy svetlichniy
TRANSCRIPT
Drupal 7 Deployment Using Apache Ant
Dmitriy Svetlichniy
http://donetsk.drupal.ua
Drupal Cafe №2. Kharkiv
Dmitriy Svetlichniy
WDG Company
Drupal 7 Deployment Using Apache Ant
Drupal Site Deployment. Problems
Dev site Prod site
ver. 2.0 ver. 1.0
Deployment
Main Deployment Task
DON'T LOSE
current site CONTENT
and modules SETTINGS
(f.e., for Google Analytics module)
Drupal Site Deployment. Problems
Drupal site deployment:
1. Files – SVN, Git, FTP, SSH, etc.2. DB – ?
Dev site Prod site
ver. 2.0 ver. 1.0
files
db
Disclaimer
If YOU have― any suggestions― any commentaries― found bugs
write here in Skype:
svetlichniyd
antonnavi
dovgiy-dmitriy
Problem Solution
Based on strict agreement
of the separating DB tables
into
“settings” “data”
Problem Solution
settings data
dev prod
Step 1
Problem Solution
Step 2
dev
settings data
variable variable
prod
Problem Solution
settings data
variable
devStep 3
Problem Solution
settings data
dev prod
Step 4
Algorithm Implementation
Used technologies:
1) Drupal 7;
2) Apache Ant.
Developed tools:
1)Drupal 7 module “synchro”;
2)Apache Ant script “build.xml”.
Module Interface
Module Interface
Module Interface
Module functionality
Form submit:
Form Data Ant Script
Ant script directory:
[site-path] /sites/default/files/synchro/
Module functionality
Scanning for “variable_set()”
Apache Ant
Installation (for Ubuntu):
sudo apt-get install ant
Apache Ant script structure (build.xml):― XML
―project―property―target
―actions: echo, exec, mkdir...
Ant Script Functionality
Script files:build.xml + .htaccess + compare.php
Main script targets (tasks):–merge_to_dev
–deploy_db
–restore_dev_db
–restore_prod_db
Ant Script Functionality
Target “merge_to_dev” (part 1):–mkdir “backups” and “temp”
–DB structure dumps (using mysqldump)
–compare DB structure (using compare.php)
–compare tables structure (using diff tool)
–DB dumps (using mysqldump)
Ant Script Functionality
Target “merge_to_dev” (part 2):–make settings + data dump (using mysqldump)
–merge setting with data on dev (using mysql)
–make “variable” dump from live (using mysql)
–merge “variable” on dev (using mysql)
–flush dev caches (using get + synchro.module API)
–clean temp folder
Testing Results
Target “merge_to_dev”.
Time of Ant script runnings:
― Testing on initial Drupal site:
―7-8 s― Testing on 10 000 data nodes:
―40-45 s― Testing on 100 000 data nodes:
―230-250 s
Summary
― Problem
― Problem solution
― Solution implementation:
― Drupal 7 module
― Apache Ant script
Helpful Links
You can download module by this link:
drupal.org/sandbox/wdg-company/1324828
http://drupal.org
http://ant.apache.org
http://ant.apache.org/manualhttp://dev.mysql.com/doc/refman/5.1/en/mysqldump.html
http://www.ubuntu.com/download