Browse Source

Merge pull request 'packweb-multi-php: Allow php to contact local mysql with localhost' (#116) from mtrossevin/ansible-roles:packweb-multi-php2 into unstable

Reviewed-on: https://gitea.evolix.org/evolix/ansible-roles/pulls/116
pull/119/head
Ludovic Poujol 4 months ago
parent
commit
82d9abca3d
7 changed files with 36 additions and 4 deletions
  1. +1
    -0
      CHANGELOG.md
  2. +4
    -0
      lxc-php/defaults/main.yml
  3. +6
    -0
      lxc-php/handlers/main.yml
  4. +9
    -1
      lxc-php/tasks/misc.yml
  5. +8
    -0
      lxc-php/templates/z-evolinux-defaults.ini.j2
  6. +5
    -0
      mysql-oracle/files/evolinux-defaults.cnf
  7. +3
    -3
      packweb-apache/meta/main.yml

+ 1
- 0
CHANGELOG.md View File

@ -15,6 +15,7 @@ The **patch** part changes incrementally at each release.
* dovecot: Update munin plugin & configure it
* nextcloud: New role to setup a nextcloud instance
* redis: variable to force use of port 6379 in instances mode
* lxc-php: Allow php containers to contact local MySQL with localhost
### Changed


+ 4
- 0
lxc-php/defaults/main.yml View File

@ -7,6 +7,10 @@ php_conf_html_errors: "Off"
php_conf_allow_url_fopen: "Off"
php_conf_disable_functions: "exec,shell-exec,system,passthru,popen"
# Allows accessing a local mysql database using localhost
php_conf_mysql_socket_dir: /mysqld
php_conf_mysql_default_socket: "{{ php_conf_mysql_socket_dir }}/mysqld.sock"
lxc_php_version: Null
lxc_php_container_releases:


+ 6
- 0
lxc-php/handlers/main.yml View File

@ -18,3 +18,9 @@
lxc_container:
name: "{{ lxc_php_version }}"
container_command: "systemctl restart opensmtpd"
- name: Restart container
lxc_container:
name: "{{ lxc_php_version }}"
state: restarted

+ 9
- 1
lxc-php/tasks/misc.yml View File

@ -18,8 +18,16 @@
dest: "/var/lib/lxc/{{ lxc_php_version }}/rootfs/etc/mailname"
notify: "Restart opensmtpd"
- name: "{{ lxc_php_version }} - Install misc packages"
lxc_container:
name: "{{ lxc_php_version }}"
container_command: "DEBIAN_FRONTEND=noninteractive apt install -y cron logrotate git zip unzip"
- name: "{{ lxc_php_version }} - Add MySQL socket to container default mounts"
lxc_container:
name: "{{ lxc_php_version }}"
container_config:
- "lxc.mount.entry = /run/mysqld {{ php_conf_mysql_socket_dir | replace('/', '', 1) }} none bind,create=dir 0 0"
when: php_conf_mysql_socket_dir is string
notify: "Restart container"

+ 8
- 0
lxc-php/templates/z-evolinux-defaults.ini.j2 View File

@ -6,3 +6,11 @@ log_errors = {{ php_conf_log_errors }}
html_errors = {{ php_conf_html_errors }}
allow_url_fopen = {{ php_conf_allow_url_fopen }}
disable_functions = {{ php_conf_disable_functions }}
{% if php_conf_mysql_socket_dir %}
[Pdo_mysql]
pdo_mysql.default_socket = {{ php_conf_mysql_default_socket }}
[MySQLi]
mysqli.default_socket = {{ php_conf_mysql_default_socket }}
{% endif %}

+ 5
- 0
mysql-oracle/files/evolinux-defaults.cnf View File

@ -1,6 +1,8 @@
[mysqld]
###### Connexions
# Path to socket
socket = /run/mysqld/mysqld.sock
# Maximum de connexions concurrentes (defaut = 100)... provoque un "Too many connections"
max_connections = 250
# Maximum de connexions en attente en cas de max_connections atteint (defaut = 50)
@ -60,3 +62,6 @@ character-set-server=utf8
collation-server=utf8_general_ci
# Patch MySQL 5.5.53
secure-file-priv = ""
[client]
socket = /run/mysqld/mysqld.sock

+ 3
- 3
packweb-apache/meta/main.yml View File

@ -21,11 +21,11 @@ dependencies:
- { role: evolix/apache }
- { role: evolix/php, php_apache_enable: True, when: packweb_apache_modphp }
- { role: evolix/php, php_fpm_enable: True, when: packweb_apache_fpm }
- { role: evolix/lxc-php, lxc_php_version: php56, when: "'php56' in packweb_multiphp_versions" }
- { role: evolix/lxc-php, lxc_php_version: php70, when: "'php70' in packweb_multiphp_versions" }
- { role: evolix/lxc-php, lxc_php_version: php73, when: "'php73' in packweb_multiphp_versions" }
- { role: evolix/squid, squid_localproxy_enable: True }
- { role: evolix/mysql, when: packweb_mysql_variant == "debian" }
- { role: evolix/mysql-oracle, when: packweb_mysql_variant == "oracle" }
- { role: evolix/lxc-php, lxc_php_version: php56, when: "'php56' in packweb_multiphp_versions" }
- { role: evolix/lxc-php, lxc_php_version: php70, when: "'php70' in packweb_multiphp_versions" }
- { role: evolix/lxc-php, lxc_php_version: php73, when: "'php73' in packweb_multiphp_versions" }
- { role: evolix/webapps/evoadmin-web, evoadmin_enable_vhost: "{{ packweb_enable_evoadmin_vhost }}", evoadmin_multiphp_versions: "{{ packweb_multiphp_versions }}" }
- { role: evolix/evoacme }

Loading…
Cancel
Save