echo
}
'';
+
+ phpFpmPreStart = { app, varDir, keyFiles, actions }: ''
+ if [ ! -f "${varDir}/currentWebappDir" -o \
+ ! -f "${varDir}/currentKey" -o \
+ "${app}" != "$(cat ${varDir}/currentWebappDir 2>/dev/null)" ] \
+ || ! sha512sum -c --status ${varDir}/currentKey; then
+ pushd ${app} > /dev/null
+ ${builtins.concatStringsSep "\n " actions}
+ popd > /dev/null
+ echo -n "${app}" > ${varDir}/currentWebappDir
+ sha512sum ${builtins.concatStringsSep " " keyFiles} > ${varDir}/currentKey
+ fi
+ '';
}
-{ apacheUser, apacheGroup, aten, lib, config }: rec {
+{ apacheUser, apacheGroup, aten, lib, mylibs, config }: rec {
app = aten.override { inherit (config) environment; };
phpFpm = rec {
- preStart = ''
- if [ ! -f "${app.varDir}/currentWebappDir" -o \
- ! -f "${app.varDir}/currentKey" -o \
- "${app}" != "$(cat ${app.varDir}/currentWebappDir 2>/dev/null)" ] \
- || ! sha512sum -c --status ${app.varDir}/currentKey; then
- pushd ${app} > /dev/null
- /run/wrappers/bin/sudo -u ${apacheUser} APP_ENV=${app.environment} ./bin/console --env=${app.environment} cache:clear --no-warmup
- popd > /dev/null
- echo -n "${app}" > ${app.varDir}/currentWebappDir
- sha512sum /var/secrets/webapps/${app.environment}-aten > ${app.varDir}/currentKey
- fi
- '';
+ preStart = mylibs.phpFpmPreStart {
+ inherit app;
+ inherit (app) varDir;
+ keyFiles = [
+ "/var/secrets/webapps/${app.environment}-aten"
+ ];
+ actions = [
+ "/run/wrappers/bin/sudo -u ${apacheUser} APP_ENV=${app.environment} ./bin/console --env=${app.environment} cache:clear --no-warmup"
+ ];
+ };
serviceDeps = [ "postgresql.service" ];
socket = "/var/run/phpfpm/aten-${app.environment}.sock";
pool = ''
-{ apacheUser, apacheGroup, connexionswing, pkgs, phpPackages, config }:
+{ apacheUser, apacheGroup, connexionswing, pkgs, phpPackages, mylibs, config }:
rec {
app = connexionswing.override { inherit (config) environment; };
keys = [{
'';
}];
phpFpm = rec {
- preStart = ''
- if [ ! -f "${app.varDir}/currentWebappDir" -o \
- ! -f "${app.varDir}/currentKey" -o \
- "${app}" != "$(cat ${app.varDir}/currentWebappDir 2>/dev/null)" ] \
- || ! sha512sum -c --status ${app.varDir}/currentKey; then
- pushd ${app} > /dev/null
- /run/wrappers/bin/sudo -u ${apacheUser} ./bin/console --env=${app.environment} cache:clear --no-warmup
- popd > /dev/null
- echo -n "${app}" > ${app.varDir}/currentWebappDir
- sha512sum /var/secrets/webapps/${app.environment}-connexionswing > ${app.varDir}/currentKey
- fi
- '';
+ preStart = mylibs.phpFpmPreStart {
+ inherit app;
+ inherit (app) varDir;
+ keyFiles = [
+ "/var/secrets/webapps/${app.environment}-connexionswing"
+ ];
+ actions = [
+ "/run/wrappers/bin/sudo -u ${apacheUser} ./bin/console --env=${app.environment} cache:clear --no-warmup"
+ ];
+ };
serviceDeps = [ "mysql.service" ];
socket = "/var/run/phpfpm/connexionswing-${app.environment}.sock";
phpConfig = ''
-{ apacheUser, apacheGroup, tellesflorian, config }:
+{ apacheUser, apacheGroup, tellesflorian, mylibs, config }:
rec {
app = tellesflorian.override { inherit (config) environment; };
keys = [
}
];
phpFpm = rec {
- preStart = ''
- if [ ! -f "${app.varDir}/currentWebappDir" -o \
- ! -f "${app.varDir}/currentKey" -o \
- "${app}" != "$(cat ${app.varDir}/currentWebappDir 2>/dev/null)" ] \
- || ! sha512sum -c --status ${app.varDir}/currentKey; then
- pushd ${app} > /dev/null
- /run/wrappers/bin/sudo -u wwwrun ./bin/console --env=${app.environment} cache:clear --no-warmup
- popd > /dev/null
- echo -n "${app}" > ${app.varDir}/currentWebappDir
- sha512sum /var/secrets/webapps/${app.environment}-tellesflorian > ${app.varDir}/currentKey
- fi
- '';
+ preStart = mylibs.phpFpmPreStart {
+ inherit app;
+ inherit (app) varDir;
+ keyFiles = [
+ "/var/secrets/webapps/${app.environment}-tellesflorian"
+ ];
+ actions = [
+ "/run/wrappers/bin/sudo -u wwwrun ./bin/console --env=${app.environment} cache:clear --no-warmup"
+ ];
+ };
serviceDeps = [ "mysql.service" ];
socket = "/var/run/phpfpm/floriantelles-${app.environment}.sock";
pool = ''
-{ apacheUser, apacheGroup, config, ludivinecassal, pkgs, ruby, sass, imagemagick }:
+{ apacheUser, apacheGroup, config, ludivinecassal, mylibs, pkgs, ruby, sass, imagemagick }:
rec {
app = ludivinecassal.override { inherit (config) environment; };
varDir = "/var/lib/ludivinecassal_${app.environment}";
'';
}];
phpFpm = rec {
- preStart = ''
- if [ ! -f "${app.varDir}/currentWebappDir" -o \
- ! -f "${app.varDir}/currentKey" -o \
- "${app}" != "$(cat ${app.varDir}/currentWebappDir 2>/dev/null)" ] \
- || ! sha512sum -c --status ${app.varDir}/currentKey; then
- pushd ${app} > /dev/null
- /run/wrappers/bin/sudo -u ${apacheUser} ./bin/console --env=${app.environment} cache:clear --no-warmup
- popd > /dev/null
- echo -n "${app}" > ${app.varDir}/currentWebappDir
- sha512sum /var/secrets/webapps/${app.environment}-ludivinecassal > ${app.varDir}/currentKey
- fi
- '';
+ preStart = mylibs.phpFpmPreStart {
+ inherit app;
+ inherit (app) varDir;
+ keyFiles = [
+ "/var/secrets/webapps/${app.environment}-ludivinecassal"
+ ];
+ actions = [
+ "/run/wrappers/bin/sudo -u ${apacheUser} ./bin/console --env=${app.environment} cache:clear --no-warmup"
+ ];
+ };
serviceDeps = [ "mysql.service" ];
socket = "/var/run/phpfpm/ludivinecassal-${app.environment}.sock";
pool = ''
-{ apacheUser, apacheGroup, piedsjaloux, config, pkgs, lib, texlive, imagemagick }:
+{ apacheUser, apacheGroup, piedsjaloux, config, pkgs, lib, mylibs, texlive, imagemagick }:
rec {
app = piedsjaloux.override { inherit (config) environment; };
varDir = "/var/lib/piedsjaloux_${app.environment}";
'';
}];
phpFpm = rec {
- preStart = ''
- if [ ! -f "${app.varDir}/currentWebappDir" -o \
- ! -f "${app.varDir}/currentKey" -o \
- "${app}" != "$(cat ${app.varDir}/currentWebappDir 2>/dev/null)" ] \
- || ! sha512sum -c --status ${app.varDir}/currentKey; then
- pushd ${app} > /dev/null
- /run/wrappers/bin/sudo -u ${apacheUser} ./bin/console --env=${app.environment} cache:clear --no-warmup
- popd > /dev/null
- echo -n "${app}" > ${app.varDir}/currentWebappDir
- sha512sum /var/secrets/webapps/${app.environment}-piedsjaloux > ${app.varDir}/currentKey
- fi
- '';
+ preStart = mylibs.phpFpmPreStart {
+ inherit app;
+ inherit (app) varDir;
+ keyFiles = [
+ "/var/secrets/webapps/${app.environment}-piedsjaloux"
+ ];
+ actions = [
+ "/run/wrappers/bin/sudo -u ${apacheUser} ./bin/console --env=${app.environment} cache:clear --no-warmup"
+ ];
+ };
serviceDeps = [ "mysql.service" ];
socket = "/var/run/phpfpm/piedsjaloux-${app.environment}.sock";
pool = ''
-{ env, wallabag }:
+{ env, wallabag, mylibs }:
rec {
varDir = "/var/lib/wallabag";
keys = [{
'';
};
phpFpm = rec {
- preStart = ''
- if [ ! -f "${varDir}/currentWebappDir" -o \
- ! -f "${varDir}/currentKey" -o \
- "${webappDir}" != "$(cat ${varDir}/currentWebappDir 2>/dev/null)" ] \
- || ! sha512sum -c --status ${varDir}/currentKey; then
- pushd ${webappDir} > /dev/null
- /run/wrappers/bin/sudo -u wwwrun ./bin/console --env=prod cache:clear
- rm -rf /var/lib/wallabag/var/cache/pro_
- /run/wrappers/bin/sudo -u wwwrun ./bin/console --env=prod doctrine:migrations:migrate --no-interaction
- popd > /dev/null
- echo -n "${webappDir}" > ${varDir}/currentWebappDir
- sha512sum /var/secrets/webapps/tools-wallabag > ${varDir}/currentKey
- fi
- '';
+ preStart = mylibs.phpFpmPreStart {
+ app = webappDir;
+ inherit varDir;
+ keyFiles = [
+ "/var/secrets/webapps/tools-wallabag"
+ ];
+ actions = [
+ "/run/wrappers/bin/sudo -u wwwrun ./bin/console --env=prod cache:clear"
+ "rm -rf /var/lib/wallabag/var/cache/pro_"
+ "/run/wrappers/bin/sudo -u wwwrun ./bin/console --env=prod doctrine:migrations:migrate --no-interaction"
+ ];
+ };
serviceDeps = [ "postgresql.service" "openldap.service" ];
basedir = builtins.concatStringsSep ":" [ webappDir "/var/secrets/webapps/tools-wallabag" varDir ];
socket = "/var/run/phpfpm/wallabag.sock";