lxc-php: Have mysqld.sock inside of a directory

Bind mount don't seems to work on a file so the default socket is now
always named mysqld.sock and the configurable variable is
php_conf_mysql_socket_dir that define the directory the socket will be
in.
This commit is contained in:
Mathieu Trossevin 2020-06-05 09:37:43 +02:00
parent 1d9ab0f1f3
commit 49b20f9b12
3 changed files with 5 additions and 5 deletions

View File

@ -8,7 +8,8 @@ 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_default_socket: Null
php_conf_mysql_socket_dir: Null
php_conf_mysql_default_socket: "{{ php_conf_mysql_socket_dir }}/mysqld.sock"
lxc_php_version: Null

View File

@ -27,6 +27,5 @@
lxc_container:
name: "{{ lxc_php_version }}"
container_config:
- "lxc.mount.entry = /var/run/mysqld/mysqld {{ php_conf_mysql_default_socket | replace('/', '', 1) }} none bind,create=file 0 0"
state: restarted
when: php_conf_mysql_default_socket is string
- "lxc.mount.entry = /var/run/mysqld {{ php_conf_mysql_socket_dir | replace('/', '', 1) }} none bind,create=dir 0 0"
when: php_conf_mysql_socket_dir is string

View File

@ -7,7 +7,7 @@ html_errors = {{ php_conf_html_errors }}
allow_url_fopen = {{ php_conf_allow_url_fopen }}
disable_functions = {{ php_conf_disable_functions }}
{% if php_conf_mysql_default_socket %}
{% if php_conf_mysql_socket_dir %}
[Pdo_mysql]
pdo_mysql.default_socket = {{ php_conf_mysql_default_socket }}