correct provisioning to install drush and correct config files + module definition for menu access problem
--- a/build/build_rpm.sh Tue Oct 18 14:42:01 2016 +0530
+++ b/build/build_rpm.sh Tue Oct 18 14:38:56 2016 +0200
@@ -29,6 +29,7 @@
-d httpd \
-d php56 \
-d mariadb-server \
+ -d mariadb \
--name corpusdelaparole \
--version "$version" \
--iteration $(date +%s) \
@@ -40,6 +41,7 @@
--after-install /vagrant/post_install.sh \
--after-remove /vagrant/post_uninstall.sh \
--after-upgrade /vagrant/post_upgrade.sh \
+ --before-upgrade /vagrant/pre_upgrade.sh \
.
echo "---> Packaging done"
--- a/build/post_upgrade.sh Tue Oct 18 14:42:01 2016 +0530
+++ b/build/post_upgrade.sh Tue Oct 18 14:38:56 2016 +0200
@@ -1,7 +1,9 @@
#!/usr/bin/env sh
-echo "Clear drupal cache"
if [ -x /usr/local/bin/drush ]; then
+ echo "Reactivate corpus module"
+ /usr/local/bin/drush -r /var/www/corpusdelaparole/drupal pm-enable -y corpus
+ echo "Clear drupal cache"
/usr/local/bin/drush -r /var/www/corpusdelaparole/drupal cc all
fi
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/build/pre_upgrade.sh Tue Oct 18 14:38:56 2016 +0200
@@ -0,0 +1,6 @@
+#!/usr/bin/env sh
+
+if [ -x /usr/local/bin/drush ]; then
+ echo "Deactivate corpus module"
+ /usr/local/bin/drush -r /var/www/corpusdelaparole/drupal pm-disable -y corpus
+fi
--- a/cms/corpus_module/corpus.module.tmpl Tue Oct 18 14:42:01 2016 +0530
+++ b/cms/corpus_module/corpus.module.tmpl Tue Oct 18 14:38:56 2016 +0200
@@ -16,7 +16,7 @@
'description' => t('Corpus de la parole'),
'weight' => -1,
'page callback' => 'corpus_page',
- 'access arguments' => array(''), // permission
+ 'access arguments' => array('access content'), // permission
'type' => MENU_NORMAL_ITEM,
'menu_name' => 'main-menu',
'options' => array(
@@ -30,7 +30,7 @@
'description' => t('Corpus de la parole'),
'weight' => 0,
'page callback' => 'corpus_page',
- 'access arguments' => array(''), // permission
+ 'access arguments' => array('access content'), // permission
'type' => MENU_NORMAL_ITEM,
'menu_name' => 'main-menu',
'options' => array(
@@ -44,7 +44,7 @@
'description' => t('Corpus de la parole'),
'weight' => 1,
'page callback' => 'corpus_page',
- 'access arguments' => array(''), // permission
+ 'access arguments' => array('access content'), // permission
'type' => MENU_NORMAL_ITEM,
'menu_name' => 'main-menu',
'options' => array(
@@ -58,7 +58,7 @@
'description' => t('Corpus de la parole'),
'weight' => 2,
'page callback' => 'corpus_page',
- 'access arguments' => array(''), // permission
+ 'access arguments' => array('access content'), // permission
'type' => MENU_NORMAL_ITEM,
'menu_name' => 'main-menu',
'options' => array(
@@ -72,7 +72,7 @@
'description' => t('Corpus de la parole'),
'weight' => 3,
'page callback' => 'corpus_page',
- 'access arguments' => array(''), // permission
+ 'access arguments' => array('access content'), // permission
'type' => MENU_NORMAL_ITEM,
'menu_name' => 'main-menu',
'options' => array(
@@ -86,7 +86,7 @@
'description' => t('Corpus de la parole'),
'weight' => 4,
'page callback' => 'corpus_page',
- 'access arguments' => array(''), // permission
+ 'access arguments' => array('access content'), // permission
'type' => MENU_NORMAL_ITEM,
'menu_name' => 'main-menu',
'options' => array(
--- a/dev/README.md Tue Oct 18 14:42:01 2016 +0530
+++ b/dev/README.md Tue Oct 18 14:38:56 2016 +0200
@@ -24,7 +24,7 @@
```
* complêter le fichier de configuration. Le fichier template contient le minimum de paramêtres nécessaire pour avoir un système fonctionnel.
-* dans le fichiet `/var/lib/puppet/provision/hiera.yaml`, mettre la ligne ` :datadir: "/etc/puppet/hiera"`
+* dans le fichier `/var/lib/puppet/provision/hiera.yaml`, mettre la ligne ` :datadir: "/etc/puppet/hiera"`
## execution
--- a/dev/provisioning/custom.yaml.tmpl Tue Oct 18 14:42:01 2016 +0530
+++ b/dev/provisioning/custom.yaml.tmpl Tue Oct 18 14:38:56 2016 +0200
@@ -27,14 +27,19 @@
sysconfig::params::es_instance : es_01
# handle host
-sysconfig::params::hdl_host : 172.16.1.6
+sysconfig::params::hdl_host : 172.16.1.6
+# handle web port
+sysconfig::params::hdl_web_host : 8000
# handle db name
-sysconfig::params::hdl_db_name : handle
+sysconfig::params::hdl_db_name : handle
+# handle key password
+sysconfig::params::hdl_key_pswd : "to-be-defined"
# handle prefix
-sysconfig::params::hdl_prefix : "12345.100"
+sysconfig::params::hdl_prefix : "12345.100"
# handle test prefix
sysconfig::params::hdl_test_prefix : "12345.101"
-
+# handle prefix admin
+sysconfig::params::hdl_prefix_admin : "CORPUS_ADMIN"
# memory percentage used by memcached
sysconfig::params::memcached_max_memory : 25%
@@ -44,3 +49,7 @@
# corpus application key 32 character random string (Array.new(32){"abcdefghijklmnopqrstuvwxyz0123456789!@#\$%^&*(-_=+)".split("").sample}.join )
sysconfig::params::corpus_app_key :
+
+# geonames user (c.f. http://www.geonames.org/login)
+sysconfig::params::geonames_username : demo
+
--- a/dev/provisioning/default.pp Tue Oct 18 14:42:01 2016 +0530
+++ b/dev/provisioning/default.pp Tue Oct 18 14:38:56 2016 +0200
@@ -23,6 +23,9 @@
class { 'sysconfig::handle': }
}
+# install drupal
+class { 'sysconfig::drupal': }
+
# install tomcat
class { 'sysconfig::tomcat': }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dev/provisioning/modules/drush/LICENSE.txt Tue Oct 18 14:38:56 2016 +0200
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2014 Jonathan Araña Cruz - SB IT Media, S.L.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dev/provisioning/modules/drush/README.md Tue Oct 18 14:38:56 2016 +0200
@@ -0,0 +1,131 @@
+## Drush puppet module
+
+[](http://forge.puppetlabs.com/jonhattan/drush) [](https://github.com/jonhattan/puppet-drush/tags)
+
+This module enables installing several versions of [Drush](http://www.drush.org/) system-wide.
+
+At present the available installation method is via [Composer](https://getcomposer.org/).
+
+
+## Quick install instructions
+
+Find quick install instructions in the [Puppetry for Drupaleros](https://github.com/jonhattan/puppet-drush/wiki/Puppetry-for-Drupaleros)
+wiki page.
+
+These instructions are intended for people that don't have the time or the
+need to learn Puppet, but wants to benefit from the facilities provided by
+this Puppet module in order to install and manage several versions of Drush
+system-wide.
+
+
+## Features
+
+ * Installs dist (tarball) or source code (git clone) of Drush
+ * Definition of Drush aliases
+ * Download Drush extensions
+ * Optionally install command dependencies (wget, git, gzip, rsync, ...)
+ * Configures bash integration. Only autocompletion or full integration
+ * Allows to choose the 'default' Drush installation
+
+It doesn't goes crazy to provide a freaking interface to run Drush commands
+from Puppet. Although it is tempting, and I don't discard that in a future,
+it doesn't seem suitable in Puppet philosophy.
+
+
+## What it does
+
+Each given Drush version is installed to a directory matching its major
+version under `/opt/drush/`. Also, a symlink to the executable is placed
+in `/usr/local/bin/`, suffixed with its major version.
+
+Additionally, for the default version, `/opt/drush/default` will be a symlink
+to its codebase, and `/usr/local/bin/drush` will point to its executable.
+
+For example if you choose to install Drush versions `6` and `master`, being
+`6` the chosen default version, this is the final result on the filesystem:
+
+```
+d /opt/drush/master
+d /opt/drush/6
+l /opt/drush/default -> /opt/drush/6/vendor/drush/drush
+d /opt/drush/.composer
+
+l /usr/local/bin/drush -> /usr/local/bin/drush6
+l /usr/local/bin/drush6 -> /opt/drush/6/vendor/bin/drush
+l /usr/local/bin/drushmaster -> /opt/drush/master/vendor/bin/drush
+```
+
+With respect to other artifacts,
+
+ * Aliases are installed to `/etc/drush`
+ * Extensions are downloaded to `/usr/share/drush/commands`, the standard Drush
+site-wide location
+ * Several shell scripts may be placed in `/etc/bash_completion.d` and
+`/etc/profile.d`, depending on the provided arguments to Drush class.
+
+
+## Example usage
+
+Below is an example of the supported Hiera data structure.
+
+See [Puppetry for Drupaleros](https://github.com/jonhattan/puppet-drush/wiki/Puppetry-for-Drupaleros)
+wiki page for an example of Puppet code not based on Hiera.
+
+### Hieradata
+
+```yaml
+classes :
+ - 'drush'
+
+drush::versions :
+ - '6'
+ - 'master'
+
+drush::extensions :
+ - 'drush_extras'
+ - 'registry_rebuild'
+
+drush::aliases :
+ base:
+ group : 'example'
+ path_aliases :
+ '%dump-dir' : '/opt/dumps'
+ command_specific :
+ sql-sync :
+ cache: false
+
+ dev :
+ group : 'example'
+ parent : '@base'
+ root : '/var/www/dev.example.com/htdocs'
+ uri : 'dev.example.com'
+
+ staging :
+ group : 'example'
+ parent : '@base'
+ root : '/var/www/staging.example.com/htdocs'
+ uri : 'staging.example.com'
+ remote_host : 'staging.example.com'
+ remote_user : 'deploy'
+ ssh_options : '-p 2203'
+
+```
+
+
+### Manifest
+
+```ruby
+
+# Include the declared Hiera classes and let Puppet do the magic.
+hiera_include('classes')
+```
+
+## License
+
+MIT
+
+
+## Author Information
+
+Jonathan Araña Cruz - SB IT Media, S.L.
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dev/provisioning/modules/drush/Rakefile Tue Oct 18 14:38:56 2016 +0200
@@ -0,0 +1,18 @@
+require 'rubygems'
+require 'puppetlabs_spec_helper/rake_tasks'
+require 'puppet-lint/tasks/puppet-lint'
+PuppetLint.configuration.send('disable_80chars')
+PuppetLint.configuration.ignore_paths = ["spec/**/*.pp", "pkg/**/*.pp"]
+
+desc "Validate manifests, templates, and ruby files"
+task :validate do
+ Dir['manifests/**/*.pp'].each do |manifest|
+ sh "puppet parser validate --noop #{manifest}"
+ end
+ Dir['spec/**/*.rb','lib/**/*.rb'].each do |ruby_file|
+ sh "ruby -c #{ruby_file}" unless ruby_file =~ /spec\/fixtures/
+ end
+ Dir['templates/**/*.erb'].each do |template|
+ sh "erb -P -x -T '-' #{template} | ruby -c"
+ end
+end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dev/provisioning/modules/drush/TODO.md Tue Oct 18 14:38:56 2016 +0200
@@ -0,0 +1,7 @@
+- Allow installation of drush 5.
+ - with pear? -> hard dependency on a puppet pear module?
+ - from tarball? -> for any version of drush. example42/puppi may help?
+
+- Fix version management.
+ - Alias 7 to master / dev-master
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dev/provisioning/modules/drush/manifests/alias.pp Tue Oct 18 14:38:56 2016 +0200
@@ -0,0 +1,60 @@
+define drush::alias(
+ $ensure = present,
+ $alias_name = $name,
+ $group = undef,
+ $parent = undef,
+ $root = undef,
+ $uri = undef,
+ $db_url = undef,
+ $path_aliases = undef,
+ $ssh_options = undef,
+ $remote_host = undef,
+ $remote_user = undef,
+ $custom_options = undef,
+ $command_specific = undef,
+ $source_command_specific = undef,
+ $target_command_specific = undef,
+) {
+
+ if (!defined(Class['drush'])) {
+ fail('You must include class drush before declaring aliases')
+ }
+
+ if $root {
+ validate_absolute_path($root)
+ }
+ if $parent {
+ validate_re($parent, '^@',
+ "Invalid parent alias '${parent}'. Parent aliases must start with @.")
+ }
+ if $custom_options {
+ validate_hash($custom_options)
+ }
+ if $command_specific {
+ validate_hash($command_specific)
+ }
+
+ $aliasfile = $group ? {
+ undef => '/etc/drush/aliases.drushrc.php',
+ default => "/etc/drush/${group}.aliases.drushrc.php",
+ }
+
+ if !defined(Concat[$aliasfile]) {
+ concat{ $aliasfile:
+ ensure => $ensure,
+ }
+ concat::fragment { "${aliasfile}-header":
+ target => $aliasfile,
+ content => "<?php\n#MANAGED BY PUPPET!\n\n",
+ order => 0,
+ }
+ }
+
+ concat::fragment { "${aliasfile}-${name}":
+ target => $aliasfile,
+ content => template('drush/alias.erb'),
+ order => 1,
+ }
+
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dev/provisioning/modules/drush/manifests/cacheclear.pp Tue Oct 18 14:38:56 2016 +0200
@@ -0,0 +1,17 @@
+class drush::cacheclear {
+
+ #private()
+ if $caller_module_name != $module_name {
+ warning("${name} is not part of the public API of the ${module_name} \
+module and should not be directly included in the manifest.")
+ }
+
+ # Clear drush cache on demand.
+ exec { 'drush-cc-drush':
+ command => "${drush::drush_exe_default} cc drush",
+ require => File[$drush::drush_exe_default],
+ refreshonly => true,
+ }
+
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dev/provisioning/modules/drush/manifests/config.pp Tue Oct 18 14:38:56 2016 +0200
@@ -0,0 +1,35 @@
+class drush::config {
+
+ #private()
+ if $caller_module_name != $module_name {
+ warning("${name} is not part of the public API of the ${module_name} \
+module and should not be directly included in the manifest.")
+ }
+
+ # Bash integration and autocompletion based on the default version.
+ validate_bool($drush::bash_integration,
+ $drush::bash_autocompletion
+ )
+ if $drush::bash_integration {
+ file { '/etc/profile.d/drushrc.sh':
+ ensure => link,
+ target => "${drush::install_base_path}/default/examples/example.bashrc",
+ }
+ }
+ elsif $drush::bash_autocompletion {
+ file { '/etc/bash_completion.d/drush':
+ ensure => link,
+ target => "${drush::install_base_path}/default/drush.complete.sh",
+ }
+ }
+
+ # Create aliases.
+ validate_hash($drush::aliases)
+ create_resources(drush::alias, $drush::aliases)
+
+ # Install extensions.
+ validate_array($drush::extensions)
+ drush::extension{ $drush::extensions: }
+
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dev/provisioning/modules/drush/manifests/extension.pp Tue Oct 18 14:38:56 2016 +0200
@@ -0,0 +1,17 @@
+define drush::extension() {
+
+ if (!defined(Class['drush'])) {
+ fail('You must include class drush before declaring aliases')
+ }
+
+ # Split $name at the dash to eliminate the version component.
+ $parts = split($name, '-')
+ $extension_name = $parts[0]
+
+ exec {"${drush::drush_exe_default} dl ${name}":
+ command => "/usr/bin/su - -c '${drush::drush_exe_default} dl ${name}'",
+ creates => "/usr/share/drush/commands/${extension_name}",
+ notify => Class['drush::cacheclear'],
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dev/provisioning/modules/drush/manifests/init.pp Tue Oct 18 14:38:56 2016 +0200
@@ -0,0 +1,90 @@
+# == Class: drush
+#
+# Installs Drush system-wide with Composer and prepares a working environment.
+#
+# === Parameters
+#
+# [*versions*]
+# Array of versions of drush to install.
+# Valid values are '6', '7', '8', and 'master'.
+#
+# [*default_version*]
+# String with the drush version considered the main version.
+#
+# [*install_type*]
+# Install distribution package or source code.
+# Valid values: 'dist', 'source'. Defaults to 'dist'.
+#
+# [*autoupdate*]
+# Try and install new versions automatically. Defaults to false.
+#
+# [*ensure_extra_packages*]
+# Boolean indicating wether extra system packages must be installed.
+# It defaults to false to not interfere with other modules.
+#
+# [*extra_packages*]
+# Array of extra packages to install if ensure_extra_packages is true.
+#
+# [*bash_integration*]
+# Boolean indicating whether to enable drush bash facilities. It configures
+# bash to source drush's example.bashrc for any session.
+#
+# [*bash_autocompletion*]
+# Boolean indicating whether to enable bash autocompletion for drush commands.
+# Doesn't take effect if bash_integration is true.
+#
+# [*extensions*]
+# List of drush extensions to download.
+#
+# [*aliases*]
+# Hash of aliases to make available system wide.
+#
+# [*composer_path*]
+# Absolute path to composer executable.
+#
+# [*php_path*]
+# Path to an alternative php executable to run drush with.
+# If provided, it will set DRUSH_PHP environment variable system-wide.
+#
+# [*php_ini_path*]
+# Path to an alternative php ini file. If provided, it will set PHP_INI
+# environment variable system-wide. See `docs-ini-files` for details.
+#
+# [*drush_ini_path*]
+# Path to a ini file with php overrides. If provided, it will set DRUSH_INI
+# environment variable system-wide. See `docs-ini-files` for details.
+#
+class drush(
+ $versions = ['7',],
+ $default_version = '7',
+ $install_type = 'dist',
+ $autoupdate = false,
+ $ensure_extra_packages = false,
+ $extra_packages = $drush::params::extra_packages,
+ $bash_integration = false,
+ $bash_autocompletion = true,
+ $extensions = [],
+ $aliases = {},
+ $composer_path = '/usr/local/bin/composer',
+ $php_path = undef,
+ $php_ini_path = undef,
+ $drush_ini_path = undef,
+) inherits drush::params {
+
+ # Pick default major version.
+ validate_string($default_version)
+ $parts = split($default_version, '[.]')
+ $default_version_major = $parts[0]
+
+ validate_absolute_path($composer_path)
+
+ $install_base_path = '/opt/drush'
+ $drush_exe_default = '/usr/local/bin/drush'
+
+ class{'drush::setup': } ->
+ class{'drush::config': } ~>
+ class{'drush::cacheclear': } ->
+ Class['drush']
+
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dev/provisioning/modules/drush/manifests/install.pp Tue Oct 18 14:38:56 2016 +0200
@@ -0,0 +1,68 @@
+# == Defined type: drush::install
+#
+# Installs a Drush version with the given method.
+#
+# === Parameters
+#
+# [*version*]
+# Drush release to install. Example: 7, 6.6, master.
+#
+# [*install_type*]
+# Install distribution package or source code.
+# Valid values: 'dist', 'source'. Defaults to 'dist'.
+#
+# [*autoupdate*]
+# Try and install new versions automatically. Defaults to false.
+#
+# [*method*]
+# Installation method. It only accepts composer at present.
+#
+define drush::install(
+ $version,
+ $install_type = 'dist',
+ $autoupdate = false,
+ $method = 'composer',
+) {
+
+ $install_types = [ 'dist', 'source' ]
+ if ! ($install_type in $install_types) {
+ fail("'${install_type}' is not a valid value for creation_mode. Valid values: ${install_types}.")
+ }
+
+
+ # Pick major version.
+ $parts = split($version, '[.]')
+ $version_major = $parts[0]
+
+ $drush = "drush${version_major}"
+ $drush_exe = "/usr/local/bin/${drush}"
+ $install_path = "${drush::install_base_path}/${version_major}"
+
+ case $method {
+ 'composer': {
+ drush::install::composer { $drush:
+ autoupdate => $autoupdate,
+ version => $version,
+ install_path => $install_path,
+ install_type => $install_type,
+ notify => Exec["${drush}-first-run"],
+ }
+ file { $drush_exe:
+ ensure => link,
+ target => "${install_path}/vendor/bin/drush",
+ require => Drush::Install::Composer[$drush],
+ }
+ }
+ default: {
+ fail("Unknown install method: '${method}'.")
+ }
+ }
+
+ exec { "${drush}-first-run":
+ command => "/usr/bin/su - -c '${drush_exe} status'",
+ require => File[$drush_exe],
+ refreshonly => true,
+ }
+
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dev/provisioning/modules/drush/manifests/install/composer.pp Tue Oct 18 14:38:56 2016 +0200
@@ -0,0 +1,40 @@
+define drush::install::composer(
+ $autoupdate,
+ $version,
+ $install_path,
+ $install_type,
+) {
+
+ #private()
+ if $caller_module_name != $module_name {
+ warning("${name} is not part of the public API of the ${module_name} \
+module and should not be directly included in the manifest.")
+ }
+
+ # If version is 'master' or a single major release number,
+ # transform into something composer understands.
+ $real_version = $version ? {
+ /\./ => $version,
+ 'master' => 'dev-master',
+ default => "${version}.*",
+ }
+
+ file { $install_path:
+ ensure => directory,
+ }
+
+ $base_path = dirname($install_path)
+ $composer_home = "${base_path}/.composer"
+ $prefer = "--prefer-${install_type}"
+ $cmd = "${drush::composer_path} require drush/drush:${real_version} ${prefer}"
+ exec { $cmd:
+ cwd => $install_path,
+ environment => ["COMPOSER_HOME=${composer_home}"],
+ require => File[$install_path],
+ }
+ if ! $autoupdate {
+ Exec[$cmd] { creates => "${install_path}/composer.json"}
+ }
+
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dev/provisioning/modules/drush/manifests/params.pp Tue Oct 18 14:38:56 2016 +0200
@@ -0,0 +1,30 @@
+class drush::params {
+ case $::osfamily {
+ 'Debian': {
+ $extra_packages = [
+ 'bzip2',
+ 'gzip',
+ 'less',
+ 'mysql-client',
+ 'rsync',
+ 'unzip',
+ 'wget',
+ ]
+ }
+ 'RedHat': {
+ $extra_packages = [
+ 'bzip2',
+ 'gzip',
+ 'less',
+ 'mysql',
+ 'rsync',
+ 'unzip',
+ 'wget',
+ ]
+ }
+ default: {
+ fail("Unsupported operatingsystem: ${::osfamily}/${::operatingsystem}.")
+ }
+ }
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dev/provisioning/modules/drush/manifests/setup.pp Tue Oct 18 14:38:56 2016 +0200
@@ -0,0 +1,94 @@
+class drush::setup {
+
+ #private()
+ if $caller_module_name != $module_name {
+ warning("${name} is not part of the public API of the ${module_name} \
+module and should not be directly included in the manifest.")
+ }
+
+ # Install extra packages.
+ validate_bool($drush::ensure_extra_packages)
+ if $drush::ensure_extra_packages {
+ validate_array($drush::extra_packages)
+ package { $drush::extra_packages:
+ ensure => installed,
+ }
+ }
+
+ concat{ 'drush-sh-profile':
+ ensure => present,
+ path => '/etc/profile.d/drush.sh',
+ }
+ concat::fragment { 'drush-sh-profile-header':
+ ensure => present,
+ target => 'drush-sh-profile',
+ content => "# MANAGED BY PUPPET\n\n",
+ order => 0,
+ }
+ if $drush::php_path {
+ validate_absolute_path($drush::php_path)
+ concat::fragment { 'drush-sh-profile-php-path':
+ ensure => present,
+ target => 'drush-sh-profile',
+ content => "export DRUSH_PHP=${drush::php_path}\n",
+ order => 1,
+ }
+ }
+ if $drush::php_ini_path {
+ validate_absolute_path($drush::php_ini_path)
+ concat::fragment { 'drush-sh-profile-php-ini-path':
+ ensure => present,
+ target => 'drush-sh-profile',
+ content => "export PHP_INI=${drush::php_ini_path}\n",
+ order => 1,
+ }
+ }
+ if $drush::drush_ini_path {
+ validate_absolute_path($drush::drush_ini_path)
+ concat::fragment { 'drush-sh-profile-drush-ini-path':
+ ensure => present,
+ target => 'drush-sh-profile',
+ content => "export DRUSH_INI=${drush::drush_ini_path}\n",
+ order => 1,
+ }
+ }
+
+ # Base install path of any drush installations.
+ file { $drush::install_base_path:
+ ensure => directory,
+ }
+
+ # Drush directories.
+ file { ['/etc/drush', '/usr/share/drush', '/usr/share/drush/commands']:
+ ensure => directory,
+ }
+
+ # Symlink to drush default version executable.
+ file { $drush::drush_exe_default:
+ ensure => link,
+ target => "/usr/local/bin/drush${drush::default_version_major}",
+ }
+
+ # Install drush versions. It could be improved with future parser's each(),
+ # or building a hash like
+ # {'6' => {'version' => '6'}, 'master' => {'version' => 'master'}}
+ validate_array($drush::versions)
+ $versions = parseyaml(template('drush/install-versions-hash.erb'))
+ $defaults = {
+ install_type => $drush::install_type,
+ autoupdate => $drush::autoupdate,
+ method => 'composer'
+ }
+ create_resources('drush::install', $versions, $defaults)
+
+ # Make /opt/drush/default a symlink to the codebase
+ # of the default drush installation.
+ # TODO: this is coupled to composer install method.
+ $default_path = "${drush::install_base_path}/${drush::default_version_major}"
+ file { "${drush::install_base_path}/default":
+ ensure => link,
+ target => "${default_path}/vendor/drush/drush",
+ }
+
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dev/provisioning/modules/drush/metadata.json Tue Oct 18 14:38:56 2016 +0200
@@ -0,0 +1,36 @@
+{
+ "name": "jonhattan-drush",
+ "version": "0.5.0",
+ "author": "jonhattan",
+ "summary": "Installs several versions of Drush system-wide.",
+ "license": "MIT",
+ "source": "http://github.com/jonhattan/puppet-drush",
+ "project_page": "https://github.com/jonhattan/puppet-drush",
+ "issues_url": "https://github.com/jonhattan/puppet-drush/issues",
+ "tags": ["drupal", "php", "cli"],
+ "operatingsystem_support": [
+ {
+ "operatingsystem": "CentOS",
+ "operatingsystemrelease": [ "6", "7" ]
+ },
+ {
+ "operatingsystem": "Debian",
+ "operatingsystemrelease": [ "6", "7", "8" ]
+ },
+ {
+ "operatingsystem": "Ubuntu",
+ "operatingsystemrelease": [ "12.04", "14.04" ]
+ }
+ ],
+ "dependencies": [
+ {
+ "name": "puppetlabs/stdlib",
+ "version_requirement": ">=4.2.2 <5.0.0"
+ },
+ {
+ "name": "puppetlabs/concat",
+ "version_requirement": ">=1.1.0 <2.0.0"
+ }
+ ]
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dev/provisioning/modules/drush/spec/classes/init_spec.rb Tue Oct 18 14:38:56 2016 +0200
@@ -0,0 +1,7 @@
+require 'spec_helper'
+describe 'drush' do
+
+ context 'with defaults for all parameters' do
+ it { should contain_class('drush') }
+ end
+end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dev/provisioning/modules/drush/spec/spec_helper.rb Tue Oct 18 14:38:56 2016 +0200
@@ -0,0 +1,17 @@
+dir = File.expand_path(File.dirname(__FILE__))
+$LOAD_PATH.unshift File.join(dir, 'lib')
+
+require 'mocha'
+require 'puppet'
+require 'rspec'
+require 'spec/autorun'
+
+Spec::Runner.configure do |config|
+ config.mock_with :mocha
+end
+
+# We need this because the RAL uses 'should' as a method. This
+# allows us the same behaviour but with a different method name.
+class Object
+ alias :must :should
+end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dev/provisioning/modules/drush/templates/alias.erb Tue Oct 18 14:38:56 2016 +0200
@@ -0,0 +1,72 @@
+$aliases['<%= @alias_name %>'] = array(
+<% if @parent -%>
+ 'parent' => '<%= @parent %>',
+<% end -%>
+<% if @root -%>
+ 'root' => '<%= @root %>',
+<% end -%>
+<% if @uri -%>
+ 'uri' => '<%= @uri %>',
+<% end -%>
+<% if @remote_host -%>
+ 'remote-host' => '<%= @remote_host %>',
+<% end -%>
+<% if @remote_user -%>
+ 'remote-user' => '<%= @remote_user %>',
+<% end -%>
+<% if @ssh_options -%>
+ 'ssh-options' => '<%= @ssh_options %>',
+<% end -%>
+<% if @db_url -%>
+ 'db-url' => '<%= @db_url %>',
+<% end -%>
+<% if @custom_options -%>
+ <%- @custom_options.each do |key, value| -%>
+ <%= "'#{key}' => '#{value}'" %>,
+ <%- end -%>
+<% end -%>
+<% if @path_aliases -%>
+ 'path-aliases' => array(
+ <%- @path_aliases.each do |key, value| -%>
+ <%= "'#{key}' => '#{value}'" %>,
+ <%- end -%>
+ ),
+<% end -%>
+<% if @command_specific -%>
+ 'command-specific' => array(
+ <%- @command_specific.each do |command, options| -%>
+ <%= "'#{command}'" %> => array(
+ <%- options.each do |key, value| -%>
+ <%- value = "'#{value}'" unless [true, false].include? value -%>
+ <%= "'#{key}' => #{value}" -%>,
+ <%- end -%>
+ ),
+ <%- end -%>
+ ),
+<% end -%>
+<% if @source_command_specific -%>
+ 'source-command-specific' => array(
+ <%- @source_command_specific.each do |command, options| -%>
+ <%= "'#{command}'" %> => array(
+ <%- options.each do |key, value| -%>
+ <%- value = "'#{value}'" unless [true, false].include? value -%>
+ <%= "'#{key}' => #{value}" -%>,
+ <%- end -%>
+ ),
+ <%- end -%>
+ ),
+<% end -%>
+<% if @target_command_specific -%>
+ 'target-command-specific' => array(
+ <%- @target_command_specific.each do |command, options| -%>
+ <%= "'#{command}'" %> => array(
+ <%- options.each do |key, value| -%>
+ <%- value = "'#{value}'" unless [true, false].include? value -%>
+ <%= "'#{key}' => #{value}" -%>,
+ <%- end -%>
+ ),
+ <%- end -%>
+ ),
+<% end -%>
+);
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dev/provisioning/modules/drush/templates/install-versions-hash.erb Tue Oct 18 14:38:56 2016 +0200
@@ -0,0 +1,6 @@
+---
+<% scope.lookupvar('drush::versions').each do |version| %>
+ <%= version %> :
+ version : '<%= version %>'
+<% end %>
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dev/provisioning/modules/drush/tests/init.pp Tue Oct 18 14:38:56 2016 +0200
@@ -0,0 +1,12 @@
+# The baseline for module testing used by Puppet Labs is that each manifest
+# should have a corresponding test manifest that declares that class or defined
+# type.
+#
+# Tests are then run by using puppet apply --noop (to check for compilation
+# errors and view a log of events) or by fully applying the test in a virtual
+# environment (to compare the resulting system state to the desired state).
+#
+# Learn more about module testing here:
+# http://docs.puppetlabs.com/guides/tests_smoke.html
+#
+include drush
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dev/provisioning/modules/sysconfig/files/composer/install.sh Tue Oct 18 14:38:56 2016 +0200
@@ -0,0 +1,26 @@
+#!/usr/bin/env sh
+
+wget -O /usr/local/bin/composer https://getcomposer.org/download/1.2.1/composer.phar
+chmod +x /usr/local/bin/composer
+
+#EXPECTED_SIGNATURE=$(wget https://composer.github.io/installer.sig -O - -q)
+#/opt/remi/php56/root/usr/bin/php -r "copy('https://getcomposer.org/installer', '/tmp/composer/composer-setup.php');"
+#ACTUAL_SIGNATURE=$(/opt/remi/php56/root/usr/bin/php -r "echo hash_file('SHA384', '/tmp/composer/composer-setup.php');")
+
+#if [ "$EXPECTED_SIGNATURE" = "$ACTUAL_SIGNATURE" ]
+#then
+# echo "Signature ok, installing"
+# mkdir -p /tmp/composer/bin/
+# /opt/remi/php56/root/usr/bin/php /tmp/composer/composer-setup.php --install-dir=/tmp/composer/bin/ --filename=composer --no-ansi
+# RESULT=$?
+# rm /tmp/composer/composer-setup.php
+# if [ -f /tmp/composer/bin/composer ]; then
+# mv /tmp/composer/bin/composer /usr/local/bin/composer
+# rm -fr /tmp/composer/bin
+# fi
+# exit $RESULT
+#else
+# >&2 echo 'ERROR: Invalid installer signature'
+# rm /tmp/composer/composer-setup.php
+# exit 1
+#fi
--- a/dev/provisioning/modules/sysconfig/manifests/corpus.pp Tue Oct 18 14:42:01 2016 +0530
+++ b/dev/provisioning/modules/sysconfig/manifests/corpus.pp Tue Oct 18 14:38:56 2016 +0200
@@ -1,12 +1,22 @@
class sysconfig::corpus (
- $vhost = hiera('sysconfig::params::vhost', $sysconfig::params::vhost),
- $corpus_app_key = hiera('sysconfig::params::corpus_app_key', $sysconfig::params::corpus_app_key),
- $db_name = hiera('sysconfig::params::db_name', $sysconfig::params::db_name),
- $db_drpl_name = hiera('sysconfig::params::db_drpl_name', $sysconfig::params::db_drpl_name),
- $db_user = hiera('sysconfig::params::db_user', $sysconfig::params::db_user),
- $db_pw = hiera('sysconfig::params::db_pw', $sysconfig::params::db_pw),
- $db_host = hiera('sysconfig::params::db_host', $sysconfig::params::db_host),
- $db_port = hiera('sysconfig::params::db_port', $sysconfig::params::db_port),
+ $vhost = hiera('sysconfig::params::vhost', $sysconfig::params::vhost),
+ $corpus_app_key = hiera('sysconfig::params::corpus_app_key', $sysconfig::params::corpus_app_key),
+ $db_name = hiera('sysconfig::params::db_name', $sysconfig::params::db_name),
+ $db_drpl_name = hiera('sysconfig::params::db_drpl_name', $sysconfig::params::db_drpl_name),
+ $db_user = hiera('sysconfig::params::db_user', $sysconfig::params::db_user),
+ $db_pw = hiera('sysconfig::params::db_pw', $sysconfig::params::db_pw),
+ $db_host = hiera('sysconfig::params::db_host', $sysconfig::params::db_host),
+ $db_port = hiera('sysconfig::params::db_port', $sysconfig::params::db_port),
+ $es_host = hiera('sysconfig::params::es_host', $sysconfig::params::es_host),
+ $es_port = hiera('sysconfig::params::es_port', $sysconfig::params::es_port),
+ $es_instance = hiera('sysconfig::params::es_instance', $sysconfig::params::es_instance),
+ $hdl_host = hiera('sysconfig::params::hdl_host', $sysconfig::params::hdl_host),
+ $hdl_web_port = hiera('sysconfig::params::hdl_web_port', $sysconfig::params::hdl_web_port),
+ $hdl_key_pswd = hiera('sysconfig::params::hdl_key_pswd', $sysconfig::params::hdl_key_pswd),
+ $hdl_prefix = hiera('sysconfig::params::hdl_prefix', $sysconfig::params::hdl_prefix),
+ $hdl_test_prefix = hiera('sysconfig::params::hdl_test_prefix', $sysconfig::params::hdl_test_prefix),
+ $hdl_prefix_admin = hiera('sysconfig::params::hdl_prefix_admin', $sysconfig::params::hdl_prefix_admin),
+ $geonames_username = hiera('sysconfig::params::geonames_username', $sysconfig::params::geonames_username)
) inherits sysconfig::params {
file { "/etc/www/corpus_env.conf":
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dev/provisioning/modules/sysconfig/manifests/drupal.pp Tue Oct 18 14:38:56 2016 +0200
@@ -0,0 +1,37 @@
+class sysconfig::drupal (
+ $vhost = hiera('sysconfig::params::vhost', $sysconfig::params::vhost)
+) inherits sysconfig::params {
+
+ notify {'drupal': name => "drupal => \$vhost : ${vhost}", withpath => true }
+
+ #install composer
+ file { "/tmp/composer":
+ ensure => directory,
+ }->
+ file { "/tmp/composer/install.sh":
+ mode => "0755",
+ source => "puppet:///modules/sysconfig/composer/install.sh",
+ }->
+ exec { "install_composer":
+ command => "/tmp/composer/install.sh",
+ creates => "/usr/local/bin/composer"
+ }->
+
+ class { '::drush':
+ require => Package["php56"],
+ versions => ['7'],
+ default_version => '7',
+ autoupdate => true,
+ ensure_extra_packages => false,
+ extra_packages => [ 'bzip2', 'gzip', 'less', 'mariadb', 'rsync', 'unzip', 'wget' ],
+ extensions => ['drush_extras'],
+ php_path => '/opt/remi/php56/root/usr/bin/php',
+ composer_path => '/opt/remi/php56/root/usr/bin/php /usr/local/bin/composer'
+ }
+
+ drush::alias { 'corpus':
+ root => '/var/www/corpusdelaparole/drupal',
+ uri => $vhost,
+ }
+
+}
--- a/dev/provisioning/modules/sysconfig/manifests/params.pp Tue Oct 18 14:42:01 2016 +0530
+++ b/dev/provisioning/modules/sysconfig/manifests/params.pp Tue Oct 18 14:38:56 2016 +0200
@@ -29,4 +29,6 @@
$corpus_app_key = hiera('sysconfig::params::corpus_app_key', 'TO_BE_DEFINED')
+ $geonames_username = hiera('sysconfig::params::geonames_username', 'demo')
+
}
--- a/dev/provisioning/modules/sysconfig/templates/corpus/corpus_env.conf.erb Tue Oct 18 14:42:01 2016 +0530
+++ b/dev/provisioning/modules/sysconfig/templates/corpus/corpus_env.conf.erb Tue Oct 18 14:38:56 2016 +0200
@@ -28,34 +28,34 @@
SetEnv EASYRDF_HTTP_CLIENT_TIMEOUT 5000
-SetEnv ELASTICSEARCH_URL <@= @elasticsearch_host %>:<@= @elasticsearch_port %>
+SetEnv ELASTICSEARCH_URL <%= @es_host %>:<%= @es_port %>
SetEnv ELASTICSEARCH_LOG_PATH 'logs/elasticsearch.log'
SetEnv ELASTICSEARCH_INDEX 'corpus'
SetEnv ELASTICSEARCH_SHARDS 1
SetEnv ELASTICSEARCH_REPLICAS 1
-SetEnv HANDLE_HOST <%= @handle_host %>
-SetEnv HANDLE_PORT <%= @handle_port %>
-SetEnv HANDLE_PREFIX <%= @handle_prefix %>
-SetEnv HANDLE_ADMIN_ID <%= @handle_admin_id %>
+SetEnv HANDLE_HOST <%= @hdl_host %>
+SetEnv HANDLE_PORT <%= @hdl_web_port %>
+SetEnv HANDLE_PREFIX <%= @hdl_prefix %>
+SetEnv HANDLE_ADMIN_ID <%= @hdl_prefix_admin %>
-SetEnv HANDLE_CERT_OR_PKEY "<%= @handle_cert_or_pkey %>"
-SetEnv HANDLE_PASSWORD <%= @handle_password %>
+SetEnv HANDLE_CERT_OR_PKEY "/var/lib/handle/corpusadmpriv.pem"
+SetEnv HANDLE_PASSWORD <%= @hdl_key_pswd %>
-SetEnv HANDLE_TEST_PREFIX <%= @handle_test_prefix %>
+SetEnv HANDLE_TEST_PREFIX <%= @hdl_test_prefix %>
-SetEnv HANDLE_TEST_CERT "corpusadmpkeycrt.pem"
-SetEnv HANDLE_TEST_CERT_PASSWORD NULL
-SetEnv HANDLE_TEST_CERT_ADMIN_HANDLE "300:<%= @handle_test_prefix %>/CORPUS_ADMIN"
+SetEnv HANDLE_TEST_CERT "/var/lib/handle/corpusadmpkeycrt.pem"
+SetEnv HANDLE_TEST_CERT_PASSWORD <%= @hdl_key_pswd %>
+SetEnv HANDLE_TEST_CERT_ADMIN_HANDLE "300:<%= @hdl_test_prefix %>/CORPUS_ADMIN"
-SetEnv HANDLE_TEST_RSA_KEY "corpusadmpriv.pem"
-SetEnv HANDLE_TEST_RSA_PASSWORD NULL
-SetEnv HANDLE_TEST_RSA_ADMIN_HANDLE "300:<%= @handle_test_prefix %>/CORPUS_ADMIN_RSA"
+SetEnv HANDLE_TEST_RSA_KEY "/var/lib/handle/corpusadmpriv.pem"
+SetEnv HANDLE_TEST_RSA_PASSWORD <%= @hdl_key_pswd %>
+SetEnv HANDLE_TEST_RSA_ADMIN_HANDLE "300:<%= @hdl_test_prefix %>/CORPUS_ADMIN_RSA"
-SetEnv HANDLE_TEST_DSA_KEY "corpusadmdsapriv.pem"
-SetEnv HANDLE_TEST_DSA_PASSWORD NULL
-SetEnv HANDLE_TEST_DSA_ADMIN_HANDLE "300:<%= @handle_test_prefix %>/CORPUS_ADMIN_DSA"
+SetEnv HANDLE_TEST_DSA_KEY "/var/lib/handle/corpusadmdsapriv.pem"
+SetEnv HANDLE_TEST_DSA_PASSWORD <%= @hdl_key_pswd %>
+SetEnv HANDLE_TEST_DSA_ADMIN_HANDLE "300:<%= @hdl_test_prefix %>/CORPUS_ADMIN_DSA"
-SetEnv GEONAMES_USERNAME "<%= @geonames-username %>"
+SetEnv GEONAMES_USERNAME "<%= @geonames_username %>"
--- a/dev/provisioning/modules/sysconfig/templates/corpus/local.env.erb Tue Oct 18 14:42:01 2016 +0530
+++ b/dev/provisioning/modules/sysconfig/templates/corpus/local.env.erb Tue Oct 18 14:38:56 2016 +0200
@@ -28,35 +28,35 @@
EASYRDF_HTTP_CLIENT_TIMEOUT=5000
-ELASTICSEARCH_URL=<@= @elasticsearch_host %>:<@= @elasticsearch_port %>
+ELASTICSEARCH_URL=<%= @elasticsearch_host %>:<%= @elasticsearch_port %>
ELASTICSEARCH_LOG_PATH='logs/elasticsearch.log'
ELASTICSEARCH_INDEX='corpus'
ELASTICSEARCH_SHARDS=1
ELASTICSEARCH_REPLICAS=1
-HANDLE_HOST=<%= @handle_host %>
-HANDLE_PORT=<%= @handle_port %>
-HANDLE_PREFIX=<%= @handle_prefix %>
-HANDLE_ADMIN_ID=<%= @handle_admin_id %>
+HANDLE_HOST=<%= @hdl_host %>
+HANDLE_PORT=<%= @hdl_web_port %>
+HANDLE_PREFIX=<%= @hdl_prefix %>
+HANDLE_ADMIN_ID=<%= @hdl_prefix_admin %>
-HANDLE_CERT_OR_PKEY="<%= @handle_cert_or_pkey %>"
-HANDLE_PASSWORD=<%= @handle_password %>
+HANDLE_CERT_OR_PKEY="/var/lib/handle/corpusadmpriv.pem"
+HANDLE_PASSWORD=<%= @hdl_key_pswd %>
-HANDLE_TEST_PREFIX=<%= @handle_test_prefix %>
+HANDLE_TEST_PREFIX=<%= @hdl_test_prefix %>
-HANDLE_TEST_CERT="corpusadmpkeycrt.pem"
-HANDLE_TEST_CERT_PASSWORD=NULL
-HANDLE_TEST_CERT_ADMIN_HANDLE="300:<%= @handle_test_prefix %>/CORPUS_ADMIN"
+HANDLE_TEST_CERT="/var/lib/handle/corpusadmpkeycrt.pem"
+HANDLE_TEST_CERT_PASSWORD=<%= @hdl_key_pswd %>
+HANDLE_TEST_CERT_ADMIN_HANDLE="300:<%= @hdl_test_prefix %>/CORPUS_ADMIN"
-HANDLE_TEST_RSA_KEY="corpusadmpriv.pem"
-HANDLE_TEST_RSA_PASSWORD=NULL
-HANDLE_TEST_RSA_ADMIN_HANDLE="300:<%= @handle_test_prefix %>/CORPUS_ADMIN_RSA"
+HANDLE_TEST_RSA_KEY="/var/lib/handle/corpusadmpriv.pem"
+HANDLE_TEST_RSA_PASSWORD=<%= @hdl_key_pswd %>
+HANDLE_TEST_RSA_ADMIN_HANDLE="300:<%= @hdl_test_prefix %>/CORPUS_ADMIN_RSA"
-HANDLE_TEST_DSA_KEY="corpusadmdsapriv.pem"
-HANDLE_TEST_DSA_PASSWORD=NULL
-HANDLE_TEST_DSA_ADMIN_HANDLE="300:<%= @handle_test_prefix %>/CORPUS_ADMIN_DSA"
+HANDLE_TEST_DSA_KEY="/var/lib/handle/corpusadmdsapriv.pem"
+HANDLE_TEST_DSA_PASSWORD=<%= @hdl_key_pswd %>
+HANDLE_TEST_DSA_ADMIN_HANDLE="300:<%= @hdl_test_prefix %>/CORPUS_ADMIN_DSA"
-GEONAMES_USERNAME="<%= @geonames-username %>"
+GEONAMES_USERNAME="<%= @geonames_username %>"