Skip to content

Commit

Permalink
#6 Merge develop and fix test problem with Debian 9
Browse files Browse the repository at this point in the history
  • Loading branch information
Jose committed Feb 3, 2018
2 parents 9ebcaf1 + 83bf3b3 commit aaa68db
Show file tree
Hide file tree
Showing 10 changed files with 51 additions and 9 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ This project adheres to [Semantic Versioning](http://semver.org/) and [Keep a ch
## [Unreleased](https://github.com/idealista/nginx-role/tree/develop)
- *[#6](https://github.com/idealista/nginx-role/issues/6) Add Travis CI* @jnogol

## [1.6.0](https://github.com/idealista/nginx-role/tree/1.6.0) (2017-10-26)
[Full Changelog](https://github.com/idealista/nginx-role/compare/1.5.0...1.6.0)

### Added
- *[#32](https://github.com/idealista/nginx-role/issues/32) Support worker_rlimit_nofile setting* @acuervof

## [1.5.0](https://github.com/idealista/nginx-role/tree/1.5.0) (2017-06-30)
[Full Changelog](https://github.com/idealista/nginx-role/compare/1.4.0...1.5.0)

Expand Down
5 changes: 5 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ nginx_service_state: started

# Connection properties
nginx_workers: auto
# if you don't set FD's then OS settings will be used which is by default 2000
# nginx_worker_rlimit_nofile: 2000
nginx_connections: 2500
nginx_keepalive_timeout: 65
nginx_keepalive_requests: 100000
Expand All @@ -33,6 +35,8 @@ nginx_extra_servers_template_path: "{{ playbook_dir }}/templates/nginx/servers"
nginx_install_bin_path: "/usr"
nginx_extra_path: "extra-conf"
nginx_extra_conf_path: "{{ nginx_conf_path }}/{{ nginx_extra_path }}"
nginx_logrotate_template_path: "{{ playbook_dir }}/templates/logrotate.j2"


# Heathers_more
headers_more_version: 0.31
Expand All @@ -56,6 +60,7 @@ nginx_force_reinstall: false
## https://www.nginx.com/resources/wiki/start/topics/tutorials/installoptions/
nginx_compile_time_options_builtin_modules:
- http_stub_status_module
- http_realip_module

nginx_compile_time_options_external_modules_paths:
- /nginxbuild/headers-more-nginx-module-{{ headers_more_version }}
Expand Down
17 changes: 13 additions & 4 deletions molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,36 +60,45 @@ vagrant:
- network_name: private_network
type: dhcp
auto_config: true

docker:
network:
- name: nginx-network
driver: bridge
containers:
- name: nginx.vm
ansible_groups:
- group01
image: geerlingguy/docker-debian8-ansible
dockerfile: tests/Dockerfile
image: nginx_role
image_version: latest
privileged: True
cap_add:
- SYS_ADMIN
volume_mounts:
- '/sys/fs/cgroup:/sys/fs/cgroup:ro'
command: '/lib/systemd/systemd'
network_mode: nginx-network

- name: nginx-old.vm
ansible_groups:
- group01
image: geerlingguy/docker-debian8-ansible
dockerfile: tests/Dockerfile
image: nginx_role
image_version: latest
privileged: True
cap_add:
- SYS_ADMIN
volume_mounts:
- '/sys/fs/cgroup:/sys/fs/cgroup:ro'
command: '/lib/systemd/systemd'
network_mode: nginx-network

# verifier configuration
verifier:
name: testinfra
options:
# We have to override these options because, when Docker driver selected,
# Testinfra uses Docker as backend connection instead of Ansible and the
# fixture in tests/test_ansible.yml won't work and neither will testinfra
# find the containers
connection: ansible
ansible-inventory: .molecule/ansible_inventory
2 changes: 1 addition & 1 deletion tasks/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@

- name: NGINX | Copy logrotate config
template:
src: logrotate.j2
src: "{{ nginx_logrotate_template_path }}"
dest: /etc/logrotate.d/nginx
mode: 0644
owner: root
Expand Down
6 changes: 5 additions & 1 deletion templates/nginx.conf.j2
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
worker_processes {{ nginx_workers }};
error_log {{ nginx_error_log }};
{% if nginx_worker_rlimit_nofile is defined %}
worker_rlimit_nofile {{ nginx_worker_rlimit_nofile }};
{% endif %}

events {
worker_connections {{ nginx_connections }};
use epoll;
multi_accept on;
}

http {
Expand All @@ -14,7 +18,7 @@ http {

client_max_body_size {{ nginx_client_max_body_size }};

include mime.types;
include mime.types;

default_type application/octet-stream;
sendfile on;
Expand Down
5 changes: 5 additions & 0 deletions tests/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM geerlingguy/docker-debian9-ansible:latest

# This is to override Testinfra issue with Debian 9 Docker image
RUN touch /tmp/systemd
RUN ln -s /tmp/systemd /sbin/init
2 changes: 1 addition & 1 deletion tests/group_vars/group01.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
nginx_extra_servers_path: "{{ playbook_dir }}/files"
nginx_extra_servers_template_path: "{{ playbook_dir }}/templates"
nginx_extra_servers_template_path: "{{ playbook_dir }}/templates/sites"

web2_port: 8888
nginx_prometheus_metrics_port: 9888
Expand Down
4 changes: 2 additions & 2 deletions tests/group_vars/group02.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
nginx_extra_servers_path: "{{ playbook_dir }}/files"
nginx_extra_servers_template_path: "{{ playbook_dir }}/templates"
nginx_extra_servers_template_path: "{{ playbook_dir }}/templates/sites"

web2_port: 8888
nginx_prometheus_metrics_enabled: false
nginx_prometheus_metrics_enabled: false
13 changes: 13 additions & 0 deletions tests/templates/logrotate.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{{ nginx_log_path }}/*.log {
daily
missingok
rotate 7
size 500M
compress
notifempty
create 644 {{ nginx_user }} {{ nginx_group }}
sharedscripts
postrotate
[ -f /run/nginx/nginx.pid ] && kill -USR1 `cat /run/nginx/nginx.pid`
endscript
}
File renamed without changes.

0 comments on commit aaa68db

Please sign in to comment.