itamae/cookbooks/blog/nginx.rb

52 lines
889 B
Ruby
Raw Normal View History

2019-03-03 08:50:49 +00:00
# Create the nginx directory:
%w( blog test ).each do |d|
directory "/var/www/#{d}" do
owner 'www-data'
group 'webadm'
mode '770'
end
2019-03-03 08:50:49 +00:00
end
# Add the fstab entry:
file '/etc/fstab' do
action :edit
block do |content|
content << "tmpfs /var/www/blog tmpfs size=250m,noatime 0 0\n"
end
not_if 'grep /var/www/blog /etc/fstab'
2019-11-05 15:15:14 +00:00
notifies :run, 'execute[mount -a]'
2019-03-03 08:50:49 +00:00
end
execute 'mount -a' do
action :nothing
end
2019-11-03 16:36:28 +00:00
remote_file '/etc/cron.d/blog' do
owner 'root'
group 'root'
mode '644'
end
2019-03-03 08:50:49 +00:00
# Add monit configuration file for monitoring nginx logs:
remote_file '/etc/monit/conf.d/blog-log.conf' do
owner 'root'
group 'root'
mode '644'
notifies :reload, 'service[monit]'
end
service 'monit' do
action :nothing
end
2019-11-05 15:16:25 +00:00
# Create storage directory for blog data
directory '/home/webadm/works/public' do
owner 'webadm'
group 'webadm'
mode '775'
end