aboutsummaryrefslogtreecommitdiff
path: root/manifests/role/dev/drupal6.pp
blob: c2f32e0e670503dc44e676236eb17ebd847e5be6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
#
# Class for a Drupal 6 development website
#
class nodo::role::dev::drupal6(
  $project        = 'drupal',
  $project_folder = '/srv/shared', # '/vagrant', '/srv/kvmx'
  $project_user   = 'user',        # 'vagrant'
  $db_name        = 'drupal',
  $db_password    = 'hackme',
) {
  include nodo::role::dev::virtual
  include apache
  include nodo::utils::development::web
  include nodo::utils::development::php
  include database
  include drupal

  class { 'php':
    series         => [ '5' ],
    default_cli    => '5',
    manage_mod_php => '5',
  }

  # Ensure we have an 6.x instance
  exec { 'drupal-download-6.x':
    command => '/usr/local/bin/drupal download 6',
    user    => "root",
    creates => '/var/www/data/drupal-6',
    require => File['/usr/local/bin/drupal'],
  }

  # In case you want to use sqlite3 db
  package { 'sqlite3':
    ensure => installed,
  }

  # In case you use makefiles
  package { 'make':
    ensure => present,
  }

  # Do not use this password on production machines
  database::instance { $db_name:
    password => $db_password,
  }

  # We could simply using one symlink, but it might incur in
  # performance penalties by drush recursivelly searching for
  # plugins in the whole project tree.
  #file { "${::apache::www_folder}/drupal-6/sites/default":
  #  ensure => $project_folder,
  #  force  => true,
  #}

  #file { "${::apache::www_folder}/drupal-6/sites/${project}":
  #  ensure => $project_folder,
  #  force  => true,
  #}

  file { "${::apache::www_folder}/drupal-6/sites/default":
    ensure  => directory,
    owner   => root,
    group   => root,
    mode    => '0755',
    require => Exec['drupal-download-6.x'],
    force   => true,
  }

  file { "${::apache::www_folder}/drupal-6/sites/${project}":
    ensure  => "${::apache::www_folder}/drupal-6/sites/default",
    force   => true,
    require => File["${::apache::www_folder}/drupal-6/sites/default"],
  }

  file { "${::apache::www_folder}/drupal-6/sites/default/settings.php":
    ensure  => "${project_folder}/settings.php",
    owner   => root,
    group   => root,
    force   => true,
    require => File["${::apache::www_folder}/drupal-6/sites/default"],
  }

  file { "${::apache::www_folder}/drupal-6/sites/default/files":
    ensure  => "${project_folder}/files",
    owner   => root,
    group   => root,
    force   => true,
    require => File["${::apache::www_folder}/drupal-6/sites/default"],
  }

  file { "${::apache::www_folder}/drupal-6/sites/default/themes":
    ensure  => "${project_folder}/themes",
    owner   => root,
    group   => root,
    force   => true,
    require => File["${::apache::www_folder}/drupal-6/sites/default"],
  }

  file { "${::apache::www_folder}/drupal-6/sites/default/modules":
    ensure  => "${project_folder}/modules",
    owner   => root,
    group   => root,
    force   => true,
    require => File["${::apache::www_folder}/drupal-6/sites/default"],
  }

  file { "${::apache::www_folder}/drupal-6/sites/default/libraries":
    ensure  => "${project_folder}/libraries",
    owner   => root,
    group   => root,
    force   => true,
    require => File["${::apache::www_folder}/drupal-6/sites/default"],
  }

  file { "${project_folder}":
    ensure => directory,
    owner  => $project_user,
    group  => $project_user,
    mode   => '0755',
  }

  file { "${project_folder}/vendor":
    ensure  => directory,
    owner   => $project_user,
    group   => $project_user,
    mode    => '0755',
    require => File["${project_folder}"],
  }

  # Symlink to aid development
  file { "${project_folder}/vendor/drupal-6":
    ensure  => "${::apache::www_folder}/drupal-6",
    require => File["${project_folder}/vendor"],
  }

  apache::site { "localhost":
    ensure => absent,
  }

  apache::site { "${project}":
    ensure         => present,
    docroot        => "${::apache::www_folder}/drupal-6",
    server_alias   => "localhost ${project} ${project}.localhost ${project}.local",
    mpm_user       => $project_user,
    mpm_group      => $project_user,
    manage_user    => false,
    manage_docroot => false,
    use            => [ 'Drupal 6' ],
    require        => Exec['drupal-download-6.x'],
  }
}