环境:
- ubuntu 10.04
- puppet master server已经安装完成
- Ruby or Ruby Enterprise Edition version 1.8.7 — Dashboard 1.2 no longer supports older versions of Ruby, and Ruby 1.9.2 is not yet fully supported.
- RubyGems
- Rake version 0.8.3 or newer
- MySQL database server version 5.x
- Ruby-MySQL bindings version 2.7.x or 2.8.x
安装:
- 安装operating system packages
- apt-get install -y build-essential irb libmysql-ruby libmysqlclient-dev \
- libopenssl-ruby libreadline-ruby mysql-server rake rdoc ri ruby ruby-dev
- 使用script 安装 RubyGems package
- URL="http://production.cf.rubygems.org/rubygems/rubygems-1.3.7.tgz"
- PACKAGE=$(echo $URL | sed "s/\.[^\.]*$//; s/^.*\///")
- cd $(mktemp -d /tmp/install_rubygems.XXXXXXXXXX) && \
- wget -c -t10 -T20 -q $URL && \
- tar xfz $PACKAGE.tgz && \
- cd $PACKAGE && \
- sudo ruby setup.rb
- 创建链接代替gem1.8
- update-alternatives --install /usr/bin/gem gem /usr/bin/gem1.8 1
-
Installing Dashboard
- $ sudo apt-get update
- sudo vim /etc/puppet-dashboard/database.yml
- $ sudo apt-get install puppet-dashboard
- 配置mysql数据库
我自己用apt装完Dashboard发现相关数据库的配置并没有自动生成,需要手动配置。
- #--创建数据库--
- $ sudo mysql -uroot -p(密码)
- mysql> create database dashboard default charset utf8;
- Query OK, 1 row affected (0.00 sec)
- mysql> use dashboard
- Database changed
- mysql> grant all on dashboard.* to dashboard@localhost identified by ‘dashboard’ ;
- Query OK, 0 rows affected (0.02 sec)
- mysql> flush privileges;
- Query OK, 0 rows affected (0.00 sec)
- #--数据库优化
- $ sudo vim /etc/mysql/my.cnf
- max_allowed_packet = 32M
- 修改database.yml
- sudo vim /etc/puppet-dashboard/database.yml
- production: database: dashboard username: dashboard password: mysql encoding: utf8 adapter: mysql
- 使用rake任务创建刚从在config / database.yml文件设置的数据库
- $sudo rake RAILS_ENV=production db:create
- $sudo gem install mysql
- $sudo rake RAILS_ENV=production db:migrate(为典型的生产环境配置)
- 启动dashboard
- $cd /usr/share/puppet-dashboard/
- $sudo ./script/server -e production -d
- #可以使用script/server –help查看更详细的用法
- #可以使用http://ip:3000进行查看,ip为安装dashboard的机器更多操作的图就不显示出来了。
- dashboard server(master) 配置
- # puppet.conf (on puppet master)
- [master]
- # These are needed when the puppetmaster is run by passenger
- # and can safely be removed if webrick is used.
- ssl_client_header = SSL_CLIENT_S_DN
- ssl_client_verify_header = SSL_CLIENT_VERIFY
- reports = store, http
- reporturl = http://127.0.0.1:3000/reports/upload
- agent 配置
- # puppet.conf (on each agent)
- [agent]
- report = true
- 在dashboard主机上再执行
- cp /usr/local/puppet-dashboard/ext/puppet/puppet_dashboard.rb /usr/lib/ruby/site_ruby/1.8/puppet/reports/
- rake RAILS_ENV=production reports:import 导入日志
- 使用监控脚本
- sudo env RAILS_ENV=production /usr/share/puppet-dashboard/script/delayed_job -p dashboard -n 4 -m start
所有配置完成后重启相应的服务,登录http://ip:3000,查看效果。
如有疑问可查看官方文档:http://docs.puppetlabs.com/dashboard/manual/1.2/bootstrapping.html