Skip to content

Commit

Permalink
#9 Add max body size
Browse files Browse the repository at this point in the history
  • Loading branch information
jmonterrubio committed Mar 2, 2017
1 parent 6f9b36f commit c865fe2
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 23 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ This project adheres to [Semantic Versioning](http://semver.org/) and [Keep a ch

## [Unreleased]

### Added
- *[#9](https://github.com/idealista-tech/nginx-role/issues/9) Add max body size configurable* @jmonterrubio

## [1.1.0](https://github.com/idealista-tech/nginx-role/tree/1.1.0) (2017-01-24)
[Full Changelog](https://github.com/idealista-tech/nginx-role/compare/1.0.2...1.1.0)

Expand Down
14 changes: 8 additions & 6 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ nginx_workers: auto
nginx_connections: 2500
nginx_keepalive_timeout: 65
nginx_keepalive_requests: 100000
nginx_pid_path: "/var/run/nginx/"
nginx_log_path: "/var/log/nginx/"
nginx_access_log: "{{ nginx_log_path }}access.log"
nginx_error_log: "{{ nginx_log_path }}error.log"
nginx_conf_path: "/etc/nginx/"
nginx_conf: "{{ nginx_conf_path }}nginx.conf"
nginx_client_max_body_size: 50M

nginx_pid_path: "/var/run/nginx"
nginx_log_path: "/var/log/nginx"
nginx_access_log: "{{ nginx_log_path }}/access.log"
nginx_error_log: "{{ nginx_log_path }}/error.log"
nginx_conf_path: "/etc/nginx"
nginx_conf: "{{ nginx_conf_path }}/nginx.conf"

nginx_install_bin_path: "/usr"
headers_more_version: 0.27
Expand Down
8 changes: 8 additions & 0 deletions meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,11 @@ galaxy_info:
company: Idealista S.A.
description: Nginx server
min_ansible_version: 2.2
license: Apache 2.0
platforms:
- name: Debian
versions:
- jessie
categories:
- webserver
- proxy
6 changes: 5 additions & 1 deletion molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ ansible:

# configuration options for the internal call to vagrant
vagrant:
# molecule's --platform option will look for these names
# molecule's --platform option will look for these names
raw_config_args:
- "landrush.enabled = true"
- "landrush.tld = ''"
- "landrush.guest_redirect_dns = false"
platforms:
- name: Debian
box: debian/jessie64
Expand Down
15 changes: 7 additions & 8 deletions tasks/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
state: directory
owner: "{{ nginx_user }}"
group: "{{ nginx_group }}"
recurse: yes

- name: NGINX | Update conf directory owner
file:
Expand All @@ -29,17 +28,17 @@
- name: NGINX | Copy server config
template:
src: "{{ item }}.j2"
dest: "/{{ item }}"
dest: "{{ nginx_conf_path }}/{{ item }}"
owner: "{{ nginx_user }}"
group: "{{ nginx_group }}"
mode: "0640"
notify: restart nginx
with_items:
- "etc/nginx/nginx.conf"
- "nginx.conf"

- name: NGINX | Create directories
file:
path: "{{ nginx_conf_path }}{{ item }}"
path: "{{ nginx_conf_path }}/{{ item }}"
state: directory
owner: "{{ nginx_user }}"
group: "{{ nginx_group }}"
Expand All @@ -59,21 +58,21 @@
- name: NGINX | Copy prometheus lib
copy:
src: prometheus.lua
dest: "{{ nginx_conf_path }}plugins/prometheus.lua"
dest: "{{ nginx_conf_path }}/plugins/prometheus.lua"
owner: "{{ nginx_user }}"
group: "{{ nginx_group }}"

- name: NGINX | Copy prometheus metric server conf
template:
src: prometheus.j2
dest: "{{ nginx_conf_path }}sites-available/prometheus"
dest: "{{ nginx_conf_path }}/sites-available/prometheus"
owner: "{{ nginx_user }}"
group: "{{ nginx_group }}"

- name: NGINX | Enable prometheus metric server
file:
src: "{{ nginx_conf_path }}sites-available/prometheus"
dest: "{{ nginx_conf_path }}sites-enabled/prometheus"
src: "{{ nginx_conf_path }}/sites-available/prometheus"
dest: "{{ nginx_conf_path }}/sites-enabled/prometheus"
state: link
owner: "{{ nginx_user }}"
group: "{{ nginx_group }}"
Expand Down
2 changes: 1 addition & 1 deletion tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
--conf-path={{ nginx_conf }}
--error-log-path={{ nginx_error_log }}
--http-log-path={{ nginx_access_log }}
--pid-path={{ nginx_pid_path }}nginx.pid
--pid-path={{ nginx_pid_path }}/nginx.pid
--lock-path=/var/lock/nginx.lock
- make
- make install
Expand Down
4 changes: 2 additions & 2 deletions templates/logrotate.j2
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{ nginx_log_path }}*.log {
{{ nginx_log_path }}/*.log {
daily
missingok
rotate 7
Expand All @@ -8,6 +8,6 @@
create 644 {{ nginx_user }} {{ nginx_group }}
sharedscripts
postrotate
[ -f {{ nginx_pid_path }}nginx.pid ] && kill -USR1 `cat {{ nginx_pid_path }}nginx.pid`
[ -f {{ nginx_pid_path }}/nginx.pid ] && kill -USR1 `cat {{ nginx_pid_path }}/nginx.pid`
endscript
}
4 changes: 2 additions & 2 deletions templates/etc/nginx/nginx.conf.j2 → templates/nginx.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ http {

access_log {{ nginx_access_log }} main;

include {{ nginx_conf_path }}sites-enabled/*;
include {{ nginx_conf_path }}/sites-enabled/*;

# PROMETHEUS METRIC
lua_shared_dict prometheus_metrics 10M;
lua_package_path "{{ nginx_conf_path }}plugins/prometheus.lua";
lua_package_path "{{ nginx_conf_path }}/plugins/prometheus.lua";
init_by_lua '
prometheus = require("prometheus").init("prometheus_metrics")
metric_requests = prometheus:counter(
Expand Down
2 changes: 1 addition & 1 deletion templates/nginx.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Type=forking
ExecStartPre=/usr/sbin/nginx -t -q -g 'daemon on; master_process on;'
ExecStart=/usr/sbin/nginx -g 'daemon on; master_process on;'
ExecReload=/usr/sbin/nginx -g 'daemon on; master_process on;' -s reload
ExecStop=-/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile {{ nginx_pid_path }}nginx.pid
ExecStop=-/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile {{ nginx_pid_path }}/nginx.pid
TimeoutStopSec=5
KillMode=mixed
User=root
Expand Down
2 changes: 0 additions & 2 deletions tests/inventory/vagrant.ini

This file was deleted.

0 comments on commit c865fe2

Please sign in to comment.