浏览代码

Merge 3177e2ccbd into 5171efec21

pull/292/merge
thomas-thorburn-connect 1年前
父节点
当前提交
d9a54d1f75
没有帐户链接到提交者的电子邮件
共有 7 个文件被更改,包括 64 次插入23 次删除
  1. +3
    -0
      nginx/init.sls
  2. +14
    -0
      nginx/map.jinja
  3. +3
    -0
      nginx/passenger.sls
  4. +0
    -22
      nginx/pkg.sls
  5. +1
    -0
      nginx/servers_config.sls
  6. +33
    -0
      nginx/streams.sls
  7. +10
    -1
      pillar.example

+ 3
- 0
nginx/init.sls 查看文件

@@ -13,6 +13,9 @@ include:
{%- if nginx.snippets is defined %}
- nginx.snippets
{%- endif %}
{%- if nginx.streams is defined %}
- nginx.streams
{%- endif %}
- nginx.servers
- nginx.certificates


+ 14
- 0
nginx/map.jinja 查看文件

@@ -16,6 +16,7 @@
'server_available': '/etc/nginx/sites-available',
'server_enabled': '/etc/nginx/sites-enabled',
'snippets_dir': '/etc/nginx/snippets',
'streams_dir': '/etc/nginx/streams',
'server_use_symlink': True,
'pid_file': '/run/nginx.pid',
'openssl_package': 'openssl',
@@ -32,6 +33,7 @@
'server_available': '/etc/nginx/conf.d',
'server_enabled': '/etc/nginx/conf.d',
'snippets_dir': '/etc/nginx/snippets',
'streams_dir': '/etc/nginx/streams',
'server_use_symlink': False,
'pid_file': '/run/nginx.pid',
'rh_os_releasever': '$releasever',
@@ -49,6 +51,7 @@
'server_available': '/etc/nginx/conf.d',
'server_enabled': '/etc/nginx/conf.d',
'snippets_dir': '/etc/nginx/snippets',
'streams_dir': '/etc/nginx/streams',
'server_use_symlink': False,
'pid_file': '/run/nginx.pid',
'rh_os_releasever': '$releasever',
@@ -69,6 +72,7 @@
'server_available': '/etc/nginx/vhosts.d',
'server_enabled': '/etc/nginx/vhosts.d',
'snippets_dir': '/etc/nginx/snippets',
'streams_dir': '/etc/nginx/streams',
'server_use_symlink': False,
'pid_file': '/run/nginx.pid',
'gpg_check': True,
@@ -84,6 +88,7 @@
'server_available': '/etc/nginx/sites-available',
'server_enabled': '/etc/nginx/sites-enabled',
'snippets_dir': '/etc/nginx/snippets',
'streams_dir': '/etc/nginx/streams',
'server_use_symlink': True,
'openssl_package': 'openssl',
},
@@ -95,6 +100,7 @@
'server_available': '/etc/nginx/sites-available',
'server_enabled': '/etc/nginx/sites-enabled',
'snippets_dir': '/etc/nginx/snippets',
'streams_dir': '/etc/nginx/streams',
'server_use_symlink': True,
'openssl_package': 'dev-libs/openssl',
},
@@ -107,6 +113,7 @@
'server_available': '/usr/local/etc/nginx/sites-available',
'server_enabled': '/usr/local/etc/nginx/sites-enabled',
'snippets_dir': '/usr/local/etc/nginx/snippets',
'streams_dir': '/usr/local/etc/nginx/streams',
'server_use_symlink': True,
'openssl_package': 'openssl',
'pid_file': '/var/run/nginx.pid',
@@ -140,6 +147,9 @@
'events': {
'worker_connections': 512,
},
'stream' : {
'include': '/etc/nginx/streams/*',
},
'http': {
'sendfile': 'on',
'tcp_nopush': 'on',
@@ -204,3 +214,7 @@
}) %}
{% endif %}
{% endif %}

{% if salt['grains.get']('os_family') == 'FreeBSD' %}
{% do nginx.server.config.stream.update({'include' : nginx.lookup.streams_dir ~ '/*'}) %}
{% endif %}

+ 3
- 0
nginx/passenger.sls 查看文件

@@ -15,6 +15,9 @@ include:
{%- if nginx.snippets is defined %}
- nginx.snippets
{%- endif %}
{%- if nginx.streams is defined %}
- nginx.streams
{%- endif %}
- nginx.servers
- nginx.certificates


+ 0
- 22
nginx/pkg.sls 查看文件

@@ -78,28 +78,6 @@ nginx_official_repo:
- watch_in:
- pkg: nginx_install

{%- if grains.os not in ('Debian',) %}
## applies to Ubuntu and derivatives only #}
nginx_ppa_repo:
pkgrepo:
{%- if from_ppa %}
- managed
{%- else %}
- absent
{%- endif %}
{% if grains.os == 'Ubuntu' %}
- ppa: nginx/{{ nginx.ppa_version }}
{% else %}
- name: deb http://ppa.launchpad.net/nginx/{{ nginx.ppa_version }}/ubuntu {{ grains.oscodename }} main
- keyid: C300EE8C
- keyserver: keyserver.ubuntu.com
{% endif %}
- require_in:
- pkg: nginx_install
- watch_in:
- pkg: nginx_install
{%- endif %}

{%- if from_phusionpassenger %}
nginx_phusionpassenger_repo_keyring:
file.managed:

+ 1
- 0
nginx/servers_config.sls 查看文件

@@ -10,6 +10,7 @@
{% set server_states = [] %}
{#- _nginx is a lightened copy of nginx map intended to passed in templates #}
{%- set _nginx = nginx.copy() %}
{%- do _nginx.pop('streams') if nginx.streams is defined %}
{%- do _nginx.pop('snippets') if nginx.snippets is defined %}
{%- do _nginx.pop('servers') if nginx.servers is defined %}


+ 33
- 0
nginx/streams.sls 查看文件

@@ -0,0 +1,33 @@
# nginx.streams
#
# Manages creation of streams

{%- set tplroot = tpldir.split('/')[0] %}
{%- from tplroot ~ '/map.jinja' import nginx, sls_block with context %}
{%- from tplroot ~ '/libtofs.jinja' import files_switch with context %}

{#- _nginx is a lightened copy of nginx map intended to passed in templates #}
{%- set _nginx = nginx.copy() %}

{%- do _nginx.pop('streams') if nginx.snippets is defined %}
{%- do _nginx.pop('servers') if nginx.servers is defined %}


nginx_streams_dir:
file.directory:
{{ sls_block(nginx.servers.dir_opts) }}
- name: {{ nginx.lookup.streams_dir }}

{% for stream, config in nginx.streams.items() %}
nginx_streams_{{ stream }}:
file.managed:
- name: {{ nginx.lookup.streams_dir ~ '/' ~ stream }}
- source: {{ files_switch([ stream, 'server.conf' ],
'nginx_stream_file_managed'
)
}}
- template: jinja
- context:
config: {{ config|json() }}
nginx: {{ _nginx|json() }}
{% endfor %}

+ 10
- 1
pillar.example 查看文件

@@ -109,7 +109,16 @@ nginx:
- upstream netdata:
- server: 127.0.0.1:19999
- keepalive: 64

streams:
example_stream:
- upstream some_upstream:
- server: '10.0.0.1:8000'
- server: '10.0.0.2:8000'
- server:
- listen: 7000
- proxy_pass: some_upstream
server:
# this partially exposes file.managed parameters as they relate to the main
# nginx.conf file

正在加载...
取消
保存