aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--manifests/role/dev/drupal9.pp142
-rw-r--r--manifests/role/dev/drupal9/base.pp75
-rw-r--r--manifests/role/dev/drupal9/composer.pp49
3 files changed, 266 insertions, 0 deletions
diff --git a/manifests/role/dev/drupal9.pp b/manifests/role/dev/drupal9.pp
new file mode 100644
index 0000000..ca26101
--- /dev/null
+++ b/manifests/role/dev/drupal9.pp
@@ -0,0 +1,142 @@
+#
+# Class for a Drupal 9 development website
+#
+class nodo::role::dev::drupal9(
+ $project = 'drupal',
+ $project_folder = '/srv/shared', # '/vagrant', '/srv/kvmx'
+ $project_user = 'user', # 'vagrant'
+ $db_name = 'drupal',
+ $db_password = 'hackme',
+) {
+ include nodo::role::dev::drupal9::base
+
+ # 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-9/sites/default":
+ # ensure => $project_folder,
+ # force => true,
+ #}
+
+ #file { "${::apache::www_folder}/drupal-9/sites/${project}":
+ # ensure => $project_folder,
+ # force => true,
+ #}
+
+ file { "${::apache::www_folder}/drupal-9/sites/default":
+ ensure => directory,
+ owner => root,
+ group => root,
+ mode => '0755',
+ require => Exec['drupal-download-9.x'],
+ force => true,
+ }
+
+ file { "${::apache::www_folder}/drupal-9/sites/${project}":
+ ensure => "${::apache::www_folder}/drupal-9/sites/default",
+ force => true,
+ require => File["${::apache::www_folder}/drupal-9/sites/default"],
+ }
+
+ file { "${::apache::www_folder}/drupal-9/sites/default/settings.php":
+ ensure => "${project_folder}/settings.php",
+ owner => root,
+ group => root,
+ force => true,
+ require => File["${::apache::www_folder}/drupal-9/sites/default"],
+ }
+
+ file { "${::apache::www_folder}/drupal-9/sites/default/settings.local.php":
+ ensure => "${project_folder}/settings.local.php",
+ owner => root,
+ group => root,
+ force => true,
+ require => File["${::apache::www_folder}/drupal-9/sites/default"],
+ }
+
+ file { "${::apache::www_folder}/drupal-9/sites/default/services.yml":
+ ensure => "${project_folder}/services.yml",
+ owner => root,
+ group => root,
+ force => true,
+ require => File["${::apache::www_folder}/drupal-9/sites/default"],
+ }
+
+ file { "${::apache::www_folder}/drupal-9/sites/default/files":
+ ensure => "${project_folder}/files",
+ owner => root,
+ group => root,
+ force => true,
+ require => File["${::apache::www_folder}/drupal-9/sites/default"],
+ }
+
+ file { "${::apache::www_folder}/drupal-9/sites/default/config":
+ ensure => "${project_folder}/config",
+ owner => root,
+ group => root,
+ force => true,
+ require => File["${::apache::www_folder}/drupal-9/sites/default"],
+ }
+
+ file { "${::apache::www_folder}/drupal-9/sites/default/themes":
+ ensure => "${project_folder}/themes",
+ owner => root,
+ group => root,
+ force => true,
+ require => File["${::apache::www_folder}/drupal-9/sites/default"],
+ }
+
+ file { "${::apache::www_folder}/drupal-9/sites/default/modules":
+ ensure => "${project_folder}/modules",
+ owner => root,
+ group => root,
+ force => true,
+ require => File["${::apache::www_folder}/drupal-9/sites/default"],
+ }
+
+ file { "${::apache::www_folder}/drupal-9/sites/default/libraries":
+ ensure => "${project_folder}/libraries",
+ owner => root,
+ group => root,
+ force => true,
+ require => File["${::apache::www_folder}/drupal-9/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-9":
+ ensure => "${::apache::www_folder}/drupal-9",
+ require => File["${project_folder}/vendor"],
+ }
+
+ apache::site { "${project}":
+ ensure => present,
+ docroot => "${::apache::www_folder}/drupal-9",
+ server_alias => "localhost ${project} ${project}.localhost ${project}.local",
+ mpm_user => $project_user,
+ mpm_group => $project_user,
+ manage_user => false,
+ manage_docroot => false,
+ use => [ 'Drupal 9' ],
+ require => Exec['drupal-download-9.x'],
+ }
+}
diff --git a/manifests/role/dev/drupal9/base.pp b/manifests/role/dev/drupal9/base.pp
new file mode 100644
index 0000000..74d1775
--- /dev/null
+++ b/manifests/role/dev/drupal9/base.pp
@@ -0,0 +1,75 @@
+#
+# Base Class for a Drupal 9 development website
+#
+class nodo::role::dev::drupal9::base {
+ include nodo::role::dev::virtual
+ include apache
+ include nodo::utils::development::web
+ include nodo::utils::development::php
+
+ class { 'php':
+ series => [ '7' ],
+ manage_mod_php => '7',
+ }
+
+ $php_version = $::php::params::version7
+
+ include database
+ include drupal
+ include php::composer
+
+ # In case you want to use sqlite3 db
+ package { 'sqlite3':
+ ensure => installed,
+ }
+
+ # In case you use makefiles
+ package { 'make':
+ ensure => present,
+ }
+
+ # Xdebug config
+ # https://www.drupal.org/node/2488300
+ #file { '/etc/php5/apache2/conf.d/20-xdebug-levels.ini':
+ #file { '/etc/php/5.6/apache2/conf.d/20-xdebug-levels.ini':
+ #file { '/etc/php/7.0/apache2/conf.d/20-xdebug-levels.ini':
+ file { "/etc/php/${php_version}/apache2/conf.d/20-xdebug-levels.ini":
+ ensure => present,
+ owner => 'root',
+ group => 'root',
+ mode => '0644',
+ content => "[xdebug]\nxdebug.max_nesting_level=256\n",
+ require => Package['php'],
+ notify => Service['apache2'],
+ }
+
+ # Fix previous typo error
+ file { [ '/etc/php/7.2/mods-available/20-xdebug-levels.ini' ]:
+ ensure => absent,
+ }
+
+ #file { "/etc/php/${php_version}/apache2/conf.d/20-max-execution-time.ini":
+ # ensure => present,
+ # owner => 'root',
+ # group => 'root',
+ # mode => '0644',
+ # content => "max_execution_time=120\n",
+ # require => Package['php'],
+ # notify => Service['apache2'],
+ #}
+
+ #file { "/etc/php/${php_version}/apache2/conf.d/20-memory-limit.ini":
+ # ensure => present,
+ # owner => 'root',
+ # group => 'root',
+ # mode => '0644',
+ # content => "memory_limit=512M\n",
+ # require => Package['php'],
+ # notify => Service['apache2'],
+ #}
+
+ #apache::site { [ "localhost", "default", "000-default" ]:
+ apache::site { "localhost":
+ ensure => absent,
+ }
+}
diff --git a/manifests/role/dev/drupal9/composer.pp b/manifests/role/dev/drupal9/composer.pp
new file mode 100644
index 0000000..c705f6b
--- /dev/null
+++ b/manifests/role/dev/drupal9/composer.pp
@@ -0,0 +1,49 @@
+#
+# Class for a Drupal 9 development website using drupal-composer
+#
+class nodo::role::dev::drupal9::composer(
+ $project = 'drupal',
+ $project_folder = '/srv/shared', # '/vagrant', '/srv/kvmx'
+ $project_user = 'user', # 'vagrant'
+ $db_name = 'drupal',
+ $db_password = 'hackme',
+) {
+ include nodo::role::dev::drupal9::base
+
+ # Do not use this password on production machines
+ database::instance { $db_name:
+ password => $db_password,
+ }
+
+ apache::site { "${project}":
+ ensure => present,
+ docroot => "${project_folder}/web",
+ server_alias => "localhost ${project} ${project}.localhost ${project}.local",
+ mpm_user => $project_user,
+ mpm_group => $project_user,
+ manage_user => false,
+ manage_docroot => false,
+ custom_directives => "
+ <Directory ${project_folder}/web>
+ Options Indexes Includes FollowSymLinks MultiViews
+ AllowOverride All
+ Require all granted
+ </Directory>",
+ }
+
+ file { [ "${project_folder}/web/sites", "${project_folder}/web/sites/default" ]:
+ ensure => directory,
+ owner => root,
+ group => root,
+ mode => '0755',
+ force => true,
+ }
+
+ #file { "${project_folder}/web/sites/default/settings.local.php":
+ # ensure => present,
+ # owner => root,
+ # group => root,
+ # force => true,
+ # require => File["${project_folder}/web/sites/default"],
+ #}
+}