prezento.rb
1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
include_recipe 'mezuro::service'
# change this to COPR repo when gets ready
execute 'download:mezuro' do
command 'wget https://bintray.com/mezurometrics/rpm/rpm -O bintray-mezurometrics-rpm.repo'
cwd '/etc/yum.repos.d'
user 'root'
end
package 'prezento-spb'
template '/etc/mezuro/prezento/database.yml' do
source 'prezento/database.yml.erb'
owner 'prezento'
group 'prezento'
mode '0600'
notifies :restart, 'service[prezento.target]'
end
PREZENTO_DIR='/usr/share/mezuro/prezento'
execute 'prezento:schema' do
command 'RAILS_ENV=production bundle exec rake db:schema:load'
cwd PREZENTO_DIR
user 'prezento'
end
execute 'prezento:migrate' do
command 'RAILS_ENV=production bundle exec rake db:migrate'
cwd PREZENTO_DIR
user 'prezento'
notifies :restart, 'service[prezento.target]'
end
template PREZENTO_DIR + '/config/kalibro.yml' do
source 'prezento/kalibro.yml.erb'
owner 'prezento'
group 'prezento'
mode '0644'
notifies :restart, 'service[prezento.target]'
end
execute 'prezento:open_port' do
command 'semanage port -a -t http_port_t -p tcp 84'
user 'root'
only_if '! semanage port -l | grep "^\(http_port_t\)\(.\)\+\(\s84,\)"'
end
template '/etc/nginx/conf.d/prezento.conf' do
source 'prezento/nginx.conf.erb'
owner 'root'
group 'root'
mode 0644
notifies :restart, 'service[nginx]'
end