Greg Karékinian
17f1b2a20a
It creates a folder, the nginx vhost for certbot and HTTP redirects, and also runs certbot and recreates the nginx vhost that includes the TLS cert
38 lines
980 B
Ruby
38 lines
980 B
Ruby
#
|
|
# Cookbook Name:: kosmos-mastodon
|
|
# Recipe:: nginx
|
|
#
|
|
# Copyright 2019, Kosmos
|
|
#
|
|
# All rights reserved - Do Not Redistribute
|
|
#
|
|
|
|
mastodon_path = node["kosmos-mastodon"]["directory"]
|
|
server_name = node["kosmos-mastodon"]["server_name"]
|
|
|
|
include_recipe "kosmos-nginx"
|
|
|
|
template "#{node['nginx']['dir']}/sites-available/#{server_name}" do
|
|
source 'nginx_conf_mastodon.erb'
|
|
owner 'www-data'
|
|
mode 0640
|
|
variables streaming_port: node["kosmos-mastodon"]["streaming_port"],
|
|
puma_port: node["kosmos-mastodon"]["puma_port"],
|
|
server_name: server_name,
|
|
ssl_cert: "/etc/letsencrypt/live/#{server_name}/fullchain.pem",
|
|
ssl_key: "/etc/letsencrypt/live/#{server_name}/privkey.pem",
|
|
mastodon_path: mastodon_path
|
|
notifies :reload, 'service[nginx]', :delayed
|
|
end
|
|
|
|
# Legacy vhost
|
|
nginx_site "mastodon" do
|
|
action :disable
|
|
end
|
|
|
|
nginx_site server_name do
|
|
action :enable
|
|
end
|
|
|
|
nginx_certbot_site server_name
|