This project is not covered by Drupal’s security advisory policy.
This is a Drush extension that creates local sites from variables in drush alias files.
This is a simple as posssible wrapper around Drush commands with a few add-ons. It works only on Ubuntu or OSX.
For something more feature-rich and extensible see: http://drupal.org/project/fetcher
Commands
Create or update site
drush @mysite buck
Creates or updates webroot, code, virtual host, /etc/hosts, database and files. It detects if an installation already exists and creates it if it doesn't and updates it if it does. Also fixes permisisons where needed.
Destroy site
drush @mysite buck-destroy
Types of Sites
Buck handles two types of sites.
1) Installation profiles
This requires the following in a alias:
'profile' => 'name of profile',
'makefile' => 'link to makefile',
Optional but helpful:
'site-name' => 'Name of site',
2) "Regular" Drupal sites
This requires the following in a drush alias:
'sync-source' => 'name of alias that this site should sync from',
Required Elements
Buck requires the following elements:
'git' => array(
'url' => '[git url]',
'branch' => '[git branch]',
),
'root' => '[location of site on server]',
'uri' => '[url]',
// Required for "Regular" sites that sync from a non-local source.
'remote-host' => '[CNAME or IP address of remote server]',
'remote-user' => '[Remote server user name]',
'path-aliases' => array(
'%files' => 'sites/default/files',
'%dump-dir' => '/tmp',
),
Optional Elements
'features-revert'
If this is included, selected features will be reverted after install.
Revert all features:
'features_revert' => TRUE,
Revert selected features:
'features_revert' => array('feature1', 'feature2'),
Example Alias
This creates a local version of the DKAN distro:
$aliases['dkan.local'] = array(
'git' => array(
'url' => 'http://git.drupal.org/project/dkan.git',
'branch' => 'master',
),
'root' => '/var/www/dkan',
'makefile' => 'http://drupalcode.org/project/dkan.git/blob_plain/refs/heads/master:/dkan_distro.make',
'profile' => 'dkan',
'uri' => 'dkan.local',
'path-aliases' => array(
'%files' => 'sites/default/files',
'%dump-dir' => '/tmp',
),
);
Dumb Assumptions
If you want to use drush buck-fixperms the use needs to have sudo rights. The fixperms is not required for the rest of the buck functionality. Unfortunately there is not a great way to update or secure file permissions without sudo since if a webserver writes a file it is owned by the webserver user and while you can add yourself to the webserver group to delete or update the file you can't change its permissions.
User who initiates command needs the following permissions:
webadmin ALL = NOPASSWD: /usr/sbin/apachectl
webadmin ALL = NOPASSWD: /usr/sbin/a2ensite
webadmin ALL = NOPASSWD: /usr/sbin/dissite
webadmin ALL = NOPASSWD: /usr/bin/tee -a /etc/hosts
webadmin ALL = NOPASSWD: /bin/sed -i /etc/hosts
User who initiates also needs a local .my.cnf file.
Extending
If you include 'sync-host' you can override the behavior of the sync_files and
sync_database for selected hosts. Include a example.buck.inc file and it will
autload the commands.
See pantheon.buck.inc for an example.
OSX Install
For OSX you need to
1) mkdir /etc/apache2/sites-enabled
2) Change document root in httpd.conf
Change "DocumentRoot" to:
DocumentRoot "/var/www"
Change "" to:
<Directory "/var/www">
3) Add sites-enabled in httpd.conf
Include /etc/apache2/sites-available/*.local
4) Add vhost support
uncomment:
Include /private/etc/apache2/extra/httpd-vhosts.conf
Project information
- Created by acouch on , updated
- This project is not covered by the security advisory policy.
Use at your own risk! It may have publicly disclosed vulnerabilities.