From 8c64f91ab32984c9bef3a59a17daef60f0c91725 Mon Sep 17 00:00:00 2001 From: Gabriel Monnerat Date: Wed, 23 Apr 2014 15:17:59 +0200 Subject: [PATCH] Nginx: compile software with push stream module and add template and configuration to instantiate nginx Pay attention, in this version there is no authentication and ssl. --- component/nginx/buildout.cfg | 22 ++ software/nginx-push-stream/instance-nginx.cfg.in | 56 ++++++ software/nginx-push-stream/instance.cfg.in | 36 ++++ software/nginx-push-stream/software.cfg | 223 +++++++++++++++++++++ .../nginx-push-stream/template-nginx-service.sh.in | 6 + software/nginx-push-stream/template-nginx.cfg.in | 106 ++++++++++ 6 files changed, 449 insertions(+) create mode 100644 software/nginx-push-stream/instance-nginx.cfg.in create mode 100644 software/nginx-push-stream/instance.cfg.in create mode 100644 software/nginx-push-stream/software.cfg create mode 100644 software/nginx-push-stream/template-nginx-service.sh.in create mode 100644 software/nginx-push-stream/template-nginx.cfg.in diff --git a/component/nginx/buildout.cfg b/component/nginx/buildout.cfg index fac104b..fa959b1 100644 --- a/component/nginx/buildout.cfg +++ b/component/nginx/buildout.cfg @@ -4,6 +4,7 @@ extends = ../zlib/buildout.cfg ../openssl/buildout.cfg ../coreutils/buildout.cfg + ../git/buildout.cfg parts = nginx-output @@ -49,6 +50,7 @@ command = ${coreutils-output:test} -x ${:nginx} -a -f ${:mime} nginx = ${nginx:location}/sbin/nginx mime = ${nginx:location}/conf/mime.types + [nginx-unstable] <= nginx url = http://nginx.org/download/nginx-1.3.15.tar.gz @@ -70,3 +72,23 @@ configure-options= --with-cc-opt="-I ${pcre:location}/include -I ${openssl:location}/include -I ${zlib:location}/include" --add-module=${hexaglobe-nginx-module:location}/sub_module # --add-module=${hexaglobe-nginx-module:location}/nginx-upstream-fair + +[nginx-push-stream-module] +recipe = slapos.recipe.build:gitclone +repository = https://github.com/wandenberg/nginx-push-stream-module.git +revision = 3d3a204177d3a7ab8a2858e04e792a6d11bf133f +git-executable = ${git:location}/bin/git + +[nginx-push-stream] +<= nginx +configure-options= + --with-ipv6 + --with-http_ssl_module + --with-ld-opt="-L ${zlib:location}/lib -L ${openssl:location}/lib -L ${pcre:location}/lib -Wl,-rpath=${pcre:location}/lib -Wl,-rpath=${zlib:location}/lib -Wl,-rpath=${openssl:location}/lib" + --with-cc-opt="-I ${pcre:location}/include -I ${openssl:location}/include -I ${zlib:location}/include" + --add-module=${nginx-push-stream-module:location} + +[nginx-push-stream-output] +<= nginx-output +nginx = ${nginx-push-stream:location}/sbin/nginx +mime = ${nginx-push-stream:location}/conf/mime.types diff --git a/software/nginx-push-stream/instance-nginx.cfg.in b/software/nginx-push-stream/instance-nginx.cfg.in new file mode 100644 index 0000000..8b220ed --- /dev/null +++ b/software/nginx-push-stream/instance-nginx.cfg.in @@ -0,0 +1,56 @@ +{% set part_list = [] -%} +{% set crontab_line_list = [] -%} +[directory] +recipe = slapos.cookbook:mkdirectory +etc = $${buildout:directory}/etc +bin = $${buildout:directory}/bin +srv = $${buildout:directory}/srv +var = $${buildout:directory}/var +run = $${:var}/run +log = $${:var}/log +varnginx = $${:var}/nginx +services = $${:etc}/service +cron-entries = $${:etc}/cron.d +www = $${:srv}/www +ssl = $${:etc}/ssl + +################################# +# Nginx service +################################# +[nginx-service] +recipe = slapos.recipe.template +url = ${template-nginx-service:output} +output = $${directory:services}/nginx +mode = 0700 +virtual-depends = + $${nginx-configuration:ip} + +[nginx-configuration] +recipe = slapos.recipe.template +url = ${template-nginx-configuration:output} +output = $${directory:etc}/nginx.cfg +mode = 0600 +access_log = $${directory:log}/nginx-access.log +error_log = $${directory:log}/nginx-error.log +ip = $${slap-network-information:global-ipv6} +port = 9443 +publisher_push_stream_store_messages = off +publisher_client_max_body_size = 16k +publisher_client_body_buffer_size = 16k +subscriber_allow_origin = '*' +# Prevent to use credential if origin is star +subscriber_allow_credential = 'false' +subscriber_allow_methods = 'GET, HEAD, OPTIONS' +subscriber_allow_headers = 'Authorization,Content-Type,Accept,Origin,User-Agent,DNT,Cache-Control,X-Mx-ReqToken,Keep-Alive,X-Requested-With,If-Modified-Since' + +# Add parts generated by template +[buildout] +parts = + nginx-service +{% for part in part_list -%} +{{ ' %s' % part }} +{% endfor -%} + +eggs-directory = ${buildout:eggs-directory} +develop-eggs-directory = ${buildout:develop-eggs-directory} +offline = true diff --git a/software/nginx-push-stream/instance.cfg.in b/software/nginx-push-stream/instance.cfg.in new file mode 100644 index 0000000..fdd64a5 --- /dev/null +++ b/software/nginx-push-stream/instance.cfg.in @@ -0,0 +1,36 @@ +[buildout] +parts = + switch-softwaretype + +eggs-directory = ${buildout:eggs-directory} +develop-eggs-directory = ${buildout:develop-eggs-directory} +offline = true + +[switch-softwaretype] +recipe = slapos.cookbook:softwaretype +default = $${:nginx} +nginx = $${dynamic-template-nginx:rendered} + +[dynamic-template-nginx] +recipe = slapos.recipe.template:jinja2 +template = ${template-nginx:output} +rendered = $${buildout:parts-directory}/$${:_buildout_section_name_}/$${:filename} +filename = instance-nginx.cfg + +[slap-connection] +computer-id = $${slap_connection:computer_id} +partition-id = $${slap_connection:partition_id} +server-url = $${slap_connection:server_url} +software-release-url = $${slap_connection:software_release_url} +key-file = $${slap_connection:key_file} +cert-file = $${slap_connection:cert_file} + +[instance-parameter] +# Fetches parameters defined in SlapOS Master for this instance. +# Always the same. +recipe = slapos.cookbook:slapconfiguration.serialised +computer = $${slap_connection:computer_id} +partition = $${slap_connection:partition_id} +url = $${slap_connection:server_url} +key = $${slap_connection:key_file} +cert = $${slap_connection:cert_file} diff --git a/software/nginx-push-stream/software.cfg b/software/nginx-push-stream/software.cfg new file mode 100644 index 0000000..3e8f27d --- /dev/null +++ b/software/nginx-push-stream/software.cfg @@ -0,0 +1,223 @@ +[buildout] + +extends = + ../../stack/slapos.cfg + ../../component/dash/buildout.cfg + ../../component/nginx/buildout.cfg + +parts = + slapos-cookbook + nginx-push-stream-module + nginx-push-stream + template + template-nginx-service + template-nginx + +[template] +recipe = slapos.recipe.template +url = ${:_profile_base_location_}/instance.cfg.in +md5sum = eb4c69df9a8dbb94fb76d0a6c11e360f +output = ${buildout:directory}/template.cfg +mode = 0644 + +[template-nginx-service] +recipe = slapos.recipe.template +url = ${:_profile_base_location_}/template-nginx-service.sh.in +md5sum = 90ba5a247c489261d3304528cba56e06 +output = ${buildout:directory}/template-nginx-service.sh.in +mode = 0644 + +[template-nginx-configuration] +recipe = slapos.recipe.template +url = ${:_profile_base_location_}/template-nginx.cfg.in +md5sum = da3012177cbe913ffb47723367d9de54 +output = ${buildout:directory}/template-nginx.cfg.in +mode = 0644 + +[template-nginx] +recipe = slapos.recipe.template +url = ${:_profile_base_location_}/instance-nginx.cfg.in +md5sum = 676bd5d83ef700d71840a24b50fe8bd0 +output = ${buildout:directory}/instance-nginx.cfg.in +mode = 0644 + +[networkcache] +# signature certificates of the following uploaders. +# Romain Courteaud +# Sebastien Robin +# Kazuhiko Shiozaki +# Cedric de Saint Martin +# Yingjie Xu +# Gabriel Monnerat +# Łukasz Nowak +# Test Agent (Automatic update from tests) +# Aurélien Calonne +signature-certificate-list = + -----BEGIN CERTIFICATE----- + MIIB4DCCAUkCADANBgkqhkiG9w0BAQsFADA5MQswCQYDVQQGEwJGUjEZMBcGA1UE + CBMQRGVmYXVsdCBQcm92aW5jZTEPMA0GA1UEChMGTmV4ZWRpMB4XDTExMDkxNTA5 + MDAwMloXDTEyMDkxNTA5MDAwMlowOTELMAkGA1UEBhMCRlIxGTAXBgNVBAgTEERl + ZmF1bHQgUHJvdmluY2UxDzANBgNVBAoTBk5leGVkaTCBnzANBgkqhkiG9w0BAQEF + AAOBjQAwgYkCgYEApYZv6OstoqNzxG1KI6iE5U4Ts2Xx9lgLeUGAMyfJLyMmRLhw + boKOyJ9Xke4dncoBAyNPokUR6iWOcnPHtMvNOsBFZ2f7VA28em3+E1JRYdeNUEtX + Z0s3HjcouaNAnPfjFTXHYj4um1wOw2cURSPuU5dpzKBbV+/QCb5DLheynisCAwEA + ATANBgkqhkiG9w0BAQsFAAOBgQBCZLbTVdrw3RZlVVMFezSHrhBYKAukTwZrNmJX + mHqi2tN8tNo6FX+wmxUUAf3e8R2Ymbdbn2bfbPpcKQ2fG7PuKGvhwMG3BlF9paEC + q7jdfWO18Zp/BG7tagz0jmmC4y/8akzHsVlruo2+2du2freE8dK746uoMlXlP93g + QUUGLQ== + -----END CERTIFICATE----- + -----BEGIN CERTIFICATE----- + MIIB8jCCAVugAwIBAgIJAPu2zchZ2BxoMA0GCSqGSIb3DQEBBQUAMBIxEDAOBgNV + BAMMB3RzeGRldjMwHhcNMTExMDE0MTIxNjIzWhcNMTIxMDEzMTIxNjIzWjASMRAw + DgYDVQQDDAd0c3hkZXYzMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCrPbh+ + YGmo6mWmhVb1vTqX0BbeU0jCTB8TK3i6ep3tzSw2rkUGSx3niXn9LNTFNcIn3MZN + XHqbb4AS2Zxyk/2tr3939qqOrS4YRCtXBwTCuFY6r+a7pZsjiTNddPsEhuj4lEnR + L8Ax5mmzoi9nE+hiPSwqjRwWRU1+182rzXmN4QIDAQABo1AwTjAdBgNVHQ4EFgQU + /4XXREzqBbBNJvX5gU8tLWxZaeQwHwYDVR0jBBgwFoAU/4XXREzqBbBNJvX5gU8t + LWxZaeQwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOBgQA07q/rKoE7fAda + FED57/SR00OvY9wLlFEF2QJ5OLu+O33YUXDDbGpfUSF9R8l0g9dix1JbWK9nQ6Yd + R/KCo6D0sw0ZgeQv1aUXbl/xJ9k4jlTxmWbPeiiPZEqU1W9wN5lkGuLxV4CEGTKU + hJA/yXa1wbwIPGvX3tVKdOEWPRXZLg== + -----END CERTIFICATE----- + -----BEGIN CERTIFICATE----- + MIIB7jCCAVegAwIBAgIJAJWA0jQ4o9DGMA0GCSqGSIb3DQEBBQUAMA8xDTALBgNV + BAMMBHg2MXMwIBcNMTExMTI0MTAyNDQzWhgPMjExMTEwMzExMDI0NDNaMA8xDTAL + BgNVBAMMBHg2MXMwgZ8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vcNAQEFBQADgYEAskbFizHr + b6d3iIyN+wffxz/V9epbKIZVEGJd/6LrTdLiUfJPec7FaxVCWNyKBlCpINBM7cEV + Gn9t8mdVQflNqOlAMkOlUv1ZugCt9rXYQOV7rrEYJBWirn43BOMn9Flp2nibblby + If1a2ZoqHRxoNo2yTmm7TSYRORWVS+vvfjY= + -----END CERTIFICATE----- + -----BEGIN CERTIFICATE----- + MIIB9jCCAV+gAwIBAgIJAIlBksrZVkK8MA0GCSqGSIb3DQEBBQUAMBMxETAPBgNV + BAMMCENPTVAtMzU3MCAXDTEyMDEyNjEwNTUyOFoYDzIxMTIwMTAyMTA1NTI4WjAT + MREwDwYDVQQDDAhDT01QLTM1NzCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA + ts+iGUwi44vtIfwXR8DCnLtHV4ydl0YTK2joJflj0/Ws7mz5BYkxIU4fea/6+VF3 + i11nwBgYgxQyjNztgc9u9O71k1W5tU95yO7U7bFdYd5uxYA9/22fjObaTQoC4Nc9 + mTu6r/VHyJ1yRsunBZXvnk/XaKp7gGE9vNEyJvPn2bkCAwEAAaNQME4wHQYDVR0O + BBYEFKuGIYu8+6aEkTVg62BRYaD11PILMB8GA1UdIwQYMBaAFKuGIYu8+6aEkTVg + 62BRYaD11PILMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAMoTRpBxK + YLEZJbofF7gSrRIcrlUJYXfTfw1QUBOKkGFFDsiJpEg4y5pUk1s5Jq9K3SDzNq/W + it1oYjOhuGg3al8OOeKFrU6nvNTF1BAvJCl0tr3POai5yXyN5jlK/zPfypmQYxE+ + TaqQSGBJPVXYt6lrq/PRD9ciZgKLOwEqK8w= + -----END CERTIFICATE----- + -----BEGIN CERTIFICATE----- + MIIB9jCCAV+gAwIBAgIJAPHoWu90gbsgMA0GCSqGSIb3DQEBBQUAMBQxEjAQBgNV + BAMMCXZpZmlibm9kZTAeFw0xMjAzMTkyMzIwNTVaFw0xMzAzMTkyMzI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9yqMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAl4hBaJy1 + cgiNV2+Z5oNTrHgmzWvSY4duECOTBxeuIOnhql3vLlaQmo0p8Z4c13kTZq2s3nhd + Loe5mIHsjRVKvzB6SvIaFUYq/EzmHnqNdpIGkT/Mj7r/iUs61btTcGUCLsUiUeci + Vd0Ozh79JSRpkrdI8R/NRQ2XPHAo+29TT70= + -----END CERTIFICATE----- + -----BEGIN CERTIFICATE----- + MIIB9jCCAV+gAwIBAgIJAKRvzcy7OH0UMA0GCSqGSIb3DQEBBQUAMBMxETAPBgNV + BAMMCENPTVAtNzcyMCAXDTEyMDgxMDE1NDI1MVoYDzIxMTIwNzE3MTU0MjUxWjAT + MREwDwYDVQQDDAhDT01QLTc3MjCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA + o7aipd6MbnuGDeR1UJUjuMLQUariAyQ2l2ZDS6TfOwjHiPw/mhzkielgk73kqN7A + sUREx41eTcYCXzTq3WP3xCLE4LxLg1eIhd4nwNHj8H18xR9aP0AGjo4UFl5BOMa1 + mwoyBt3VtfGtUmb8whpeJgHhqrPPxLoON+i6fIbXDaUCAwEAAaNQME4wHQYDVR0O + BBYEFEfjy3OopT2lOksKmKBNHTJE2hFlMB8GA1UdIwQYMBaAFEfjy3OopT2lOksK + mKBNHTJE2hFlMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAaNRx6YN2 + M/p3R8/xS6zvH1EqJ3FFD7XeAQ52WuQnKSREzuw0dsw12ClxjcHiQEFioyTiTtjs + 5pW18Ry5Ie7iFK4cQMerZwWPxBodEbAteYlRsI6kePV7Gf735Y1RpuN8qZ2sYL6e + x2IMeSwJ82BpdEI5niXxB+iT0HxhmR+XaMI= + -----END CERTIFICATE----- + -----BEGIN CERTIFICATE----- + MIIB+DCCAWGgAwIBAgIJAKGd0vpks6T/MA0GCSqGSIb3DQEBBQUAMBQxEjAQBgNV + BAMMCUNPTVAtMTU4NDAgFw0xMzA2MjAxMjE5MjBaGA8yMTEzMDUyNzEyMTkyMFow + FDESMBAGA1UEAwwJQ09NUC0xNTg0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKB + gQDZTH9etPUC+wMZQ3UIiOwyyCfHsJ+7duCFYjuo1uZrhtDt/fp8qb8qK9ob+df3 + EEYgA0IgI2j/9jNUEnKbc5+OrfKznzXjrlrH7zU8lKBVNCLzQuqBKRNajZ+UvO8R + nlqK2jZCXP/p3HXDYUTEwIR5W3tVCEn/Vda4upTLcPVE5wIDAQABo1AwTjAdBgNV + HQ4EFgQU7KXaNDheQWoy5uOU01tn1M5vNkEwHwYDVR0jBBgwFoAU7KXaNDheQWoy + 5uOU01tn1M5vNkEwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOBgQASmqCU + Znbvu6izdicvjuE3aKnBa7G++Fdp2bdne5VCwVbVLYCQWatB+n4crKqGdnVply/u + +uZ16u1DbO9rYoKgWqjLk1GfiLw5v86pd5+wZd5I9QJ0/Sbz2vZk5S4ciMIGwArc + m711+GzlW5xe6GyH9SZaGOPAdUbI6JTDwLzEgA== + -----END CERTIFICATE----- + +[versions] +Jinja2 = 2.7.3 +MarkupSafe = 0.23 +Werkzeug = 0.9.6 +buildout-versions = 1.7 +cffi = 0.8.6 +cliff = 1.6.1 +cmd2 = 0.6.7 +cryptography = 0.5.1 +inotifyx = 0.2.0-1 +itsdangerous = 0.24 +lxml = 3.3.5 +meld3 = 1.0.0 +mr.developer = 1.30 +netaddr = 0.7.12 +netifaces = 0.10.4 +plone.recipe.command = 1.1 +pyOpenSSL = 0.14 +pyparsing = 2.0.2 +pytz = 2014.4 +requests = 2.3.0 +six = 1.7.3 +slapos.cookbook = 0.87 +slapos.core = 1.1.2 +slapos.recipe.build = 0.12 +slapos.recipe.cmmi = 0.2 +slapos.recipe.template = 2.5 +stevedore = 0.15 +supervisor = 3.0 +xml-marshaller = 0.9.7 + +# Required by: +# slapos.core==1.1.2 +Flask = 0.10.1 + +# Required by: +# slapos.cookbook==0.87 +lock-file = 2.0 + +# Required by: +# slapos.core==1.1.2 +psutil = 2.1.1 + +# Required by: +# cffi==0.8.6 +pycparser = 2.10 + +# Required by: +# slapos.core==1.1.2 +zope.interface = 4.1.1 diff --git a/software/nginx-push-stream/template-nginx-service.sh.in b/software/nginx-push-stream/template-nginx-service.sh.in new file mode 100644 index 0000000..6737e2e --- /dev/null +++ b/software/nginx-push-stream/template-nginx-service.sh.in @@ -0,0 +1,6 @@ +#!${dash-output:dash} +# BEWARE: This file is operated by slapgrid +# BEWARE: It will be overwritten automatically + +exec ${nginx-push-stream-output:nginx} \ + -c $${nginx-configuration:output} diff --git a/software/nginx-push-stream/template-nginx.cfg.in b/software/nginx-push-stream/template-nginx.cfg.in new file mode 100644 index 0000000..8b185fe --- /dev/null +++ b/software/nginx-push-stream/template-nginx.cfg.in @@ -0,0 +1,106 @@ +daemon off; # run in the foreground so supervisord can look after it + +worker_processes 4; +pid $${directory:run}/nginx.pid; + +events { + worker_connections 768; + # multi_accept on; +} + +error_log $${nginx-configuration:error_log}; + +http { + + ## + # Basic Settings + ## + + sendfile on; + tcp_nopush on; + tcp_nodelay on; + keepalive_timeout 65; + types_hash_max_size 2048; + server_tokens off; + + # server_names_hash_bucket_size 64; + # server_name_in_redirect off; + + default_type application/octet-stream; + include ${nginx-push-stream-output:mime}; + + ## + # Logging Settings + ## + + access_log $${nginx-configuration:access_log}; + error_log $${nginx-configuration:error_log}; + + ## + # Gzip Settings + ## + + gzip on; + gzip_disable "msie6"; + + gzip_vary on; + gzip_proxied any; + gzip_comp_level 6; + gzip_buffers 16 8k; + gzip_http_version 1.1; + gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript; + ## + # Push stream Settings + ## + push_stream_shared_memory_size 32m; + +server { + listen [$${nginx-configuration:ip}]:$${nginx-configuration:port}; + + fastcgi_temp_path $${directory:varnginx} 1 2; + uwsgi_temp_path $${directory:varnginx} 1 2; + scgi_temp_path $${directory:varnginx} 1 2; + + client_body_temp_path $${directory:varnginx} 1 2; + proxy_temp_path $${directory:varnginx} 1 2; + + ## Serve an error 204 (No Content) for favicon.ico + location = /favicon.ico { + return 204; + } + + location /pub { + push_stream_publisher; + + push_stream_channels_path $arg_id; + # store messages in memory + push_stream_store_messages $${nginx-configuration:publisher_push_stream_store_messages}; + + # Message size limit + # client_max_body_size MUST be equal to client_body_buffer_size or + # you will be sorry. + client_max_body_size $${nginx-configuration:publisher_client_max_body_size}; + client_body_buffer_size $${nginx-configuration:publisher_client_body_buffer_size}; + + } + + location ~ /sub/(.*) { + # activate subscriber mode for this location + add_header "Access-Control-Allow-Origin" $${nginx-configuration:subscriber_allow_origin}; + add_header 'Access-Control-Allow-Credentials' $${nginx-configuration:subscriber_allow_credential}; + add_header 'Access-Control-Allow-Methods' $${nginx-configuration:subscriber_allow_methods}; + add_header 'Access-Control-Allow-Headers' $${nginx-configuration:subscriber_allow_headers}; + + push_stream_subscriber eventsource; + # positional channel path + push_stream_channels_path $1; + + # content-type + default_type "text/event-stream; charset=utf-8"; + } + + location / { + root $${directory:www}; + } +} +} -- 2.1.4