Merge branch 'feature/maintenance_page' of kosmos/chef into master

This commit is contained in:
Râu Cao 2019-05-07 14:53:22 +00:00 committed by Gitea
commit afc9a6da43
3 changed files with 68 additions and 1 deletions

View File

@ -35,6 +35,11 @@ server {
add_header Strict-Transport-Security "max-age=31536000"; add_header Strict-Transport-Security "max-age=31536000";
location / { location / {
# If the maintenance file is present, show maintenance page
if (-f <%= @mastodon_path %>/public/maintenance.html) {
return 503;
}
try_files $uri @proxy; try_files $uri @proxy;
} }
@ -83,5 +88,11 @@ server {
tcp_nodelay on; tcp_nodelay on;
} }
error_page 500 501 502 503 504 /500.html; error_page 500 501 502 504 /500.html;
error_page 503 /maintenance.html;
location = /maintenance.html {
root <%= @mastodon_path %>/public;
}
} }

File diff suppressed because one or more lines are too long

View File

@ -60,6 +60,22 @@ cookbook_file "#{node['nginx']['dir']}/conf.d/tls_config.conf" do
notifies :restart, 'service[nginx]' notifies :restart, 'service[nginx]'
end end
directory node["nginx"]["user_home"] do
owner node["nginx"]["user"]
group node["nginx"]["group"]
action :create
recursive true
end
# Maintenance page, to be copied or served when putting things in maintenance
# mode
cookbook_file "#{node["nginx"]["user_home"]}/maintenance.html" do
source "maintenance.html"
owner node['nginx']['user']
group node['nginx']['group']
mode "0640"
end
unless node.chef_environment == "development" unless node.chef_environment == "development"
include_recipe 'kosmos-base::firewall' include_recipe 'kosmos-base::firewall'