Skip to content
This repository has been archived by the owner on Jul 26, 2024. It is now read-only.

Switch to ajcrowe/puppet-supervisord #70

Merged
merged 1 commit into from
Nov 17, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .fixtures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ fixtures:
repositories:
stdlib: 'https://github.com/puppetlabs/puppetlabs-stdlib.git'
nodejs: 'https://github.com/voxpupuli/puppet-nodejs.git'
forge_modules:
supervisor: 'proletaryo-supervisor'
supervisord: 'https://github.com/ajcrowe/puppet-supervisord'
concat: "https://github.com/puppetlabs/puppetlabs-concat.git"
symlinks:
ghost: "#{source_dir}"
37 changes: 14 additions & 23 deletions manifests/blog.pp
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
Stdlib::HTTPSUrl $source = 'https://ghost.org/zip/ghost-latest.zip',
Boolean $manage_npm_registry = true,
Stdlib::HTTPSUrl $npm_registry = 'https://registry.npmjs.org/',
Boolean $use_supervisor = true,
Boolean $autorestart = true,
Boolean $use_supervisord = true, # User supervisor module to setup service for blog
Boolean $autorestart = true, # Restart on crash
Stdlib::Absolutepath $stdout_logfile = "/var/log/ghost_${title}.log",
Stdlib::Absolutepath $stderr_logfile = "/var/log/ghost_${title}_err.log",
Boolean $manage_config = true,
Expand Down Expand Up @@ -113,8 +113,8 @@
}
}

if $use_supervisor {
require supervisor
if $use_supervisord {
require supervisord

case $::osfamily {
'redhat': {
Expand All @@ -128,25 +128,16 @@
}
}

Class['supervisor']
-> supervisor::program { "ghost_${blog}":
command => "node ${home}/index.js",
autorestart => $autorestart,
user => $user,
group => $group,
directory => $home,
stdout_logfile => $stdout_logfile,
stderr_logfile => $stderr_logfile,
environment => 'NODE_ENV="production"',
}

~> exec { 'supervisor::update':
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure if this is necessary with the new module; this seems to just be updating supervisord itself, not the created program, so I think the module should handle that.

command => "${path_bin}/supervisorctl reread && ${path_bin}/supervisorctl update",
user => 'root',
group => 'root',
logoutput => on_failure,
refreshonly => true,
require => Service['supervisord'],
Class['supervisord']
-> supervisord::program { "ghost_${blog}":
command => "node ${home}/index.js",
autorestart => $autorestart,
user => $user,
directory => $home,
stdout_logfile => $stdout_logfile,
stderr_logfile => $stderr_logfile,
program_environment => { 'NODE_ENV' => 'production' },
notify => Service['supervisord'],
}
}
}
4 changes: 2 additions & 2 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
"version_requirement": ">= 1.3.0 < 2.0.0"
},
{
"name": "proletaryo/supervisor",
"version_requirement": ">= 0.5.3 < 2.0.0"
"name": "ajcrowe/supervisord",
"version_requirement": ">= 0.6.0 < 1.0.0"
}
]
}
3 changes: 2 additions & 1 deletion spec/defines/blog_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
let :facts do
{
osfamily: 'Debian',
lsbdistid: 'Ubuntu'
operatingsystem: 'Ubuntu',
operatingsystemmajrelease: '14.04'
}
end

Expand Down