28 lines
		
	
	
		
			660 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
			
		
		
	
	
			28 lines
		
	
	
		
			660 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
| #
 | |
| # Cookbook:: kosmos_gitea
 | |
| # Recipe:: nginx
 | |
| #
 | |
| 
 | |
| domain = node["gitea"]["domain"]
 | |
| 
 | |
| begin
 | |
|   upstream_ip_address = search(:node, "role:gitea").first["knife_zero"]["host"]
 | |
| rescue
 | |
|   Chef::Log.warn('No server with "gitea" role. Stopping here.')
 | |
|   return
 | |
| end
 | |
| 
 | |
| tls_cert_for domain do
 | |
|   auth "gandi_dns"
 | |
|   action :create
 | |
| end
 | |
| 
 | |
| openresty_site domain do
 | |
|   template "nginx_conf_web.erb"
 | |
|   variables server_name:   domain,
 | |
|             ssl_cert:      "/etc/letsencrypt/live/#{domain}/fullchain.pem",
 | |
|             ssl_key:       "/etc/letsencrypt/live/#{domain}/privkey.pem",
 | |
|             upstream_host: upstream_ip_address,
 | |
|             upstream_port: node["gitea"]["port"]
 | |
| end
 |