Skip to content

Commit

Permalink
Composer, bundler, drush for site install and file permissions fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
nickschuch committed May 31, 2014
1 parent b075767 commit 4a11293
Show file tree
Hide file tree
Showing 13 changed files with 299 additions and 901 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
.vagrant
.bundle
puppet/modules/*
!puppet/modules/README.md
puppet/.librarian
puppet/.tmp
app
patches
vendor
bin
34 changes: 14 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ The VD8 project has been created to make sure developers have an easy method for
* Phing targets.
* Custom packer image to shorten provision time.

## Install
## Requirements

### Virtualbox
### Virtualbox (4.3.6)

Virtualbox can be downloaded and installed from:

https://www.virtualbox.org/wiki/Downloads

### Vagrant
### Vagrant (1.3 to 1.5)

Vagrant can be downloaded and installed from:

Expand All @@ -30,6 +30,12 @@ This also required the autonetwork plugin which can be installed by:
vagrant plugin install vagrant-auto_network
```

#### Plugins

These are software versions we know work:

* Vagrant Auto-network: 0.2.1

#### Usage

The machine can can be booted by the following command:
Expand All @@ -38,7 +44,8 @@ The machine can can be booted by the following command:
vagrant up
```

The host will be provisioned with the Puppet manifest by running the following command:
The host will be provisioned automatically on the first `vagrant up`. If you
wish to rerun the provision that can be done with the following command:

```
vagrant provision
Expand All @@ -50,11 +57,7 @@ http://docs.vagrantup.com/v2

## Local DNS

There are many options but the easiest method is to add the following line to your /etc/hosts (or Windows equilent):

```
127.0.0.1 d8.dev
```
WE REQUIRE THE "Vagrant Auto-network" PLUGIN AS MENTIONED ABOVE.

## Drupal

Expand All @@ -70,14 +73,5 @@ To install
phing reinstall
```

Now (in your browser) go to the below URL and install Drupal 8:

http://d8.dev:8080/core/install.php

## Versions

These are software versions we know work:

* Vagrant: 1.3.5
* Vagrant Auto-network: 0.2.1
* Virtualbox: 4.3.6
The above command can be run as many times as you like. It provides a good
workflow for developing and testing.
19 changes: 16 additions & 3 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ ram = '1024'
# assigning roles.
# eg. "drupal" => "true" could setup a Drupal site.
facts = {
"fqdn" => hostname + '.' + domain,
'fqdn' => hostname + '.' + domain,
# We set these so we can marry up permissions.
'vagrant_uid' => Process.uid,
'vagrant_group' => 'dialout'
}

##
Expand All @@ -28,8 +31,12 @@ Vagrant.configure("2") do |config|
config.vm.hostname = hostname + '.' + domain
config.vm.box_url = url

# Network configured as per bit.ly/1e0ZU1r
config.vm.network :private_network, :ip => "0.0.0.0", :auto_network => true
if Vagrant.has_plugin?('vagrant-auto_network')
# Network configured as per bit.ly/1e0ZU1r
config.vm.network :private_network, :ip => "0.0.0.0", :auto_network => true
else
config.vm.network :private_network, :ip => "192.168.50.10"
end

# We want to cater for both Unix and Windows.
if RUBY_PLATFORM =~ /linux|darwin/
Expand Down Expand Up @@ -59,4 +66,10 @@ Vagrant.configure("2") do |config|

# Provisioners.
config.vm.provision :shell, :path => "puppet/provision.sh"
config.vm.provision :puppet do |puppet|
puppet.facter = facts
puppet.manifests_path = "puppet"
puppet.manifest_file = "site.pp"
puppet.module_path = "puppet/modules"
end
end
112 changes: 74 additions & 38 deletions build.xml
Original file line number Diff line number Diff line change
@@ -1,71 +1,107 @@
<!--
name: build.xml
description: The main project build file for phing operations. This file can
description: The main project build file for phing operations. This file can
be overridden with project specific configuration.
-->

<project name="vd8" default="prepare" phingVersion="2.4.11">

<!-- We set this to optional as is managed by composer -->
<includepath classpath="vendor/nickschuch/drupal-install" />
<import file="vendor/nickschuch/drupal-install/build.xml" optional="true" />

<!-- -->
<!-- Properties -->
<!-- ============= -->

<property name="app.uri" value="http://d8.dev" />
<property name="app.installUrl" value="core/install.php" />

<!-- User details. -->
<property name="app.email" value="user@example.com" />
<property name="app.username" value="admin" />
<property name="app.password" value="password" />

<!-- Database options -->
<property name="app.databaseHost" value="d8.dev" />
<property name="app.databasePort" value="3306" />
<property name="app.database" value="d8" />
<property name="app.databaseUser" value="d8" />
<property name="app.databasePass" value="d8" />
<!-- Drupal -->
<property name="drupal.siteName" value="Drupal8" />
<property name="drupal.email" value="user@example.com" />
<property name="drupal.user" value="admin" />
<property name="drupal.pass" value="password" />
<property name="drupal.dir" value="${project.basedir}/app" />

<!-- Mysql -->
<property name="mysql.host" value="d8.dev" />
<property name="mysql.port" value="3306" />
<property name="mysql.database" value="d8" />
<property name="mysql.user" value="d8" />
<property name="mysql.pass" value="d8" />
<property name="mysql.queryString" value="mysql://${mysql.user}:${mysql.pass}@${mysql.host}/${mysql.database}" />

<!-- Drush -->
<property name="drush.cmd" value="bin/drush -r ${drupal.dir}" />

<!-- Vagrant -->
<property name="vagrant.dir" value="/vagrant" />

<!-- Globals for exec commands. The main goal of these were for fast failingin the bot. -->
<property name="test.output" value="true" />
<property name="test.passthru" value="true" />

<!-- Provide overrides. -->
<property file="build.properties" override="true" />

<!-- Build MySQL connection string using properties -->
<property name="app.mysql_connect" value="mysql -u${app.databaseUser} -p${app.databasePass} -h${app.databaseHost} -P${app.databasePort}" />

<!-- -->
<!-- Basic targets -->
<!-- ============= -->
<!-- -->
<!-- Targets -->
<!-- ======= -->

<!-- Prepare the project -->
<target name="prepare"
description="Prepare for build">
<exec command="composer install" />
<exec command="composer install --prefer-dist"
logoutput="${test.output}"
passthru="${test.passthru}" />
</target>

<!-- -->
<!-- Custom targets -->
<!-- ============== -->
<!-- Runs a command in the Vagrant host -->
<target name="vagrant:run"
if="drush.cmd"
description="Run a command in the vagrant host.">
<exec command="vagrant ssh -c '${vagrant.cmd}'"
logoutput="${test.output}"
passthru="${test.passthru}" />
</target>

<!-- Reinstall the Drupal 8 site. -->
<target name="reinstall"
depends="prepare"
description="Reinstall the Drupal 8 site.">
<property name="app.default_site" value="${project.basedir}/app/sites/default" />

<!-- Drop and create the database -->
<exec command="${app.mysql_connect} -e 'DROP DATABASE ${app.database}'" />
<exec command="${app.mysql_connect} -e 'CREATE DATABASE ${app.database}'" />
<exec command="${drush.cmd} sql-drop -y"
logoutput="${test.output}"
passthru="${test.passthru}"/>

<!-- Ensure the files directory is clean -->
<exec command="sudo rm -fR ${app.default_site}/files/*" />
<exec command="sudo rm -fR ${drupal.dir}/sites/default/files/*"
logoutput="${test.output}"
passthru="${test.passthru}" />

<!-- Ensure we have a fresh settings.php with correct permissions -->
<exec command="sudo scp ${app.default_site}/default.settings.php ${app.default_site}/settings.php" />
<exec command="sudo chmod 777 ${app.default_site}/settings.php" />
<exec command="sudo scp ${drupal.dir}/sites/default/default.settings.php ${drupal.dir}/sites/default/settings.php"
logoutput="${test.output}"
passthru="${test.passthru}" />
<exec command="sudo chmod 777 ${drupal.dir}/sites/default/settings.php"
logoutput="${test.output}"
passthru="${test.passthru}" />

<!-- Install the site and simpletest module using Mink -->
<!-- Install the site and simpletest -->
<phingcall target="install" />
<phingcall target="enable:simpletest" />
<phingcall target="simpletest:enable" />
</target>

<!-- Install the Drupal 8 site. -->
<target name="install"
description="Install the Drupal 8 site.">
<phingcall target="vagrant:run">
<!-- After some properties for inside the Vagrant host. -->
<property name="vagrant.cmd" value="cd ${vagrant.dir}; bin/drush -r ${vagrant.dir}/app site-install -y --db-url=${mysql.queryString} --account-mail=${drupal.email} --account-name=${drupal.user} --account-pass=${drupal.pass} --site-name=${drupal.siteName}" />
</phingcall>
</target>

<!-- Enable Simpletest module -->
<target name="simpletest:enable"
description="Enable the Testing module.">
<phingcall target="vagrant:run">
<!-- After some properties for inside the Vagrant host. -->
<property name="vagrant.cmd" value="cd ${vagrant.dir}; bin/drush -r ${vagrant.dir}/app en -y simpletest" />
</phingcall>
</target>

</project>
26 changes: 5 additions & 21 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,9 @@
{
"repositories": [
{
"type":"package",
"package": {
"name": "nickschuch/drupal-install",
"version":"master",
"source": {
"url": "git@github.com:nickschuch/phing-drupal-install.git",
"type": "git",
"reference":"0.0.1"
}
}
}
],
"require": {
"guzzle/http": "3.7.*",
"guzzle/plugin-cookie": "3.7.*",
"zendframework/zend-feed": "2.2.*",
"behat/mink": "1.4@stable",
"behat/mink-goutte-driver": "*",
"nickschuch/drupal-install": "master"
"drush/drush": "dev-master"
},
"minimum-stability": "dev"
"minimum-stability": "dev",
"config": {
"bin-dir": "bin/"
}
}
Loading

0 comments on commit 4a11293

Please sign in to comment.