Puppet 实验十一 ubunto 安装 puppet-dashboard 仪表盘

用centos 搞了3-4天仪表盘仍然有各种报错,索性祭出终极大法,换Ubuntu

ubuntu默认没开ssh,无法远程,先开sshd

sudo apt-get install openssh-server

sudo /etc/init.d/ssh start

eed75266271e425f8d178a159791e523

先下载一些库

apt-get install git libmysqlclient-dev libpq-dev libsqlite3-dev ruby-dev libxml2-dev libxslt-dev nodejs

701898111f384099bca27e6adef2dd58

git也要安装下

sudo apt-get update

sudo apt-get install git

8f8987c3c22a4fc3913afd6897c59fea

下载仪表盘程序

cd /usr/share

sudo mkdir -pv puppet-dashboar

cd puppet-dashboard

sudo git clone https://github.com/sodabrew/puppet-dashboard.git

104e2232c5654cf8b8e52ab4f78b12f0

安装mariadb

sudo apt install mariadb-server

fffa2051b16045f3b7478b8fcf159bb1

启动下

/etc/init.d/mysql start

d833f6fb53c1477da616572fc07d10ef

sudo systemctl stop mysql

sudo mysqld_safe --skip-grant-tables &

mysql -u root

select Host,User,plugin from mysql.user where User='root';

update mysql.user set plugin='mysql_native_password';

update mysql.user set password=PASSWORD("12345.coM") where User='root';

flush privileges;

systemctl stop mysql

mysql就不贴图了

配置下mysql缓存

vim /etc/mysql/my.cnf

加一行

max_allowed_packet = 32M

systemctl start mysql

创建表和用户

CREATE DATABASE dashboard_production CHARACTER SET utf8;

CREATE USER 'dashboard'@'localhost' IDENTIFIED BY 'my_password';

GRANT ALL PRIVILEGES ON dashboard_production.* TO 'dashboard'@'localhost';

把样本复制出来,填入数据库连接信息

sudo cp config/settings.yml.example config/settings.yml

sudo cp config/database.yml.example config/database.yml

sudo vim config/database.yml

0d2762e30a5745e29fed56b5e0a3a64f

安装gem,并且用gem 部署bundle

sudo gem install bundler

6e6aa82377db41db862ecee70efec8cf

sudo bundle install --deployment

一路顺畅

30d93e9cfb1b46289e2f48531d204c1a

设置数据库和编译

sudo RAILS_ENV=production bundle exec rake db:setup

b31ba1c142d64af0a0deb1e58989a1a4

生产环境缺少密码

cd config

vim secrets.yml

里面开发和测试环境都是hard code写的安全码

生产环境不建议存明文密码

production:

secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>

# Do not keep production secrets in the unencrypted secrets file.

# Instead, either read values from the environment.

# Or, use `bin/rails secrets:setup` to configure encrypted secrets

# and move the `production:` environment over there.

建议通过

export SECRET_KEY_BASE=$(bundle exec rails secret)

我先创建测试环境

sudo RAILS_ENV=test bundle exec rake db:setup

a97589c1f301430fb7ca1a6206da8cb9

创建test表和用户

CREATE DATABASE dashboard_test CHARACTER SET utf8;

CREATE USER 'dashboard'@'localhost' IDENTIFIED BY 'my_password';

GRANT ALL PRIVILEGES ON dashboard_test.* TO 'dashboard'@'localhost';

4a2400b8786248578b92bef3546fed24

仍然有外键冲突

不管了,先让我试试看预编译

sudo RAILS_ENV=test bundle exec rake assets:precompile

7ba05d7f77e04b6eb391cd7abfbaf590

无报错

sudo RAILS_ENV=test bundle exec rails server

9bb844ba1d9a4e4d889bbc25e893f82a

终于看到了久违的webui

猜你喜欢

转载自blog.51cto.com/433266/2229830
今日推荐