working merges with master #2

Merged
awkawb merged 10 commits from working into master 2024-10-14 16:30:46 -04:00
Showing only changes of commit d7ee5fa774 - Show all commits

View File

@ -106,10 +106,6 @@ in
phpfpm.settings = lib.mkOption { phpfpm.settings = lib.mkOption {
type = with lib.types; attrsOf (oneOf [ int str bool ]); type = with lib.types; attrsOf (oneOf [ int str bool ]);
default = { default = {
"listen.owner" = user;
"listen.group" = group;
"listen.mode" = "0660";
"pm" = "dynamic"; "pm" = "dynamic";
"pm.start_servers" = "2"; "pm.start_servers" = "2";
"pm.min_spare_servers" = "2"; "pm.min_spare_servers" = "2";
@ -121,8 +117,6 @@ in
"php_admin_value[error_log]" = "stderr"; "php_admin_value[error_log]" = "stderr";
"php_admin_flag[log_errors]" = true; "php_admin_flag[log_errors]" = true;
"catch_workers_output" = true;
}; };
description = '' description = ''
@ -288,7 +282,13 @@ in
services.phpfpm.pools.invoice-ninja = { services.phpfpm.pools.invoice-ninja = {
inherit user group phpPackage; inherit user group phpPackage;
inherit (cfg.phpfpm) settings;
settings = {
"listen.owner" = user;
"listen.group" = group;
"listen.mode" = "0660";
"catch_workers_output" = true;
} // cfg.phpfpm.settings;
phpOptions = '' phpOptions = ''
post_max_size = ${cfg.maxUploadSize} post_max_size = ${cfg.maxUploadSize}
@ -416,41 +416,41 @@ in
}; };
script = '' script = ''
# Before running any PHP program, cleanup the code cache. # Before running any PHP program, cleanup the code cache.
# It's necessary if you upgrade the application otherwise you might # It's necessary if you upgrade the application otherwise you might
# try to import non-existent modules. # try to import non-existent modules.
rm -f ${cfg.runtimeDir}/app.php rm -f ${cfg.runtimeDir}/app.php
rm -rf ${cfg.runtimeDir}/cache/* rm -rf ${cfg.runtimeDir}/cache/*
# Concatenate non-secret .env and secret .env # Concatenate non-secret .env and secret .env
rm -f ${cfg.dataDir}/.env rm -f ${cfg.dataDir}/.env
cp --no-preserve=all ${configFile} ${cfg.dataDir}/.env cp --no-preserve=all ${configFile} ${cfg.dataDir}/.env
echo -e '\n' >> ${cfg.dataDir}/.env echo -e '\n' >> ${cfg.dataDir}/.env
cat "$CREDENTIALS_DIRECTORY/env-secrets" >> ${cfg.dataDir}/.env cat "$CREDENTIALS_DIRECTORY/env-secrets" >> ${cfg.dataDir}/.env
# Link the static storage (package provided) to the runtime storage # Link the static storage (package provided) to the runtime storage
# Necessary for cities.json and static images. # Necessary for cities.json and static images.
rsync -av --no-perms ${invoice-ninja}/storage-static/ ${cfg.dataDir}/storage rsync -av --no-perms ${invoice-ninja}/storage-static/ ${cfg.dataDir}/storage
# Link the app.php in the runtime folder. # Link the app.php in the runtime folder.
# We cannot link the cache folder only because bootstrap folder needs to be writeable. # We cannot link the cache folder only because bootstrap folder needs to be writeable.
ln -sf ${invoice-ninja}/bootstrap-static/app.php ${cfg.runtimeDir}/app.php ln -sf ${invoice-ninja}/bootstrap-static/app.php ${cfg.runtimeDir}/app.php
# Perform the first migration # Perform the first migration
[[ ! -f ${cfg.dataDir}/.initial-migration ]] && invoice-ninja-manage migrate --force && touch ${cfg.dataDir}/.initial-migration [[ ! -f ${cfg.dataDir}/.initial-migration ]] && invoice-ninja-manage migrate --force && touch ${cfg.dataDir}/.initial-migration
# Seed database with records # Seed database with records
# Necessary for languages, currencies, countries, etc. # Necessary for languages, currencies, countries, etc.
invoice-ninja-manage db:seed --force invoice-ninja-manage db:seed --force
# Create Invoice Ninja admin account # Create Invoice Ninja admin account
[[ ! -f ${cfg.dataDir}/.admin-created ]] \ [[ ! -f ${cfg.dataDir}/.admin-created ]] \
&& invoice-ninja-manage ninja:create-account --email=${cfg.adminEmail} --password=${cfg.adminPassword} \ && invoice-ninja-manage ninja:create-account --email=${cfg.adminEmail} --password=${cfg.adminPassword} \
&& touch ${cfg.dataDir}/.admin-created && touch ${cfg.dataDir}/.admin-created
invoice-ninja-manage route:cache invoice-ninja-manage route:cache
invoice-ninja-manage view:cache invoice-ninja-manage view:cache
invoice-ninja-manage config:cache invoice-ninja-manage config:cache
''; '';
}; };