Initial kosmos_discourse cookbook

The systemd unit does not work

Refs #222
This commit is contained in:
Greg Karékinian
2020-10-20 12:20:05 +02:00
parent d1c9cf853f
commit 429b609ac2
9 changed files with 300 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
[Unit]
Description=discourse service with docker compose
Requires=docker.service
After=docker.service
[Service]
Restart=always
WorkingDirectory=<%= @deploy_path %>
Environment="SUPERVISED=true"
ExecStartPre=<%= @deploy_path %>/launcher stop app
# Remove all containers that have stopped for > 24 hours
ExecStartPre=<%= @deploy_path %>/launcher cleanup
ExecStart=<%= @deploy_path %>/launcher start app
ExecStop=<%= @deploy_path %>/launcher stop app
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,34 @@
# Generated by Chef
upstream _discourse {
server localhost:<%= @upstream_port %>;
}
<% if File.exist?(@ssl_cert) && File.exist?(@ssl_key) -%>
server {
server_name <%= @server_name %>;
listen 443 ssl http2;
listen [::]:443 ssl http2;
ssl_certificate <%= @ssl_cert %>;
ssl_certificate_key <%= @ssl_key %>;
add_header Strict-Transport-Security "max-age=31536000";
# Send real IP to the Docker container
set_real_ip_from 127.0.0.1;
set_real_ip_from 172.17.0.1;
real_ip_header X-Forwarded-For;
client_max_body_size 20M;
location / {
# Increase number of buffers. Default is 8
proxy_buffers 1024 8k;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://_discourse;
proxy_http_version 1.1;
}
}
<% end -%>