Skip to content

Commit 4a11293

Browse files
committed
Composer, bundler, drush for site install and file permissions fix.
1 parent b075767 commit 4a11293

File tree

13 files changed

+299
-901
lines changed

13 files changed

+299
-901
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
.vagrant
2+
.bundle
23
puppet/modules/*
34
!puppet/modules/README.md
45
puppet/.librarian
56
puppet/.tmp
67
app
78
patches
89
vendor
10+
bin

README.md

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ The VD8 project has been created to make sure developers have an easy method for
1010
* Phing targets.
1111
* Custom packer image to shorten provision time.
1212

13-
## Install
13+
## Requirements
1414

15-
### Virtualbox
15+
### Virtualbox (4.3.6)
1616

1717
Virtualbox can be downloaded and installed from:
1818

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

21-
### Vagrant
21+
### Vagrant (1.3 to 1.5)
2222

2323
Vagrant can be downloaded and installed from:
2424

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

33+
#### Plugins
34+
35+
These are software versions we know work:
36+
37+
* Vagrant Auto-network: 0.2.1
38+
3339
#### Usage
3440

3541
The machine can can be booted by the following command:
@@ -38,7 +44,8 @@ The machine can can be booted by the following command:
3844
vagrant up
3945
```
4046

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

4350
```
4451
vagrant provision
@@ -50,11 +57,7 @@ http://docs.vagrantup.com/v2
5057

5158
## Local DNS
5259

53-
There are many options but the easiest method is to add the following line to your /etc/hosts (or Windows equilent):
54-
55-
```
56-
127.0.0.1 d8.dev
57-
```
60+
WE REQUIRE THE "Vagrant Auto-network" PLUGIN AS MENTIONED ABOVE.
5861

5962
## Drupal
6063

@@ -70,14 +73,5 @@ To install
7073
phing reinstall
7174
```
7275

73-
Now (in your browser) go to the below URL and install Drupal 8:
74-
75-
http://d8.dev:8080/core/install.php
76-
77-
## Versions
78-
79-
These are software versions we know work:
80-
81-
* Vagrant: 1.3.5
82-
* Vagrant Auto-network: 0.2.1
83-
* Virtualbox: 4.3.6
76+
The above command can be run as many times as you like. It provides a good
77+
workflow for developing and testing.

Vagrantfile

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ ram = '1024'
1616
# assigning roles.
1717
# eg. "drupal" => "true" could setup a Drupal site.
1818
facts = {
19-
"fqdn" => hostname + '.' + domain,
19+
'fqdn' => hostname + '.' + domain,
20+
# We set these so we can marry up permissions.
21+
'vagrant_uid' => Process.uid,
22+
'vagrant_group' => 'dialout'
2023
}
2124

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

31-
# Network configured as per bit.ly/1e0ZU1r
32-
config.vm.network :private_network, :ip => "0.0.0.0", :auto_network => true
34+
if Vagrant.has_plugin?('vagrant-auto_network')
35+
# Network configured as per bit.ly/1e0ZU1r
36+
config.vm.network :private_network, :ip => "0.0.0.0", :auto_network => true
37+
else
38+
config.vm.network :private_network, :ip => "192.168.50.10"
39+
end
3340

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

6067
# Provisioners.
6168
config.vm.provision :shell, :path => "puppet/provision.sh"
69+
config.vm.provision :puppet do |puppet|
70+
puppet.facter = facts
71+
puppet.manifests_path = "puppet"
72+
puppet.manifest_file = "site.pp"
73+
puppet.module_path = "puppet/modules"
74+
end
6275
end

build.xml

Lines changed: 74 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,107 @@
11
<!--
22
name: build.xml
3-
description: The main project build file for phing operations. This file can
3+
description: The main project build file for phing operations. This file can
44
be overridden with project specific configuration.
55
-->
66

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

9-
<!-- We set this to optional as is managed by composer -->
10-
<includepath classpath="vendor/nickschuch/drupal-install" />
11-
<import file="vendor/nickschuch/drupal-install/build.xml" optional="true" />
12-
139
<!-- -->
1410
<!-- Properties -->
1511
<!-- ============= -->
1612

17-
<property name="app.uri" value="http://d8.dev" />
18-
<property name="app.installUrl" value="core/install.php" />
19-
20-
<!-- User details. -->
21-
<property name="app.email" value="user@example.com" />
22-
<property name="app.username" value="admin" />
23-
<property name="app.password" value="password" />
24-
25-
<!-- Database options -->
26-
<property name="app.databaseHost" value="d8.dev" />
27-
<property name="app.databasePort" value="3306" />
28-
<property name="app.database" value="d8" />
29-
<property name="app.databaseUser" value="d8" />
30-
<property name="app.databasePass" value="d8" />
13+
<!-- Drupal -->
14+
<property name="drupal.siteName" value="Drupal8" />
15+
<property name="drupal.email" value="user@example.com" />
16+
<property name="drupal.user" value="admin" />
17+
<property name="drupal.pass" value="password" />
18+
<property name="drupal.dir" value="${project.basedir}/app" />
19+
20+
<!-- Mysql -->
21+
<property name="mysql.host" value="d8.dev" />
22+
<property name="mysql.port" value="3306" />
23+
<property name="mysql.database" value="d8" />
24+
<property name="mysql.user" value="d8" />
25+
<property name="mysql.pass" value="d8" />
26+
<property name="mysql.queryString" value="mysql://${mysql.user}:${mysql.pass}@${mysql.host}/${mysql.database}" />
27+
28+
<!-- Drush -->
29+
<property name="drush.cmd" value="bin/drush -r ${drupal.dir}" />
30+
31+
<!-- Vagrant -->
32+
<property name="vagrant.dir" value="/vagrant" />
33+
34+
<!-- Globals for exec commands. The main goal of these were for fast failingin the bot. -->
35+
<property name="test.output" value="true" />
36+
<property name="test.passthru" value="true" />
3137

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

35-
<!-- Build MySQL connection string using properties -->
36-
<property name="app.mysql_connect" value="mysql -u${app.databaseUser} -p${app.databasePass} -h${app.databaseHost} -P${app.databasePort}" />
37-
38-
<!-- -->
39-
<!-- Basic targets -->
40-
<!-- ============= -->
41+
<!-- -->
42+
<!-- Targets -->
43+
<!-- ======= -->
4144

45+
<!-- Prepare the project -->
4246
<target name="prepare"
4347
description="Prepare for build">
44-
<exec command="composer install" />
48+
<exec command="composer install --prefer-dist"
49+
logoutput="${test.output}"
50+
passthru="${test.passthru}" />
4551
</target>
4652

47-
<!-- -->
48-
<!-- Custom targets -->
49-
<!-- ============== -->
53+
<!-- Runs a command in the Vagrant host -->
54+
<target name="vagrant:run"
55+
if="drush.cmd"
56+
description="Run a command in the vagrant host.">
57+
<exec command="vagrant ssh -c '${vagrant.cmd}'"
58+
logoutput="${test.output}"
59+
passthru="${test.passthru}" />
60+
</target>
5061

62+
<!-- Reinstall the Drupal 8 site. -->
5163
<target name="reinstall"
64+
depends="prepare"
5265
description="Reinstall the Drupal 8 site.">
53-
<property name="app.default_site" value="${project.basedir}/app/sites/default" />
54-
5566
<!-- Drop and create the database -->
56-
<exec command="${app.mysql_connect} -e 'DROP DATABASE ${app.database}'" />
57-
<exec command="${app.mysql_connect} -e 'CREATE DATABASE ${app.database}'" />
67+
<exec command="${drush.cmd} sql-drop -y"
68+
logoutput="${test.output}"
69+
passthru="${test.passthru}"/>
5870

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

6276
<!-- Ensure we have a fresh settings.php with correct permissions -->
63-
<exec command="sudo scp ${app.default_site}/default.settings.php ${app.default_site}/settings.php" />
64-
<exec command="sudo chmod 777 ${app.default_site}/settings.php" />
77+
<exec command="sudo scp ${drupal.dir}/sites/default/default.settings.php ${drupal.dir}/sites/default/settings.php"
78+
logoutput="${test.output}"
79+
passthru="${test.passthru}" />
80+
<exec command="sudo chmod 777 ${drupal.dir}/sites/default/settings.php"
81+
logoutput="${test.output}"
82+
passthru="${test.passthru}" />
6583

66-
<!-- Install the site and simpletest module using Mink -->
84+
<!-- Install the site and simpletest -->
6785
<phingcall target="install" />
68-
<phingcall target="enable:simpletest" />
86+
<phingcall target="simpletest:enable" />
87+
</target>
88+
89+
<!-- Install the Drupal 8 site. -->
90+
<target name="install"
91+
description="Install the Drupal 8 site.">
92+
<phingcall target="vagrant:run">
93+
<!-- After some properties for inside the Vagrant host. -->
94+
<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}" />
95+
</phingcall>
96+
</target>
97+
98+
<!-- Enable Simpletest module -->
99+
<target name="simpletest:enable"
100+
description="Enable the Testing module.">
101+
<phingcall target="vagrant:run">
102+
<!-- After some properties for inside the Vagrant host. -->
103+
<property name="vagrant.cmd" value="cd ${vagrant.dir}; bin/drush -r ${vagrant.dir}/app en -y simpletest" />
104+
</phingcall>
69105
</target>
70106

71107
</project>

composer.json

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,9 @@
11
{
2-
"repositories": [
3-
{
4-
"type":"package",
5-
"package": {
6-
"name": "nickschuch/drupal-install",
7-
"version":"master",
8-
"source": {
9-
"url": "git@github.com:nickschuch/phing-drupal-install.git",
10-
"type": "git",
11-
"reference":"0.0.1"
12-
}
13-
}
14-
}
15-
],
162
"require": {
17-
"guzzle/http": "3.7.*",
18-
"guzzle/plugin-cookie": "3.7.*",
19-
"zendframework/zend-feed": "2.2.*",
20-
"behat/mink": "1.4@stable",
21-
"behat/mink-goutte-driver": "*",
22-
"nickschuch/drupal-install": "master"
3+
"drush/drush": "dev-master"
234
},
24-
"minimum-stability": "dev"
5+
"minimum-stability": "dev",
6+
"config": {
7+
"bin-dir": "bin/"
8+
}
259
}

0 commit comments

Comments
 (0)