chef/site-cookbooks/kosmos-akkounts/recipes/nginx.rb

27 lines
662 B
Ruby

#
# Cookbook Name:: kosmos-akkounts
# Recipe:: nginx
#
include_recipe "kosmos-nginx"
app_name = "akkounts"
domain = node[app_name]["domain"]
nginx_certbot_site domain
template "#{node['nginx']['dir']}/sites-available/#{domain}" do
source "nginx_conf_#{app_name}.erb"
owner 'www-data'
mode 0640
variables port: node[app_name]['port'],
domain: domain,
root_dir: "/opt/#{app_name}/public",
ssl_cert: "/etc/letsencrypt/live/#{domain}/fullchain.pem",
ssl_key: "/etc/letsencrypt/live/#{domain}/privkey.pem"
notifies :reload, 'service[nginx]', :delayed
end
nginx_site domain do
action :enable
end