diff --git a/Puppetfile b/Puppetfile index 95ec8cd..b95761f 100644 --- a/Puppetfile +++ b/Puppetfile @@ -8,19 +8,27 @@ mod 'puppetlabs-vcsrepo' mod 'puppetlabs-mysql' mod 'puppetlabs-gcc' mod 'puppetlabs-apt' -mod 'puppetlabs-nodejs', '0.8.0' -mod 'puppet-php', '4.0.0' +mod 'puppet-php' -mod 'maestrodev-wget' +mod 'puppet-wget' mod 'saz-memcached' mod 'rodjek-logrotate' -mod 'zivtech-drupal_php' -mod 'zivtech-drupal_solr' mod 'zivtech-drush_fetcher' -mod 'zivtech-drush', '1.4.0' - +# todo: release version +mod 'zivtech-drupal_php', + :git => 'git@github.com:zivtech/puppet-drupal-php.git', + :ref => 'feature/1804-support' +# todo: release version +mod 'zivtech-drupal_solr', + :git => 'git@github.com:zivtech/puppet-drupal-solr.git', + :ref => 'feature/1804-support' +# todo: release version +mod 'zivtech-drush', + :git => 'git@github.com:zivtech/puppet-drush.git', + :ref => 'feature/concat-module-updates' +# todo: release version mod 'zivtech-webadmin', :git => 'git://github.com/zivtech/puppet-webadmin.git', - :ref => 'master' + :ref => 'feature/ubuntu-1804' diff --git a/Puppetfile.lock b/Puppetfile.lock index fcd9b37..865ff1a 100644 --- a/Puppetfile.lock +++ b/Puppetfile.lock @@ -1,84 +1,95 @@ FORGE remote: https://forge.puppet.com specs: - darin-zypprepo (1.0.2) - example42-puppi (2.2.3) - puppetlabs-stdlib (< 5.0.0, >= 3.2.0) - example42-yum (2.1.28) - example42-puppi (>= 2.0.0) - maestrodev-wget (1.7.3) - puppet-archive (1.3.0) - puppetlabs-stdlib (< 5.0.0, >= 4.6.0) - puppet-php (4.0.0) - darin-zypprepo (< 2.0.0, >= 1.0.2) - example42-yum (< 3.0.0, >= 2.1.28) - puppet-archive (< 2.0.0, >= 1.0.0) - puppetlabs-apt (< 3.0.0, >= 2.1.0) - puppetlabs-inifile (< 2.0.0, >= 1.4.1) - puppetlabs-stdlib (< 5.0.0, >= 4.6.0) - puppet-staging (2.2.0) - puppetlabs-apache (1.11.0) - puppetlabs-concat (< 3.0.0, >= 1.1.1) - puppetlabs-stdlib (< 5.0.0, >= 4.2.0) - puppetlabs-apt (2.3.0) - puppetlabs-stdlib (< 5.0.0, >= 4.5.0) - puppetlabs-concat (2.2.0) - puppetlabs-stdlib (< 5.0.0, >= 4.2.0) - puppetlabs-firewall (1.8.2) + puppet-archive (3.2.1) + puppetlabs-stdlib (< 6.0.0, >= 4.13.1) + puppet-php (6.0.2) + puppet-archive (< 4.0.0, >= 1.0.0) + puppet-zypprepo (< 3.0.0, >= 2.0.0) + puppetlabs-apt (< 7.0.0, >= 4.4.0) + puppetlabs-inifile (< 3.0.0, >= 1.4.1) + puppetlabs-stdlib (< 6.0.0, >= 4.16.0) + puppet-wget (2.0.1) + puppet-zypprepo (2.2.2) + puppetlabs-apache (3.5.0) + puppetlabs-concat (< 6.0.0, >= 2.2.1) + puppetlabs-stdlib (< 6.0.0, >= 4.13.1) + puppetlabs-apt (6.2.1) + puppetlabs-stdlib (< 6.0.0, >= 4.16.0) + puppetlabs-translate (< 2.0.0, >= 1.0.0) + puppetlabs-concat (5.2.0) + puppetlabs-stdlib (< 6.0.0, >= 4.13.1) + puppetlabs-translate (< 2.0.0, >= 1.0.0) + puppetlabs-firewall (1.14.0) + puppetlabs-stdlib (< 6.0.0, >= 4.0.0) puppetlabs-gcc (0.3.0) puppetlabs-stdlib (< 5.0.0, >= 2.0.0) puppetlabs-git (0.5.0) puppetlabs-stdlib (>= 3.2.0) - puppetlabs-inifile (1.6.0) - puppetlabs-mysql (3.10.0) - puppet-staging (< 3.0.0, >= 1.0.1) - puppetlabs-stdlib (< 5.0.0, >= 3.2.0) - puppetlabs-nodejs (0.8.0) - puppetlabs-stdlib (< 5.0.0, >= 2.2.1) - puppetlabs-stdlib (4.16.0) - puppetlabs-vcsrepo (1.5.0) + puppetlabs-inifile (2.5.0) + puppetlabs-translate (< 2.0.0, >= 1.0.0) + puppetlabs-mysql (7.0.0) + puppetlabs-stdlib (< 6.0.0, >= 3.2.0) + puppetlabs-translate (< 2.0.0, >= 1.0.0) + puppetlabs-stdlib (4.25.1) + puppetlabs-translate (1.2.0) + puppetlabs-vcsrepo (2.4.0) rodjek-logrotate (1.1.1) - saz-memcached (3.0.1) + saz-memcached (3.3.0) puppetlabs-firewall (< 2.0.0, >= 0.1.0) - puppetlabs-stdlib (< 6.0.0, >= 4.6.0) - zivtech-drupal_php (5.0.0) - puppet-php (>= 4.0.0) - puppetlabs-apache (>= 1.10.0) - puppetlabs-stdlib (>= 1.0.0) - zivtech-drupal_solr (4.0.1) - zivtech-zivtech_apt (>= 0.0.0) - zivtech-drush (1.4.0) - puppetlabs-concat (>= 1.0.0) - puppetlabs-stdlib (>= 1.0.0) - puppetlabs-vcsrepo (>= 0.0.0) - zivtech-drupal_php (>= 3.4.1) + puppetlabs-stdlib (< 6.0.0, >= 4.13.1) zivtech-drush_fetcher (1.0.3) puppetlabs-stdlib (>= 1.0.0) zivtech-drush (>= 0.0.0) - zivtech-zivtech_apt (0.0.0) - puppetlabs-apt (< 3.0.0, >= 1.8.0) GIT remote: git://github.com/zivtech/puppet-webadmin.git - ref: master - sha: 248ac5180b06f9e7bfe6ac2d1026e1a581ab8399 + ref: feature/ubuntu-1804 + sha: 57bfcd6d5b7bcc72b48e208ca172e7f83edcd59f specs: zivtech-webadmin (0.0.1) +GIT + remote: git@github.com:zivtech/puppet-drupal-php.git + ref: feature/1804-support + sha: af4d5dc85e9298fc27bc59a39e3d73d9d41fa33f + specs: + zivtech-drupal_php (5.0.1) + puppet-php (>= 4.0.0) + puppetlabs-apache (>= 1.10.0) + puppetlabs-stdlib (>= 1.0.0) + +GIT + remote: git@github.com:zivtech/puppet-drupal-solr.git + ref: feature/1804-support + sha: db8e02e34048b1890d3099bbdbf2742d6eb89b12 + specs: + zivtech-drupal_solr (4.0.1) + +GIT + remote: git@github.com:zivtech/puppet-drush.git + ref: feature/concat-module-updates + sha: 817e8b2d2ef864f3df3936f326ab66b95dc767a7 + specs: + zivtech-drush (1.4.0) + puppetlabs-concat (>= 1.0.0) + puppetlabs-stdlib (>= 1.0.0) + puppetlabs-vcsrepo (>= 0) + zivtech-drupal_php (>= 3.4.1) + DEPENDENCIES - maestrodev-wget (>= 0) - puppet-php (= 4.0.0) + puppet-php (>= 0) + puppet-wget (>= 0) puppetlabs-apt (>= 0) puppetlabs-gcc (>= 0) puppetlabs-git (>= 0) puppetlabs-mysql (>= 0) - puppetlabs-nodejs (= 0.8.0) puppetlabs-vcsrepo (>= 0) rodjek-logrotate (>= 0) saz-memcached (>= 0) zivtech-drupal_php (>= 0) zivtech-drupal_solr (>= 0) - zivtech-drush (= 1.4.0) + zivtech-drush (>= 0) zivtech-drush_fetcher (>= 0) zivtech-webadmin (>= 0) diff --git a/Vagrantfile b/Vagrantfile index b61e5cd..563caee 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -39,6 +39,7 @@ Vagrant.configure('2') do |config| config.vm.box = params['box'] config.vm.box_url = params['box_url'] + config.vm.box_version = params['box_version'] config.ssh.forward_agent = true diff --git a/custom-modules/mailhog/manifests/init.pp b/custom-modules/mailhog/manifests/init.pp index c56595c..d494fc3 100644 --- a/custom-modules/mailhog/manifests/init.pp +++ b/custom-modules/mailhog/manifests/init.pp @@ -1,5 +1,7 @@ class mailhog { + $php_version = $::php::globals::php_version + package { 'postfix': ensure => 'absent', }-> @@ -67,13 +69,13 @@ file_line { 'mhsendmail php.ini': ensure => present, - path => '/etc/php/7.1/fpm/php.ini', + path => "/etc/php/${php_version}/fpm/php.ini", line => 'sendmail_path = /usr/local/bin/mhsendmail', match => '^;?sendmail_path', require => Class['drupal_php::fpm'], notify => [ Service['httpd'], - Service['php7.1-fpm'], + Service["php${php_version}-fpm"], Class['::php::fpm::service'], ], } diff --git a/custom-modules/nvm/manifests/init.pp b/custom-modules/nvm/manifests/init.pp new file mode 100644 index 0000000..936e5b5 --- /dev/null +++ b/custom-modules/nvm/manifests/init.pp @@ -0,0 +1,20 @@ +class nvm ( + $nvm_version = 'v0.33.11', + $nvm_repo = 'https://github.com/creationix/nvm.git', + $users = [], + $node_versions = [], +) { + + # Build the hashes to install nvm on an + # individual user. + $installs = $users.reduce({}) |$cumulate, $user| { + $tmp = merge($cumulate, { + $user['name'] => { + home => $user['home'], + nvm_repo => $nvm_repo, + nvm_version => $nvm_version, + node_versions => $node_versions, + }}) + } + create_resources(::nvm::install, $installs) +} \ No newline at end of file diff --git a/custom-modules/nvm/manifests/install.pp b/custom-modules/nvm/manifests/install.pp new file mode 100644 index 0000000..331a79b --- /dev/null +++ b/custom-modules/nvm/manifests/install.pp @@ -0,0 +1,52 @@ +# Install nvm for a single user. +define nvm::install ( + $user = $name, + $home = "/home/${user}", + $node_versions, + $nvm_repo, + $nvm_version, +) { + + $profile_path = "${home}/.bashrc" + $nvm_dir = "${home}/.nvm" + + vcsrepo { "${nvm_dir}": + ensure => 'present', + provider => 'git', + source => $nvm_repo, + revision => $nvm_version, + owner => $user, + group => $user, + } + + file { "ensure ${profile_path}": + ensure => 'present', + path => $profile_path, + owner => $user, + require => User[$user], + }-> + + file_line { "add NVM_DIR to profile file for ${user}": + path => $profile_path, + line => "export NVM_DIR=\"\$HOME/.nvm\"", + }-> + + file_line { "add . ~/.nvm/nvm.sh to profile file for ${user}": + path => $profile_path, + line => "[ -s \"\$NVM_DIR/nvm.sh\" ] && \\. \"\$NVM_DIR/nvm.sh\" # This loads nvm", + } + + # This builds the version hashes so we can install the + # same versions for each user. + $versions = $node_versions.reduce({}) |$cumulate, $node_version| { + $tmp = merge($cumulate, { + "${user}-${node_version['alias']}" => { + version => $node_version['version'], + alias_name => $node_version['alias'], + user => $user, + nvm_dir => $nvm_dir, + }}) + } + + create_resources(::nvm::node_version, $versions) +} \ No newline at end of file diff --git a/custom-modules/nvm/manifests/node_version.pp b/custom-modules/nvm/manifests/node_version.pp new file mode 100644 index 0000000..0219ae4 --- /dev/null +++ b/custom-modules/nvm/manifests/node_version.pp @@ -0,0 +1,26 @@ +# Install version of node on an individual user. +define nvm::node_version ( + $user, + $version, + $alias_name, + $nvm_dir = "/home/${user}/.nvm", +) { + + exec { "nvm install node version ${version} on ${user}": + cwd => $nvm_dir, + command => ". ${nvm_dir}/nvm.sh && nvm install ${version}", + user => $user, + unless => ". ${nvm_dir}/nvm.sh && nvm which ${version}", + environment => [ "NVM_DIR=${nvm_dir}" ], + provider => shell, + require => Vcsrepo["${nvm_dir}"] + }-> + exec { "nvm set node version ${version} as ${alias_name} on ${user}": + cwd => $nvm_dir, + command => ". ${nvm_dir}/nvm.sh && nvm alias ${alias_name} ${version}", + user => $user, + environment => [ "NVM_DIR=${nvm_dir}" ], + unless => ". ${nvm_dir}/nvm.sh && nvm which ${alias_name} | grep ${version}", + provider => shell, + } +} \ No newline at end of file diff --git a/default.config.yaml b/default.config.yaml index 767ab90..5f98550 100644 --- a/default.config.yaml +++ b/default.config.yaml @@ -9,6 +9,7 @@ private_ipv6: "2400:cb00:2049:1::a29f:1a63" # Change the version number in the line below (or override in config.yaml) # to switch Ubuntu versions. box: "zivtech/ubuntu-16.04-server-puppet-4" +box_version: "1.0" # The amount of memory (in megabytes) to provision. memory: "2048" cpus: 2 diff --git a/hiera/common.yaml b/hiera/common.yaml index 598836c..821bcee 100644 --- a/hiera/common.yaml +++ b/hiera/common.yaml @@ -9,9 +9,19 @@ drupal_php::max_execution_time_server: 30 drupal_php::memory_limit_server: 256M drupal_php::post_max_size: '8M' drupal_php::server::apache::mpm_module: event +drupal_php::server::apache::default_vhost_docroot_owner: 501 +drupal_php::server::apache::default_vhost_docroot_group: 'dialout' drupal_php::timezone: 'UTC' drupal_php::upload_max_filesize: 200M -php::globals::php_version: '7.1' +nvm::node_versions: + - + alias: default + version: '8.12.0' +nvm::users: + - + name: "%{::webadmin::webadminuser}" + home: "/home/%{::webadmin::webadminuser}" +php::globals::php_version: '7.2' php::package_prefix: 'php%{::php::globals::php_version}-' drush_patchfile::git_ref: '642394617e494ccdc81f2319ca5d2266df1c58e4' drush::configs: diff --git a/manifests/default.pp b/manifests/default.pp index 236ca97..ae8cd05 100644 --- a/manifests/default.pp +++ b/manifests/default.pp @@ -45,6 +45,7 @@ include mysql::server include drupal_php + # todo: update drupal_solr include drupal_solr include drush @@ -68,7 +69,7 @@ include terminus include redis include mailhog - include wp_cli + include nvm file { '/home/vagrant/.my.cnf': content => "[client]\nuser=root\nhost=localhost\npassword='${mysql::server::root_password}'\n", @@ -81,12 +82,6 @@ package { 'git-sh': ensure => 'installed', } - - class { 'nodejs': }-> - file { '/usr/bin/node': - ensure => 'link', - target => '/usr/bin/nodejs' - } } include vagrant_setup