It makes it possible to serve multiple Discord instances to different hosts from a single nginx load balancer Right now we run one for Kosmos and one for remoteStorage
		
			
				
	
	
		
			44 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			Ruby
		
	
	
	
	
	
			
		
		
	
	
			44 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			Ruby
		
	
	
	
	
	
#
 | 
						|
# Cookbook:: kosmos_discourse
 | 
						|
# Recipe:: default
 | 
						|
#
 | 
						|
 | 
						|
package "docker-compose"
 | 
						|
deploy_path = "/opt/discourse"
 | 
						|
 | 
						|
repo = "https://github.com/discourse/discourse_docker"
 | 
						|
 | 
						|
git deploy_path do
 | 
						|
  repository repo
 | 
						|
  revision "main"
 | 
						|
end
 | 
						|
 | 
						|
systemd_unit "discourse.service" do
 | 
						|
  content({Unit: {
 | 
						|
             Description: "discourse service with docker compose",
 | 
						|
             Requires: "docker.service",
 | 
						|
             After: "docker.service",
 | 
						|
           },
 | 
						|
           Service: {
 | 
						|
             Type: "oneshot",
 | 
						|
             RemainAfterExit: "true",
 | 
						|
             WorkingDirectory: deploy_path,
 | 
						|
             Environment: "SUPERVISED=true",
 | 
						|
             ExecStart: "#{deploy_path}/launcher start app",
 | 
						|
             ExecStop: "#{deploy_path}/launcher stop app",
 | 
						|
           },
 | 
						|
           Install: {
 | 
						|
             WantedBy: "multi-user.target"
 | 
						|
           }})
 | 
						|
  action [:create, :enable]
 | 
						|
end
 | 
						|
 | 
						|
include_recipe 'firewall'
 | 
						|
 | 
						|
firewall_rule 'discourse' do
 | 
						|
  port     [node['discourse']['port']]
 | 
						|
  source   "10.1.1.0/24"
 | 
						|
  protocol :tcp
 | 
						|
  command  :allow
 | 
						|
end
 |