Set up Blossom server on blossom.kosmos.org
This commit is contained in:
1
site-cookbooks/blossom
Submodule
1
site-cookbooks/blossom
Submodule
Submodule site-cookbooks/blossom added at 1407dc16e5
Submodule site-cookbooks/deno updated: 92839b20a4...3795c9e672
1
site-cookbooks/kosmos_blossom/attributes/default.rb
Normal file
1
site-cookbooks/kosmos_blossom/attributes/default.rb
Normal file
@@ -0,0 +1 @@
|
||||
# No attributes here, use the blossom cookbook's attributes
|
||||
6
site-cookbooks/kosmos_blossom/metadata.rb
Normal file
6
site-cookbooks/kosmos_blossom/metadata.rb
Normal file
@@ -0,0 +1,6 @@
|
||||
name 'kosmos_blossom'
|
||||
description 'Configures Blossom server for Kosmos infrastructure'
|
||||
version '0.1.0'
|
||||
depends 'blossom'
|
||||
depends 'kosmos-base'
|
||||
depends 'kosmos_openresty'
|
||||
28
site-cookbooks/kosmos_blossom/recipes/default.rb
Normal file
28
site-cookbooks/kosmos_blossom/recipes/default.rb
Normal file
@@ -0,0 +1,28 @@
|
||||
#
|
||||
# Cookbook Name:: kosmos_blossom
|
||||
# Recipe:: default
|
||||
#
|
||||
|
||||
credentials = Chef::EncryptedDataBagItem.load('credentials', 'blossom')
|
||||
|
||||
node.default['blossom']['storage']['backend'] = 's3'
|
||||
node.default['blossom']['storage']['s3']['access_key'] = credentials['s3_access_key']
|
||||
node.default['blossom']['storage']['s3']['secret_key'] = credentials['s3_secret_key']
|
||||
|
||||
node.default['blossom']['dashboard']['enabled'] = true
|
||||
node.default['blossom']['dashboard']['username'] = credentials['admin_username'] || 'admin'
|
||||
node.default['blossom']['dashboard']['password'] = credentials['admin_password']
|
||||
|
||||
node.default['blossom']['landing']['title'] = 'Kosmos Blossom Server'
|
||||
|
||||
node.default['blossom']['repo_url'] = 'https://github.com/67P/blossom-server.git'
|
||||
node.default['blossom']['revision'] = 'master'
|
||||
|
||||
include_recipe 'blossom::default'
|
||||
|
||||
firewall_rule 'blossom' do
|
||||
port node['blossom']['port']
|
||||
source '10.1.1.0/24'
|
||||
protocol :tcp
|
||||
command :allow
|
||||
end
|
||||
28
site-cookbooks/kosmos_blossom/recipes/nginx.rb
Normal file
28
site-cookbooks/kosmos_blossom/recipes/nginx.rb
Normal file
@@ -0,0 +1,28 @@
|
||||
#
|
||||
# Cookbook Name:: kosmos_blossom
|
||||
# Recipe:: nginx
|
||||
#
|
||||
|
||||
domain = node['blossom']['domain']
|
||||
|
||||
blossom_node = search(:node, 'role:blossom').first
|
||||
|
||||
if blossom_node.nil?
|
||||
Chef::Log.warn("No node found with 'blossom' role. Not configuring nginx site.")
|
||||
return
|
||||
end
|
||||
|
||||
tls_cert_for domain do
|
||||
auth 'gandi_dns'
|
||||
action :create
|
||||
end
|
||||
|
||||
openresty_site domain do
|
||||
template 'nginx_conf_blossom.erb'
|
||||
variables domain: domain,
|
||||
upstream_host: blossom_node['knife_zero']['host'],
|
||||
upstream_port: node['blossom']['port'],
|
||||
max_size_mb: node['blossom']['max_size'] / 1024 / 1024,
|
||||
ssl_cert: "/etc/letsencrypt/live/#{domain}/fullchain.pem",
|
||||
ssl_key: "/etc/letsencrypt/live/#{domain}/privkey.pem"
|
||||
end
|
||||
@@ -0,0 +1,26 @@
|
||||
upstream _blossom {
|
||||
server <%= @upstream_host %>:<%= @upstream_port %>;
|
||||
}
|
||||
|
||||
server {
|
||||
server_name <%= @domain %>;
|
||||
listen <%= "#{node['openresty']['listen_ip']}:" if node['openresty']['listen_ip'] %>443 ssl http2;
|
||||
listen <%= "[#{node['openresty']['listen_ipv6']}]" %>:443 ssl http2;
|
||||
|
||||
access_log "/var/log/nginx/<%= @domain %>.access.log";
|
||||
error_log "/var/log/nginx/<%= @domain %>.error.log";
|
||||
|
||||
client_max_body_size <%= @max_size_mb %>M;
|
||||
|
||||
ssl_certificate <%= @ssl_cert %>;
|
||||
ssl_certificate_key <%= @ssl_key %>;
|
||||
|
||||
location / {
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_pass http://_blossom;
|
||||
proxy_http_version 1.1;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user