Skip to content

Commit

Permalink
Merge pull request #5 from idealista/develop
Browse files Browse the repository at this point in the history
Release 1.2.0
  • Loading branch information
Francisco Javier Tsao Santín authored Jul 10, 2020
2 parents f6f8620 + b995952 commit 0846578
Show file tree
Hide file tree
Showing 21 changed files with 190 additions and 380 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
dist: xenial
language: python
python: "3.7"
python: "3.8"
os: linux
services:
- docker
Expand Down
2 changes: 2 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---

extends: default

ignore: |
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ This project adheres to [Semantic Versioning](http://semver.org/) and [Keep a ch

## [Unreleased](https://github.com/idealista/php_role/tree/develop)

## [1.2.0](https://github.com/idealista/php_role/tree/1.2.0)
## [Full Changelog](https://github.com/idealista/php_role/compare/1.1.0...1.2.0)
### Added
- *Updated test dependencies* @frantsao
- *#3 Added path vars for templates; fix config tasks; improve templates adding additional configuration parameters* @frantsao

## [1.1.0](https://github.com/idealista/php_role/tree/1.1.0)
## [Full Changelog](https://github.com/idealista/php_role/compare/1.0.0...1.1.0)
### Added
Expand Down
7 changes: 4 additions & 3 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ verify_ssl = true
[dev-packages]

[packages]
ansible = "==2.8.8"
molecule = "==2.22"
ansible = "==2.8.11"
molecule = "==3.0.4"
docker = "==4.1.0"
jmespath = "==0.9.4"
jmespath = "==0.9.5"
ansible-lint = "==4.2.0"

[requires]
python_version = "3"
417 changes: 113 additions & 304 deletions Pipfile.lock

Large diffs are not rendered by default.

10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,18 @@ These instructions will get you a copy of the role for your Ansible playbook. On

### Prerequisities

Ansible >= 2.8.x.x version installed.
Ansible >= 2.9.x.x version installed.
Inventory destination should be a Debian environment.

For testing purposes, [Molecule](https://molecule.readthedocs.io/) (version 2.x) with [Docker](https://www.docker.com/) as provider.
For testing purposes, [Molecule](https://molecule.readthedocs.io/) (version 3.x) with [Docker](https://www.docker.com/) as provider.

### Installing

Create or add to your roles dependency file (e.g requirements.yml):

``` yml
- src: idealista.php_role
version: 1.1.0
version: 1.2.0
name: php
```
Expand Down Expand Up @@ -82,7 +82,9 @@ molecule test -s fpm

## Built With

![Ansible](https://img.shields.io/badge/ansible-2.8.8.0-green.svg)
![Ansible](https://img.shields.io/badge/ansible-2.9.9-green.svg)
![Molecule](https://img.shields.io/badge/molecule-3.0.4-green.svg)
![Goss](https://img.shields.io/badge/goss-0.3.13-green.svg)

## Versioning

Expand Down
17 changes: 16 additions & 1 deletion defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,18 @@ php_download_dir: "/usr/src/php_{{ php_version }}"
php_install_dir: "/usr/local/php{{ php_version.split('.') | first }}"
php_unit_file_dir: "/lib/systemd/system/"
php_pid_file: /run/php-fpm.pid
php_max_execution_time: 30
php_max_input_time: 60
php_max_input_nesting_level: 64
php_max_input_vars: 1000
php_memory_limit: 128M
php_upload_max_filesize: 2M
php_max_file_uploads: 20
php_post_max_size: 8M

php_ini_configuration_template:
src: php.ini.j2
dest: "{{ php_install_dir }}/lib/php.ini"

# Required libs & Compile options
php_required_libs:
Expand Down Expand Up @@ -68,8 +80,11 @@ php_compile_options:
php_fpm_install: false

php_fpm_configuration_template:
src: templates/php/fpm/php-fpm.conf.j2
src: php-fpm.conf.j2
dest: "{{ php_install_dir }}/etc/php-fpm.conf"
php_fpm_service_configuration_template:
src: php-fpm.service.j2
dest: "{{ php_unit_file_dir }}/php-fpm.service"

php_fpm_configuration:
# alert, error, warning, notice, debug
Expand Down
16 changes: 0 additions & 16 deletions molecule/default/INSTALL.rst

This file was deleted.

File renamed without changes.
16 changes: 9 additions & 7 deletions molecule/default/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,19 @@ dependency:
name: galaxy
driver:
name: docker
lint:
name: yamllint
lint: |
yamllint .
ansible-lint .
platforms:
- name: phptestnode
image: ${DOCKER_BASE_IMAGE:-debian:stretch-slim}
privileged: true
privileged: false
capabilities:
- SYS_ADMIN
tmpfs:
- '/tmp'
- '/run'
- '/run/lock'
volumes:
- '/sys/fs/cgroup:/sys/fs/cgroup:ro'
command: '/lib/systemd/systemd'
Expand All @@ -23,7 +28,4 @@ provisioner:
scenario:
name: default
verifier:
name: goss
lint:
name: yamllint
enabled: false
name: ansible
4 changes: 2 additions & 2 deletions molecule/default/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
- name: Verify
hosts: all
vars:
goss_version: v0.3.9
goss_version: v0.3.13
goss_arch: amd64
goss_dst: /usr/local/bin/goss
goss_sha256sum: 5e4a51a8c0f955e5ce99851b4a15eed9f1b3b6bee17f23dabda08071775663c8
goss_sha256sum: eb3522ff9682736ff61e2ad114de227de98debcf8a03ca66fcda3917577313e0
goss_url: "https://github.com/aelsabbahy/goss/releases/download/{{ goss_version }}/goss-linux-{{ goss_arch }}"
goss_test_directory: /tmp
goss_format: documentation
Expand Down
16 changes: 0 additions & 16 deletions molecule/fpm/INSTALL.rst

This file was deleted.

File renamed without changes.
16 changes: 9 additions & 7 deletions molecule/fpm/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,21 @@ dependency:
name: galaxy
driver:
name: docker
lint:
name: yamllint
lint: |
yamllint .
ansible-lint .
platforms:
- name: phptestnode
image: ${DOCKER_BASE_IMAGE:-debian:stretch-slim}
privileged: true
privileged: false
capabilities:
- SYS_ADMIN
volumes:
- '/sys/fs/cgroup:/sys/fs/cgroup:ro'
tmpfs:
- '/tmp'
- '/run'
- '/run/lock'
command: '/lib/systemd/systemd'
groups:
- phptest
Expand All @@ -23,7 +28,4 @@ provisioner:
scenario:
name: fpm
verifier:
name: goss
lint:
name: yamllint
enabled: false
name: ansible
4 changes: 2 additions & 2 deletions molecule/fpm/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
- name: Verify
hosts: all
vars:
goss_version: v0.3.9
goss_version: v0.3.13
goss_arch: amd64
goss_dst: /usr/local/bin/goss
goss_sha256sum: 5e4a51a8c0f955e5ce99851b4a15eed9f1b3b6bee17f23dabda08071775663c8
goss_sha256sum: eb3522ff9682736ff61e2ad114de227de98debcf8a03ca66fcda3917577313e0
goss_url: "https://github.com/aelsabbahy/goss/releases/download/{{ goss_version }}/goss-linux-{{ goss_arch }}"
goss_test_directory: /tmp
goss_format: documentation
Expand Down
6 changes: 3 additions & 3 deletions tasks/configure-fpm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

- name: PHP | Template php-fpm configuration file
template:
src: php-fpm.conf.j2
src: "{{ php_fpm_configuration_template.src }}"
dest: "{{ php_fpm_configuration_template.dest }}"
notify: restart php-fpm

Expand All @@ -19,8 +19,8 @@

- name: PHP | Template php-fpm service file
template:
src: php-fpm.service.j2
dest: "{{ php_unit_file_dir }}/php-fpm.service"
src: "{{ php_fpm_service_configuration_template.src }}"
dest: "{{ php_fpm_service_configuration_template.dest }}"
notify: restart php-fpm

- name: PHP | Ensure php-fpm executable is symlinked into a standard path.
Expand Down
4 changes: 2 additions & 2 deletions tasks/configure-php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

- name: PHP | Template php.ini
template:
src: php.ini.j2
dest: "{{ php_install_dir }}/lib/php.ini"
src: "{{ php_ini_configuration_template.src }}"
dest: "{{ php_ini_configuration_template.dest }}"

- name: PHP | Ensure php executable is symlinked into a standard path.
file:
Expand Down
3 changes: 3 additions & 0 deletions templates/php-fpm.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ rlimit_core = {{ php_fpm_configuration.rlimit_core }}
user = {{ value.user }}
group = {{ value.group }}
listen = {{ value.listen }}
{% if value.clear_env is defined %}
clear_env = {{ value.clear_env }}
{% endif %}
{% if value.listen_owner is defined %}
listen.owner = {{ value.listen_owner }}
{% endif %}
Expand Down
2 changes: 1 addition & 1 deletion templates/php-fpm.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Description=The PHP FastCGI Process Manager
After=syslog.target network.target

[Service]
Type=simple
Type=forking
PIDFile={{ php_pid_file }}
ExecStart=/usr/sbin/php-fpm --fpm-config {{ php_fpm_configuration_template.dest }}
ExecReload=/bin/kill -USR2 $MAINPID
Expand Down
16 changes: 8 additions & 8 deletions templates/php.ini.j2
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ expose_php = On
; Maximum execution time of each script, in seconds
; http://php.net/max-execution-time
; Note: This directive is hardcoded to 0 for the CLI SAPI
max_execution_time = 30
max_execution_time = {{ php_max_execution_time }}

; Maximum amount of time each script may spend parsing request data. It's a good
; idea to limit this time on productions servers in order to eliminate unexpectedly
Expand All @@ -393,18 +393,18 @@ max_execution_time = 30
; Development Value: 60 (60 seconds)
; Production Value: 60 (60 seconds)
; http://php.net/max-input-time
max_input_time = 60
max_input_time = {{ php_max_input_time }}

; Maximum input variable nesting level
; http://php.net/max-input-nesting-level
;max_input_nesting_level = 64
max_input_nesting_level = {{ php_max_input_nesting_level }}

; How many GET/POST/COOKIE input variables may be accepted
;max_input_vars = 1000
max_input_vars = {{ php_max_input_vars }}

; Maximum amount of memory a script may consume (128MB)
; http://php.net/memory-limit
memory_limit = 128M
memory_limit = {{ php_memory_limit }}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Error handling and logging ;
Expand Down Expand Up @@ -672,7 +672,7 @@ auto_globals_jit = On
; Its value may be 0 to disable the limit. It is ignored if POST data reading
; is disabled through enable_post_data_reading.
; http://php.net/post-max-size
post_max_size = 8M
post_max_size = {{ php_post_max_size }}

; Automatically add files before PHP document.
; http://php.net/auto-prepend-file
Expand Down Expand Up @@ -824,10 +824,10 @@ file_uploads = On

; Maximum allowed size for uploaded files.
; http://php.net/upload-max-filesize
upload_max_filesize = 2M
upload_max_filesize = {{ php_upload_max_filesize }}

; Maximum number of files that can be uploaded via a single request
max_file_uploads = 20
max_file_uploads = {{ php_max_file_uploads }}

;;;;;;;;;;;;;;;;;;
; Fopen wrappers ;
Expand Down
6 changes: 3 additions & 3 deletions test-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ansible==2.8.8
molecule==2.22
ansible==2.9.9
ansible-lint==4.2.0
molecule==3.0.4
docker==4.1.0
jmespath==0.9.4

0 comments on commit 0846578

Please sign in to comment.