Skip to content
Snippets Groups Projects
Commit 0c8765bf authored by Marcos García de La Fuente's avatar Marcos García de La Fuente
Browse files

Updated vagrant box

parent d0281419
Branches
Tags
No related merge requests found
Showing
with 352 additions and 83 deletions
...@@ -23,7 +23,7 @@ Usage ...@@ -23,7 +23,7 @@ Usage
`cd` into the vagrant box directory and simply type `vagrant up`. `cd` into the vagrant box directory and simply type `vagrant up`.
That's all you need to do. It will build a brand new VirtalBox machine for you with everything you need to develop on Dolibarr. That's all you need to do. It will build a brand new VirtualBox machine for you with everything you need to develop on Dolibarr.
### Name resolution ### Name resolution
For easy access to the VM you need to setup name resolution to the machines IP. For easy access to the VM you need to setup name resolution to the machines IP.
...@@ -45,9 +45,16 @@ Somewhat bleeding edge vagrant box for develop branch related work. ...@@ -45,9 +45,16 @@ Somewhat bleeding edge vagrant box for develop branch related work.
- IP: 192.168.42.101 - IP: 192.168.42.101
- Vhost: dev.dolibarr.org - Vhost: dev.dolibarr.org
- OS: Debian Wheezy 7.5 - OS: Debian Wheezy 7.5 x64
- Webserver: Apache 2.2.22 - Webserver: Apache 2.2.22
- PHP: mod_php 5.5.13-1~dotdeb.1 - PHP: mod_php 5.5.14-1~dotdeb.1
Installed modules:
- cli
- curl
- gd
- imagick
- intl
- mcrypt
- Database: MySQL 5.5 - Database: MySQL 5.5
- Root user: root - Root user: root
- Root password: root - Root password: root
...@@ -55,7 +62,13 @@ Somewhat bleeding edge vagrant box for develop branch related work. ...@@ -55,7 +62,13 @@ Somewhat bleeding edge vagrant box for develop branch related work.
- Database user: user - Database user: user
- Database password: user - Database password: user
- Initial data: dev/initdata/mysqldump_dolibarr-3.5.0.sql - Initial data: dev/initdata/mysqldump_dolibarr-3.5.0.sql
- Database: PostgreSQL 9.3
- Adminer: lightweight database management. Access through http://192.168.42.101/adminer
- Debugger: XDebug - Debugger: XDebug
- Profiler: Xhprof - Profiler: Xhprof. Access through http://192.168.42.101/xhprof/xhprof_html
You can access MailCatcher to read all outgoing emails at http://192.168.42.101:1080 You can access MailCatcher to read all outgoing emails at http://192.168.42.101:1080
To access the machine you must use the following private keys:
- User root: located at puphpet/files/dot/ssh/root_rsa
- User vagrant: located at puphpet/files/dot/ssh/id_rsa
...@@ -25,11 +25,19 @@ Vagrant.configure("2") do |config| ...@@ -25,11 +25,19 @@ Vagrant.configure("2") do |config|
data['vm']['synced_folder'].each do |i, folder| data['vm']['synced_folder'].each do |i, folder|
if folder['source'] != '' && folder['target'] != '' if folder['source'] != '' && folder['target'] != ''
nfs = (folder['nfs'] == "true") ? "nfs" : nil if folder['sync_type'] == 'nfs'
if nfs == "nfs" config.vm.synced_folder "#{folder['source']}", "#{folder['target']}", id: "#{i}", type: "nfs"
config.vm.synced_folder "#{folder['source']}", "#{folder['target']}", id: "#{i}", type: nfs elsif folder['sync_type'] == 'smb'
config.vm.synced_folder "#{folder['source']}", "#{folder['target']}", id: "#{i}", type: "smb"
elsif folder['sync_type'] == 'rsync'
rsync_args = !folder['rsync']['args'].nil? ? folder['rsync']['args'] : ["--verbose", "--archive", "--delete", "-z"]
rsync_auto = !folder['rsync']['auto'].nil? ? folder['rsync']['auto'] : true
rsync_exclude = !folder['rsync']['exclude'].nil? ? folder['rsync']['exclude'] : [".vagrant/"]
config.vm.synced_folder "#{folder['source']}", "#{folder['target']}", id: "#{i}",
rsync__args: rsync_args, rsync__exclude: rsync_exclude, rsync__auto: rsync_auto, type: "rsync"
else else
config.vm.synced_folder "#{folder['source']}", "#{folder['target']}", id: "#{i}", type: nfs, config.vm.synced_folder "#{folder['source']}", "#{folder['target']}", id: "#{i}",
group: 'www-data', owner: 'www-data', mount_options: ["dmode=775", "fmode=764"] group: 'www-data', owner: 'www-data', mount_options: ["dmode=775", "fmode=764"]
end end
end end
...@@ -128,7 +136,14 @@ Vagrant.configure("2") do |config| ...@@ -128,7 +136,14 @@ Vagrant.configure("2") do |config|
end end
end end
config.vm.provision :shell, :path => "puphpet/shell/execute-files.sh" config.vm.provision :shell do |s|
s.path = "puphpet/shell/execute-files.sh"
s.args = ["exec-once", "exec-always"]
end
config.vm.provision :shell, run: "always" do |s|
s.path = "puphpet/shell/execute-files.sh"
s.args = ["startup-once", "startup-always"]
end
config.vm.provision :shell, :path => "puphpet/shell/important-notices.sh" config.vm.provision :shell, :path => "puphpet/shell/important-notices.sh"
if File.file?("#{dir}/puphpet/files/dot/ssh/id_rsa") if File.file?("#{dir}/puphpet/files/dot/ssh/id_rsa")
......
...@@ -29,10 +29,12 @@ vagrantfile-local: ...@@ -29,10 +29,12 @@ vagrantfile-local:
- '--hiera_config /vagrant/puphpet/puppet/hiera.yaml' - '--hiera_config /vagrant/puphpet/puppet/hiera.yaml'
- '--parser future' - '--parser future'
synced_folder: synced_folder:
PL1BkioqqvGY: jopH6005bn96:
source: ../../../ source: ../../../
target: /var/www target: /var/www
nfs: 'false' sync_type: default
rsync:
auto: 'false'
usable_port_range: 2200..2250 usable_port_range: 2200..2250
ssh: ssh:
host: null host: null
...@@ -71,7 +73,7 @@ apache: ...@@ -71,7 +73,7 @@ apache:
settings: settings:
user: www-data user: www-data
group: www-data group: www-data
default_vhost: false default_vhost: true
manage_user: false manage_user: false
manage_group: false manage_group: false
sendfile: 0 sendfile: 0
...@@ -79,7 +81,7 @@ apache: ...@@ -79,7 +81,7 @@ apache:
- php - php
- rewrite - rewrite
vhosts: vhosts:
CGyWQB0fx4x0: b2tOrs1TMtoF:
servername: dev.dolibarr.org servername: dev.dolibarr.org
docroot: /var/www/htdocs docroot: /var/www/htdocs
port: '80' port: '80'
...@@ -97,7 +99,7 @@ apache: ...@@ -97,7 +99,7 @@ apache:
nginx: nginx:
install: 0 install: 0
vhosts: vhosts:
jeF1sybIJ3V2: 0dU5luf5AnIe:
server_name: awesome.dev server_name: awesome.dev
server_aliases: server_aliases:
- www.awesome.dev - www.awesome.dev
...@@ -152,7 +154,7 @@ mysql: ...@@ -152,7 +154,7 @@ mysql:
root_password: root root_password: root
adminer: 0 adminer: 0
databases: databases:
2OfuuapoIqsl: V6H3W2FVB7Yq:
grant: grant:
- ALTER - ALTER
- CREATE - CREATE
...@@ -168,14 +170,14 @@ mysql: ...@@ -168,14 +170,14 @@ mysql:
password: user password: user
sql_file: /var/www/dev/initdata/mysqldump_dolibarr_3.5.0.sql sql_file: /var/www/dev/initdata/mysqldump_dolibarr_3.5.0.sql
postgresql: postgresql:
install: 0 install: '1'
settings: settings:
root_password: '123' root_password: root
user_group: postgres user_group: postgres
encoding: UTF8 encoding: UTF8
version: '9.3' version: '9.3'
databases: { } databases: { }
adminer: 0 adminer: '1'
mariadb: mariadb:
install: 0 install: 0
root_password: '123' root_password: '123'
......
ssh/id_rsa ssh/*
ssh/id_rsa.pub \ No newline at end of file
ssh/insecure_private_key
ssh/id_rsa.ppk
\ No newline at end of file
...@@ -279,8 +279,14 @@ if hash_key_equals($mailcatcher_values, 'install', 1) { ...@@ -279,8 +279,14 @@ if hash_key_equals($mailcatcher_values, 'install', 1) {
} }
if ! defined(Class['supervisord']) { if ! defined(Class['supervisord']) {
class{ 'puphpet::python::pip': }
class { 'supervisord': class { 'supervisord':
install_pip => true, install_pip => false,
require => [
Class['my_fw::post'],
Class['Puphpet::Python::Pip'],
],
} }
} }
...@@ -467,15 +473,16 @@ if hash_key_equals($apache_values, 'install', 1) { ...@@ -467,15 +473,16 @@ if hash_key_equals($apache_values, 'install', 1) {
$apache_vhosts = merge($apache_values['vhosts'], { $apache_vhosts = merge($apache_values['vhosts'], {
'default_vhost_80' => { 'default_vhost_80' => {
'servername' => 'default', 'servername' => 'default',
'serveraliases' => ['*'],
'docroot' => '/var/www/default', 'docroot' => '/var/www/default',
'port' => 80, 'port' => 80,
'default_vhost' => true,
}, },
'default_vhost_443' => { 'default_vhost_443' => {
'servername' => 'default', 'servername' => 'default',
'serveraliases' => ['*'],
'docroot' => '/var/www/default', 'docroot' => '/var/www/default',
'port' => 443, 'port' => 443,
'default_vhost' => true,
'ssl' => 1,
}, },
}) })
} else { } else {
...@@ -516,10 +523,10 @@ if hash_key_equals($apache_values, 'install', 1) { ...@@ -516,10 +523,10 @@ if hash_key_equals($apache_values, 'install', 1) {
create_resources(apache::vhost, { "${key}" => merge($vhost, { create_resources(apache::vhost, { "${key}" => merge($vhost, {
'custom_fragment' => template('puphpet/apache/custom_fragment.erb'), 'custom_fragment' => template('puphpet/apache/custom_fragment.erb'),
'ssl' => 'ssl' in $vhost and str2bool($vhost['ssl']) ? { true => true, default => false }, 'ssl' => 'ssl' in $vhost and str2bool($vhost['ssl']) ? { true => true, default => false },
'ssl_cert' => 'ssl_cert' in $vhost and $vhost['ssl_cert'] ? { undef => undef, '' => undef, default => $vhost['ssl_cert'] }, 'ssl_cert' => hash_key_true($vhost, 'ssl_cert') ? { true => $vhost['ssl_cert'], default => undef },
'ssl_key' => 'ssl_key' in $vhost and $vhost['ssl_key'] ? { undef => undef, '' => undef, default => $vhost['ssl_key'] }, 'ssl_key' => hash_key_true($vhost, 'ssl_cert') ? { true => $vhost['ssl_key'], default => undef },
'ssl_chain' => 'ssl_chain' in $vhost and $vhost['ssl_chain'] ? { undef => undef, '' => undef, default => $vhost['ssl_chain'] }, 'ssl_chain' => hash_key_true($vhost, 'ssl_cert') ? { true => $vhost['ssl_chain'], default => undef },
'ssl_certs_dir' => 'ssl_certs_dir' in $vhost and $vhost['ssl_certs_dir'] ? { undef => undef, '' => undef, default => $vhost['ssl_certs_dir'] } 'ssl_certs_dir' => hash_key_true($vhost, 'ssl_cert') ? { true => $vhost['ssl_certs_dir'], default => undef }
}) })
}) })
...@@ -662,10 +669,6 @@ if hash_key_equals($nginx_values, 'install', 1) { ...@@ -662,10 +669,6 @@ if hash_key_equals($nginx_values, 'install', 1) {
} }
} elsif hash_key_equals($hhvm_values, 'install', 1) { } elsif hash_key_equals($hhvm_values, 'install', 1) {
$fastcgi_pass = '127.0.0.1:9000' $fastcgi_pass = '127.0.0.1:9000'
set_php5_fpm_sock_group_and_user { 'hhvm':
require => Package['nginx'],
}
} else { } else {
$fastcgi_pass = '' $fastcgi_pass = ''
} }
...@@ -1096,7 +1099,7 @@ if hash_key_equals($xhprof_values, 'install', 1) ...@@ -1096,7 +1099,7 @@ if hash_key_equals($xhprof_values, 'install', 1)
} }
if hash_key_equals($apache_values, 'install', 1) { if hash_key_equals($apache_values, 'install', 1) {
$xhprof_webroot_location = $puphpet::params::apache_webroot_location $xhprof_webroot_location = '/var/www/default'
$xhprof_webserver_service = 'httpd' $xhprof_webserver_service = 'httpd'
} elsif hash_key_equals($nginx_values, 'install', 1) { } elsif hash_key_equals($nginx_values, 'install', 1) {
$xhprof_webroot_location = $puphpet::params::nginx_webroot_location $xhprof_webroot_location = $puphpet::params::nginx_webroot_location
...@@ -1216,11 +1219,11 @@ if hash_key_equals($mysql_values, 'install', 1) { ...@@ -1216,11 +1219,11 @@ if hash_key_equals($mysql_values, 'install', 1) {
if hash_key_equals($mysql_values, 'adminer', 1) and $mysql_php_installed { if hash_key_equals($mysql_values, 'adminer', 1) and $mysql_php_installed {
if hash_key_equals($apache_values, 'install', 1) { if hash_key_equals($apache_values, 'install', 1) {
$mysql_adminer_webroot_location = $puphpet::params::apache_webroot_location $mysql_adminer_webroot_location = '/var/www/default'
} elsif hash_key_equals($nginx_values, 'install', 1) { } elsif hash_key_equals($nginx_values, 'install', 1) {
$mysql_adminer_webroot_location = $puphpet::params::nginx_webroot_location $mysql_adminer_webroot_location = $puphpet::params::nginx_webroot_location
} else { } else {
$mysql_adminer_webroot_location = $puphpet::params::apache_webroot_location $mysql_adminer_webroot_location = '/var/www/default'
} }
class { 'puphpet::adminer': class { 'puphpet::adminer':
...@@ -1329,11 +1332,11 @@ if hash_key_equals($postgresql_values, 'install', 1) { ...@@ -1329,11 +1332,11 @@ if hash_key_equals($postgresql_values, 'install', 1) {
if hash_key_equals($postgresql_values, 'adminer', 1) and $postgresql_php_installed { if hash_key_equals($postgresql_values, 'adminer', 1) and $postgresql_php_installed {
if hash_key_equals($apache_values, 'install', 1) { if hash_key_equals($apache_values, 'install', 1) {
$postgresql_adminer_webroot_location = $puphpet::params::apache_webroot_location $postgresql_adminer_webroot_location = '/var/www/default'
} elsif hash_key_equals($nginx_values, 'install', 1) { } elsif hash_key_equals($nginx_values, 'install', 1) {
$postgresql_adminer_webroot_location = $puphpet::params::nginx_webroot_location $postgresql_adminer_webroot_location = $puphpet::params::nginx_webroot_location
} else { } else {
$postgresql_adminer_webroot_location = $puphpet::params::apache_webroot_location $postgresql_adminer_webroot_location = '/var/www/default'
} }
class { 'puphpet::adminer': class { 'puphpet::adminer':
...@@ -1364,7 +1367,7 @@ define postgresql_db ( ...@@ -1364,7 +1367,7 @@ define postgresql_db (
$table = "${name}.*" $table = "${name}.*"
exec{ "${name}-import": exec{ "${name}-import":
command => "psql ${name} < ${sql_file}", command => "sudo -u postgres psql ${name} < ${sql_file}",
logoutput => true, logoutput => true,
refreshonly => $refresh, refreshonly => $refresh,
require => Postgresql::Server::Db[$name], require => Postgresql::Server::Db[$name],
...@@ -1491,11 +1494,11 @@ if hash_key_equals($mariadb_values, 'install', 1) { ...@@ -1491,11 +1494,11 @@ if hash_key_equals($mariadb_values, 'install', 1) {
if hash_key_equals($mariadb_values, 'adminer', 1) and $mariadb_php_installed { if hash_key_equals($mariadb_values, 'adminer', 1) and $mariadb_php_installed {
if hash_key_equals($apache_values, 'install', 1) { if hash_key_equals($apache_values, 'install', 1) {
$mariadb_adminer_webroot_location = $puphpet::params::apache_webroot_location $mariadb_adminer_webroot_location = '/var/www/default'
} elsif hash_key_equals($nginx_values, 'install', 1) { } elsif hash_key_equals($nginx_values, 'install', 1) {
$mariadb_adminer_webroot_location = $puphpet::params::nginx_webroot_location $mariadb_adminer_webroot_location = $puphpet::params::nginx_webroot_location
} else { } else {
$mariadb_adminer_webroot_location = $puphpet::params::apache_webroot_location $mariadb_adminer_webroot_location = '/var/www/default'
} }
class { 'puphpet::adminer': class { 'puphpet::adminer':
...@@ -1662,7 +1665,7 @@ if $beanstalkd_values == undef { ...@@ -1662,7 +1665,7 @@ if $beanstalkd_values == undef {
} }
if hash_key_equals($apache_values, 'install', 1) { if hash_key_equals($apache_values, 'install', 1) {
$beanstalk_console_webroot_location = "${puphpet::params::apache_webroot_location}/beanstalk_console" $beanstalk_console_webroot_location = '/var/www/default/beanstalk_console'
} elsif hash_key_equals($nginx_values, 'install', 1) { } elsif hash_key_equals($nginx_values, 'install', 1) {
$beanstalk_console_webroot_location = "${puphpet::params::nginx_webroot_location}/beanstalk_console" $beanstalk_console_webroot_location = "${puphpet::params::nginx_webroot_location}/beanstalk_console"
} else { } else {
......
#
# hash_key_true.rb
#
module Puppet::Parser::Functions
newfunction(:hash_key_true, :type => :rvalue, :doc => <<-'ENDHEREDOC') do |args|
Returns true if the key within hash is truthy
ENDHEREDOC
unless args.length == 2
raise Puppet::ParseError, ("hash_key_true(): wrong number of arguments (#{args.length}; must be 2)")
end
arr = args[0]
key = args[1]
unless arr.is_a?(Hash)
return false
end
unless arr.has_key?(key)
return false
end
if arr[key].nil?
return false
end
if arr[key].empty?
return false
end
if arr[key] == 'false'
return false
end
return true
end
end
...@@ -69,17 +69,39 @@ class puphpet::hhvm( ...@@ -69,17 +69,39 @@ class puphpet::hhvm(
} }
} }
'centos': { 'centos': {
$jemalloc_url = 'http://files.puphpet.com/centos6/jemalloc-3.6.0-1.el6.x86_64.rpm'
$jemalloc_download_location = '/.puphpet-stuff/jemalloc-3.6.0-1.el6.x86_64.rpm'
$require = defined(Class['my_fw::post']) ? {
true => Class['my_fw::post'],
default => [],
}
exec { "download jemalloc to ${download_location}":
creates => $download_location,
command => "wget --quiet --tries=5 --connect-timeout=10 -O '${jemalloc_download_location}' '${jemalloc_url}'",
timeout => 30,
path => '/usr/bin',
require => $require
}
package { 'jemalloc':
ensure => latest,
provider => yum,
source => $download_location,
require => Exec["download jemalloc to ${download_location}"],
}
yum::managed_yumrepo { 'hop5': yum::managed_yumrepo { 'hop5':
descr => 'hop5 repository', descr => 'hop5 repository',
baseurl => 'http://www.hop5.in/yum/el6/', baseurl => 'http://www.hop5.in/yum/el6/',
gpgkey => 'file:///etc/pki/rpm-gpg/RPM-GPG-KEY-HOP5', gpgkey => 'file:///etc/pki/rpm-gpg/RPM-GPG-KEY-HOP5',
enabled => 1, enabled => 1,
gpgcheck => 0, gpgcheck => 0,
priority => 1 priority => 1,
} }
} }
} }
if $real_webserver == 'apache2' { if $real_webserver == 'apache2' {
if ! defined(Class['apache::mod::mime']) { if ! defined(Class['apache::mod::mime']) {
class { 'apache::mod::mime': } class { 'apache::mod::mime': }
......
class puphpet::python::pip {
Exec { path => [ '/usr/bin/', '/usr/local/bin', '/bin', '/usr/local/sbin', '/usr/sbin', '/sbin' ] }
if ! defined(Package['python-setuptools']) {
package { 'python-setuptools': }
}
exec { 'easy_install pip':
unless => 'which pip',
require => Package['python-setuptools'],
}
if $::osfamily == 'RedHat' {
exec { 'rhel pip_provider_name_fix':
command => 'alternatives --install /usr/bin/pip-python pip-python /usr/bin/pip 1',
subscribe => Exec['easy_install pip'],
unless => 'which pip-python',
}
}
}
fixtures: fixtures:
repositories: repositories:
stdlib: "git://github.com/puppetlabs/puppetlabs-stdlib" 'stdlib':
concat: "git://github.com/puppetlabs/puppetlabs-concat" repo: 'git://github.com/puppetlabs/puppetlabs-stdlib'
ref: '4.1.0'
'concat':
repo: 'git://github.com/puppetlabs/puppetlabs-concat'
ref: '1.0.1'
symlinks: symlinks:
supervisord: "#{source_dir}" supervisord: "#{source_dir}"
\ No newline at end of file
language: ruby language: ruby
bundler_args: --without development bundler_args: --without development
script: "bundle exec rake spec lint" script: "bundle exec rake test"
rvm: rvm:
- 1.8.7 - 1.8.7
- 1.9.3 - 1.9.3
- 2.0.0 - 2.0.0
env: env:
matrix: - PUPPET_VERSION="~> 2.7.0"
- PUPPET_GEM_VERSION="~> 2.7.0" - PUPPET_VERSION="~> 3.1.0"
- PUPPET_GEM_VERSION="~> 3.3.0" - PUPPET_VERSION="~> 3.2.0"
- PUPPET_GEM_VERSION="~> 3.4.0" - PUPPET_VERSION="~> 3.3.0"
- PUPPET_VERSION="~> 3.4.0"
- PUPPET_VERSION="~> 3.5.0"
- PUPPET_VERSION="~> 3.6.0"
matrix: matrix:
exclude: exclude:
- rvm: 2.0.0
env: PUPPET_VERSION="~> 2.7.0"
- rvm: 1.9.3 - rvm: 1.9.3
env: PUPPET_GEM_VERSION="~> 2.7.0" env: PUPPET_VERSION="~> 2.7.0"
- rvm: 2.0.0 - rvm: 2.0.0
env: PUPPET_GEM_VERSION="~> 2.7.0" env: PUPPET_VERSION="~> 3.1.0"
- rvm: 1.8.7
env: PUPPET_VERSION="~> 3.2.0"
notifications: notifications:
email: false email: false
......
2014-06-20 - v0.4.0
Fixes:
- Removed root as group and replaced with uid 0 to enhance system
compatibility
Enhancements:
- Made package provider a user definable param see supervisord::package_provider and README for details of how to change this.
- All define types can now be automatically pulled in from hiera see example https://github.com/ajcrowe/puppet-supervisord#configure-a-program
- You can now override the default include path of $config_include/*.conf with your own array using $config_dirs. Bear in mind this would need to include whatever you set $config_include to be, with *.conf on the end.
Many thanks for the PRs from @jasperla, @mvantellingen for the bug report on the service name and @hasc for the enhancement ideas.
2014-06-06 - v0.3.3
Fixes:
- Fixed typo in stopwaitsec param, should have been stopwaitsecs, thanks to @rchrd2
2014-05-03 - v0.3.2
Changes:
- Added supervisord::executable_ctl variable for supervisorctl binary path, thanks to @bpgoldsb
2014-04-22 - v0.3.1
Fixes:
- Fixed typo in unix_socket_group param, thanks to @dig412
2014-03-11 - v0.3.0
Fixes:
- Fixed typo in fcgi config
- Fixed typo in supervisord config with minfds and minprocs, thanks to @peefourtee
- Typo in README fixed thanks to @hopkinsth
- Removed refreshonly from pip_install exec resource
- Number of syntax fixes thanks to `puppet lint`
Important Changes:
- Lots of input validation has been added **PLEASE** check your config works before upgrading!
- Changed init_extras naming to defaults and cleaned things up.
- Starting and stopping apps is now done with supervisorctl commands to avoid service restarts
Other Changes:
- CSV functions now order things consistently
- Included description for classes and functions
- Expanded spec testing built with Travis CI
- Added beaker acceptance tests
- Added greater validation of various parameters
- Added coverage reporting for resources
To-Do:
- Add support for additional OS families such as Solaris.
2013-10-31 - v0.2.3 2013-10-31 - v0.2.3
Fixes: Fixes:
......
source 'https://rubygems.org' source 'https://rubygems.org'
group :development, :test do group :test do
gem 'rake' gem 'rake'
gem 'puppetlabs_spec_helper', :require => false gem 'puppet-lint'
gem 'rspec-system-puppet', '~> 2.0' gem 'puppet-syntax'
gem 'puppet-lint', '~> 0.3.2' gem 'puppetlabs_spec_helper'
gem 'rspec-puppet', :git => 'https://github.com/rodjek/rspec-puppet.git' , :ref => 'c44381a240ec420d4ffda7bffc55ee4d9c08d682'
gem 'rspec', '2.14.1'
end end
if puppetversion = ENV['PUPPET_GEM_VERSION'] group :development do
gem 'puppet', puppetversion, :require => false gem 'travis'
gem 'travis-lint'
gem 'beaker'
gem 'beaker-rspec'
gem 'pry'
gem 'guard-rake'
end
if puppetversion = ENV['PUPPET_VERSION']
gem 'puppet', puppetversion
else else
gem 'puppet', :require => false gem 'puppet', '~> 3.4.0'
end end
name 'ajcrowe-supervisord' name 'ajcrowe-supervisord'
version '0.2.3' version '0.4.0'
source 'git@github.com/ajcrowe/puppet-supervisord.git' source 'git@github.com/ajcrowe/puppet-supervisord.git'
author 'Alex Crowe' author 'Alex Crowe'
license 'Apache License, Version 2.0' license 'Apache License, Version 2.0'
......
...@@ -35,6 +35,12 @@ This will download [setuptool](https://bitbucket.org/pypa/setuptools) and instal ...@@ -35,6 +35,12 @@ This will download [setuptool](https://bitbucket.org/pypa/setuptools) and instal
You can pass a specific url with `$setuptools_url = 'url'` You can pass a specific url with `$setuptools_url = 'url'`
### Install without pip
If you want to use your system package manager you can specify that with `supervisord::package_provider`.
You'll also likely need to adjust the `supervisord::service_name` to match that installed by the system package. If you're using Debian or Redhat OS families you'll also want to disable the init scripts with `supervisord::install_init = false`.
Note: Only Debian and RedHat families have an init script currently. Note: Only Debian and RedHat families have an init script currently.
### Configure a program ### Configure a program
...@@ -61,20 +67,58 @@ supervisord::program { 'myprogram': ...@@ -61,20 +67,58 @@ supervisord::program { 'myprogram':
} }
``` ```
Or you can fully define your programs in hiera:
```yaml
supervisord::programs:
'myprogram':
command: 'command --args'
autostart: yes
autorestart: 'true'
environment:
HOME: '/home/myuser'
PATH: '/bin:/sbin:/usr/bin:/usr/sbin'
SECRET: 'mysecret'
```
### Configure a group ### Configure a group
```ruby ```ruby
supervisord::group { 'mygroup': supervisord::group { 'mygroup':
priority => 100, priority => 100,
program => ['program1', 'program2', 'program3'] programs => ['program1', 'program2', 'program3']
}
```
### Configure an eventlistener
```ruby
supervisord::eventlistener { 'mylistener':
command => 'command --args',
events => ['PROCESS_STATE', 'PROCESS_STATE_START']
priority => '100',
env_var => 'my_common_envs'
}
```
### Run supervisorctl Commands
Should you need to run a sequence of command with `supervisorctl` you can use the define type `supervisord::supervisorctl`
```ruby
supervisord::supervisorctl { 'restart_myapp':
command => 'restart',
process => 'myapp'
} }
``` ```
You can also issue a command without specifying a process.
### Development ### Development
If you have suggestions or improvements please file an issue or pull request, i'll try and sort them as quickly as possble. If you have suggestions or improvements please file an issue or pull request, i'll try and sort them as quickly as possble.
If you submit a pull please try and include tests for the new functionality. The module is tested with [Travis-CI](https://travis-ci.org/ajcrowe/puppet-supervisord). If you submit a pull please try and include tests for the new functionality/fix. The module is tested with [Travis-CI](https://travis-ci.org/ajcrowe/puppet-supervisord).
### Credits ### Credits
......
require 'puppetlabs_spec_helper/rake_tasks' require 'puppetlabs_spec_helper/rake_tasks'
require 'puppet-lint/tasks/puppet-lint' require 'puppet-lint/tasks/puppet-lint'
require 'rspec-system/rake_task' require 'puppet-syntax/tasks/puppet-syntax'
PuppetLint.configuration.send('disable_80chars') PuppetLint.configuration.send('disable_80chars')
PuppetLint.configuration.send('disable_class_inherits_from_params_class') PuppetLint.configuration.send('disable_class_inherits_from_params_class')
PuppetLint.configuration.send('disable_documentation') PuppetLint.configuration.send('disable_quoted_booleans')
PuppetLint.configuration.send('disable_autoloader_layout')
exclude_paths = [
"pkg/**/*",
"vendor/**/*",
"spec/**/*",
]
PuppetLint.configuration.ignore_paths = exclude_paths
PuppetSyntax.exclude_paths = exclude_paths
desc "Acceptance Tests"
RSpec::Core::RakeTask.new(:acceptance) do |t|
t.pattern = 'spec/acceptance'
end
desc "Test Suite"
task :test => [
:lint,
:syntax,
:spec
]
\ No newline at end of file
# #
# Converts the array to a csv string # Converts the array to a csv string
# #
#
# $array = [ 'string1', 'string2', 'string3' ] # $array = [ 'string1', 'string2', 'string3' ]
# #
# becomes: # becomes:
# #
# $string = "string1,string2,string3" # $string = "string1,string2,string3"
# #
module Puppet::Parser::Functions module Puppet::Parser::Functions
newfunction(:array2csv, :type => :rvalue, :doc => <<-'EOS' newfunction(:array2csv, :type => :rvalue, :doc => <<-'EOS'
Returns a sorted csv formatted string from an array in the form Returns a sorted csv formatted string from an array in the form
......
# #
# Converts the hash to a csv string # Converts the hash to a csv string
# #
#
# $hash = { # $hash = {
# HOME => '/home/user', # HOME => '/home/user',
# ENV1 => 'env1', # ENV1 => 'env1',
...@@ -12,7 +11,6 @@ ...@@ -12,7 +11,6 @@
# #
# $string = "HOME='/home/user',ENV1='env1',SECRET='secret'" # $string = "HOME='/home/user',ENV1='env1',SECRET='secret'"
# #
module Puppet::Parser::Functions module Puppet::Parser::Functions
newfunction(:hash2csv, :type => :rvalue, :doc => <<-'EOS' newfunction(:hash2csv, :type => :rvalue, :doc => <<-'EOS'
Returns a csv formatted string from an hash in the form Returns a csv formatted string from an hash in the form
......
# Class: supervisord::config
#
# Configuration class for supervisor init and conf directories
#
class supervisord::config inherits supervisord { class supervisord::config inherits supervisord {
file { [ "${supervisord::config_include}", "${supervisord::log_path}"]: file { $supervisord::config_include:
ensure => directory,
owner => 'root',
mode => '0755'
}
file { $supervisord::log_path:
ensure => directory, ensure => directory,
owner => 'root', owner => 'root',
mode => '0755' mode => '0755'
...@@ -15,30 +25,26 @@ class supervisord::config inherits supervisord { ...@@ -15,30 +25,26 @@ class supervisord::config inherits supervisord {
} }
if $supervisord::install_init { if $supervisord::install_init {
$osname = downcase($::osfamily)
file { '/etc/init.d/supervisord': file { '/etc/init.d/supervisord':
ensure => present, ensure => present,
owner => 'root', owner => 'root',
mode => '0755', mode => '0755',
content => template("supervisord/init/${osname}_init.erb") content => template("supervisord/init/${::osfamily}/init.erb")
} }
if $supervisord::init_extras { if $supervisord::init_defaults {
file { $supervisord::init_extras: file { $supervisord::init_defaults:
ensure => present, ensure => present,
owner => 'root', owner => 'root',
mode => '0755', mode => '0755',
content => template("supervisord/init/${osname}_extra.erb") content => template("supervisord/init/${::osfamily}/defaults.erb")
} }
} }
} }
concat { $supervisord::config_file: concat { $supervisord::config_file:
owner => 'root', owner => 'root',
group => 'root', group => '0',
mode => '0755' mode => '0755'
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment