aboutsummaryrefslogtreecommitdiff
path: root/manifests/role/dev/drupal7.pp
blob: 852acd34b0d792f7d121d3e7c7be6b298407c942 (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
#
# Class for a Drupal 7 development website
#
class nodo::role::dev::drupal7(
  $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 php::series5
  include database
  include 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-7/sites/default":
  #  ensure => $project_folder,
  #  force  => true,
  #}

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

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

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

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

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

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

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

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

  file { "${::apache::www_folder}/drupal-7/sites/default/libraries":
    ensure  => "${project_folder}/libraries",
    owner   => root,
    group   => root,
    force   => true,
    require => File["${::apache::www_folder}/drupal-7/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-7":
    ensure  => "${::apache::www_folder}/drupal-7",
    require => File["${project_folder}/vendor"],
  }

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

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