# IMPORTANT: Be sure you have checked the values below, appropriately# configured 'config/database.yml' in your DASHBOARD_HOME, and# created and migrated the database.# Uncomment the line below to start Puppet Dashboard.START=yes
# Location where puppet-dashboard is installed:DASHBOARD_HOME=/usr/share/puppet-dashboard
# User which runs the puppet-dashboard program:DASHBOARD_USER=www-data
# Ruby version to run the puppet-dashboard as:DASHBOARD_RUBY=/usr/bin/ruby
# Rails environment in which puppet-dashboard runs:DASHBOARD_ENVIRONMENT=production
# Network interface which puppet-dashboard web server is running at:DASHBOARD_IFACE=0.0.0.0
# Port on which puppet-dashboard web server is running at, note that if the# puppet-dashboard user is not root, it has to be a > 1024:DASHBOARD_PORT=3000
We’ll also use Delayed Job Workers to ensure data arrives in full even when there’s high demand on the Dashboard:
1
2
3
4
5
6
7
8
9
10
# IMPORTANT: Be sure you have checked the values below, appropriately# configured 'config/database.yml' in your DASHBOARD_HOME, and# created and migrated the database.. /etc/default/puppet-dashboard
START=yes
# Number of dashboard workers to start. This will be the number of jobs that# can be concurrently processed. A simple recommendation would be to start# with the number of cores you have available.NUM_DELAYED_JOB_WORKERS=2
You can also adjust the NUM_DELAYED_JOB_WORKERS parameter if needed.
To start, we need to initialize the database with the mysql*secure_installation command (for more information, see this documentation). Now we can create a MySQL database and a dedicated user:
CREATE DATABASE puppet_dashboard CHARACTER SET utf8;
CREATE USER 'puppetdash_user'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON puppet_dashboard.* TO 'puppetdash_user'@'localhost';
flush privileges;
We’ll modify the MySQL configuration to increase the maximum packet size by adjusting a value. Edit your MySQL configuration in the ‘mysqld’ section and set max_allowed_packet to at least 32M:
1
2
3
4
5
6
[...][mysqld]# Puppet Dashboard requirements:# Allowing 32MB allows an occasional 17MB row with plenty of spare roommax_allowed_packet= 32M
[...]
Then restart MySQL.
Now we’ll modify the default configuration to match our new MySQL database and user. Edit the production section in the following configuration file:
For Puppet Master, we need to tell it to send reports not just as files (in the /var/lib/puppet/reports directory), but also to the MySQL database. To do this, edit the configuration file and add this:
If like me you use your Puppet Dashboard on the same machine as Puppet Master, it’s cleaner to hide Puppet Dashboard’s port 3000. For this, we’ll use a proxy with Nginx:
1
2
3
4
5
6
7
8
9
10
11
12
13
upstream puppet-prd-dash.deimos.fr:3000 { server unix:/usr/share/puppet-dashboard/tmp/sockets/dashboard.0.sock;
server unix:/usr/share/puppet-dashboard/tmp/sockets/dashboard.1.sock;
server unix:/usr/share/puppet-dashboard/tmp/sockets/dashboard.2.sock;
}server { root /usr/share/puppet-dashboard/public;
location / { proxy_pass http://puppet-prd-dash.deimos.fr:3000;
}}
And we enable the new configuration:
1
2
3
cd /etc/nginx/sites-available
ln -s /etc/nginx/sites-enabled/puppet-dashboard .
/etc/init.d/nginx restart
To avoid performance issues as the database fills up, it’s better to purge and optimize it afterwards. We’ll create a crontab for this work to be done every month:
If you want to import all Puppet nodes at once into your Dashboard without waiting for synchronization:
1
2
cd /usr/share/puppet-dashboard
for i in $(puppetca -la | awk -F\"'{ print $2 }' | grep -v `hostname`) ; do rake RAILS_ENV=production node:add name=$i ; done
> rake RAILS_ENV=production db:migrate
NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
Gem.source_index called from /usr/share/puppet-dashboard/vendor/rails/railties/lib/rails/gem_dependency.rb:21.
NOTE: Gem::SourceIndex#initialize is deprecated with no replacement. It will be removed on or after 2011-11-01.
Gem::SourceIndex#initialize called from /usr/share/puppet-dashboard/vendor/rails/railties/lib/rails/vendor_gem_source_index.rb:100.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /usr/lib/ruby/1.9.1/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /usr/lib/ruby/1.9.1/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /usr/lib/ruby/1.9.1/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /usr/lib/ruby/1.9.1/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /usr/lib/ruby/1.9.1/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /usr/lib/ruby/1.9.1/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /usr/lib/ruby/1.9.1/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /usr/lib/ruby/1.9.1/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /usr/lib/ruby/1.9.1/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /usr/lib/ruby/1.9.1/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /usr/lib/ruby/1.9.1/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /usr/lib/ruby/1.9.1/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /usr/lib/ruby/1.9.1/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /usr/lib/ruby/1.9.1/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /usr/lib/ruby/1.9.1/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /usr/lib/ruby/1.9.1/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /usr/lib/ruby/1.9.1/rubygems/source_index.rb:91.
rake aborted!
cannot load such file -- ftools
(See full trace by running task with --trace)
It’s because the Ruby version you’re using doesn’t match what Puppet Dashboard requires. On Debian 7, you’re using 1.9.1 by default and you need to switch to 1.8 (hopefully they’ll update the dashboard soon). We’ll install some prerequisites:
If you encounter this type of error message in Puppet Dashboard when launching Puppet runs from Mcollective, you need to work on the puppet manifest, to comment this line:
1
2
3
4
5
6
7
8
9
[...]service {
'puppet-srv' :
name=>'puppet',
# Let this line commented if you're using Puppet Dashboard#ensure => stopped,enable=>false }
[...]