diff --git a/bundles/nextcloud/metadata.py b/bundles/nextcloud/metadata.py index 911ae7d..19258ab 100644 --- a/bundles/nextcloud/metadata.py +++ b/bundles/nextcloud/metadata.py @@ -41,6 +41,16 @@ defaults = { 'admin_user': 'admin', 'admin_pass': repo.vault.password_for(f'{node.name} nextcloud admin pw'), }, + 'php': { + 'post_max_size': '32G', + 'www.conf': { + 'env[hostname]': '$HOSTNAME', + 'env[path]': '/usr/local/bin:/usr/bin:/bin', + 'env[tmp]': '/tmp', + 'env[tmpdir]': '/tmp', + 'env[temp]': '/tmp', + }, + }, 'postgresql': { 'roles': { 'nextcloud': { diff --git a/bundles/php/items.py b/bundles/php/items.py index 6d58cbb..2f4175b 100644 --- a/bundles/php/items.py +++ b/bundles/php/items.py @@ -6,23 +6,35 @@ php_ini_context = { } files = { + f'/etc/php/{version}/cli/php.ini': { + 'content_type': 'mako', + 'context': php_ini_context, + 'needs': { + f'pkg_apt:php{version}', + f'pkg_apt:php{version}-fpm', + }, + }, f'/etc/php/{version}/fpm/php.ini': { 'content_type': 'mako', 'context': php_ini_context, 'needs': { - # "all php packages" - 'pkg_apt:' + f'pkg_apt:php{version}', + f'pkg_apt:php{version}-fpm', }, 'triggers': { f'svc_systemd:php{version}-fpm:restart', }, }, - f'/etc/php/{version}/cli/php.ini': { - 'content_type': 'mako', - 'context': php_ini_context, + f'/etc/php/{version}/fpm/pool.d/www.conf': { + 'content': repo.libs.ini.dumps({ + 'www': node.metadata.get('php/www.conf'), + }), 'needs': { - # "all php packages" - 'pkg_apt:' + f'pkg_apt:php{version}', + f'pkg_apt:php{version}-fpm', + }, + 'triggers': { + f'svc_systemd:php{version}-fpm:restart', }, }, } diff --git a/bundles/php/metadata.py b/bundles/php/metadata.py index 80556db..859ca5c 100644 --- a/bundles/php/metadata.py +++ b/bundles/php/metadata.py @@ -1,10 +1,32 @@ defaults = { 'php': { 'post_max_size': '32G', - }, - 'apt': { - 'packages': { - 'php': {}, + 'www.conf': { + 'user': 'www-data', + 'group': 'www-data', + 'listen': '/run/php/php7.4-fpm.sock', + 'listen.owner': 'www-data', + 'listen.group': 'www-data', + 'pm': 'dynamic', + 'pm.max_children': '5', + 'pm.start_servers': '2', + 'pm.min_spare_servers': '1', + 'pm.max_spare_servers': '3', }, }, } + + +@metadata_reactor.provides( + 'apt/packages', +) +def apt(metadata): + version = metadata.get('php/version') + return { + 'apt': { + 'packages': { + f'php{version}': {}, + f'php{version}-fpm': {}, + }, + }, + }