Browse files

start building complete_unicorn_nginx_mysql/complete_unicorn_nginx_po…

…stgresql templates
  • Loading branch information...
1 parent 4b6d9ce commit db9234ee547b7239c36e679655112b4912cca45d Nick Messick committed Aug 13, 2012
View
21 templates/complete_unicorn_nginx/config/rubber/role/haproxy/haproxy-unicorn.conf
@@ -0,0 +1,21 @@
+<%
+ @path = "/etc/haproxy/haproxy.cfg"
+ @additive = ["# start haproxy unicorn", "# end haproxy unicorn"]
+%>
+
+<%
+ backend_hosts = rubber_instances.for_role('app').collect { |i| i.name }
+%>
+
+listen unicorn_proxy 0.0.0.0:<%= rubber_env.web_port %>
+ option forwardfor
+ <% backend_hosts.each do |server| %>
+ server <%= server %> <%= server %>:<%= rubber_env.unicorn_listen_port %> maxconn <%= rubber_env.max_app_connections %> check
+ <% end %>
+
+listen unicorn_proxy_ssl 0.0.0.0:<%= rubber_env.web_ssl_port %>
+ mode tcp
+ option forwardfor
+ <% backend_hosts.each do |server| %>
+ server <%= server %> <%= server %>:<%= rubber_env.unicorn_listen_ssl_port %> maxconn <%= rubber_env.max_app_connections %> check
+ <% end %>
View
39 templates/complete_unicorn_nginx/config/rubber/rubber-complete.yml
@@ -0,0 +1,39 @@
+role_dependencies:
+ web: [haproxy]
+ app: [unicorn_nginx]
+ web_tools: [unicorn_nginx]
+
+web_port: 80
+web_ssl_port: 443
+web_tools_port: 8080
+web_tools_ssl_port: 8443
+
+security_groups:
+ web:
+ description: "To open up port #{web_port}/#{web_ssl_port} for http server on web role"
+ rules:
+ - protocol: tcp
+ from_port: "#{web_port}"
+ to_port: "#{web_port}"
+ source_ips: [0.0.0.0/0]
+ - protocol: tcp
+ from_port: "#{web_ssl_port}"
+ to_port: "#{web_ssl_port}"
+ source_ips: [0.0.0.0/0]
+ web_tools:
+ description: "To open up port #{web_tools_port}/#{web_tools_ssl_port} for internal/tools http server"
+ rules:
+ - protocol: tcp
+ from_port: "#{web_tools_port}"
+ to_port: "#{web_tools_port}"
+ source_ips: [0.0.0.0/0]
+ - protocol: tcp
+ from_port: "#{web_tools_ssl_port}"
+ to_port: "#{web_tools_ssl_port}"
+ source_ips: [0.0.0.0/0]
+
+roles:
+ web:
+ assigned_security_groups: [web]
+ web_tools:
+ assigned_security_groups: [web_tools]
View
8 templates/complete_unicorn_nginx/templates.rb
@@ -0,0 +1,8 @@
+database_engines = ['mysql', 'postgresql']
+if ! database_engines.any? {|d| @template_dependencies.include?(d)}
+ db = Rubber::Util::prompt("DATABASE",
+ "The database engine to use (#{database_engines.join(', ')})",
+ true,
+ 'mysql')
+ template_dependencies << db
+end
View
8 templates/complete_unicorn_nginx/templates.yml
@@ -0,0 +1,8 @@
+description: A fairly complete and scalable deployment setup using unicorn and nginx
+dependent_templates:
+ - base
+ - haproxy
+ - unicorn_nginx
+ - monit
+ - collectd
+ - graphite
View
4 templates/complete_unicorn_nginx_mysql/templates.yml
@@ -0,0 +1,4 @@
+description: A fairly complete and scalable mysql deployment setup using unicorn/nginx
+dependent_templates:
+ - complete_unicorn_nginx
+ - mysql
View
4 templates/complete_unicorn_nginx_postgresql/templates.yml
@@ -0,0 +1,4 @@
+description: A fairly complete and scalable postgresql deployment setup using unicorn/nginx
+dependent_templates:
+ - complete_unicorn_nginx
+ - postgresql

0 comments on commit db9234e

Please sign in to comment.