-{ pkgs, lib, writeText, fetchedGitPrivate, stdenv, composerEnv, phpPackages, fetchurl, fetchgit }:
-let
- connexionswing = { config }: rec {
- environment = config.environment;
- varDir = "/var/lib/connexionswing_${environment}";
- configRoot =
- writeText "parameters.yml" ''
- # This file is auto-generated during the composer install
- parameters:
- database_host: ${config.mysql.host}
- database_port: ${config.mysql.port}
- database_name: ${config.mysql.name}
- database_user: ${config.mysql.user}
- database_password: ${config.mysql.password}
- database_server_version: ${pkgs.mariadb.mysqlVersion}
- mailer_transport: sendmail
- mailer_host: null
- mailer_user: null
- mailer_password: null
- subscription_email: ${config.email}
- allow_robots: true
- secret: ${config.secret}
- ${if environment == "prod" then ''
- services:
- swiftmailer.mailer.default.transport:
- class: Swift_SendmailTransport
- arguments: ['/run/wrappers/bin/sendmail -bs']
- '' else ""}
+{ connexionswing, pkgs, phpPackages, config }:
+rec {
+ app = connexionswing.override { inherit (config) environment; };
+ keys = [{
+ dest = "webapps/${app.environment}-connexionswing";
+ user = apache.user;
+ group = apache.group;
+ permissions = "0400";
+ text = ''
+ # This file is auto-generated during the composer install
+ parameters:
+ database_host: ${config.mysql.host}
+ database_port: ${config.mysql.port}
+ database_name: ${config.mysql.name}
+ database_user: ${config.mysql.user}
+ database_password: ${config.mysql.password}
+ database_server_version: ${pkgs.mariadb.mysqlVersion}
+ mailer_transport: sendmail
+ mailer_host: null
+ mailer_user: null
+ mailer_password: null
+ subscription_email: ${config.email}
+ allow_robots: true
+ secret: ${config.secret}
+ ${if app.environment == "prod" then ''
+ services:
+ swiftmailer.mailer.default.transport:
+ class: Swift_SendmailTransport
+ arguments: ['/run/wrappers/bin/sendmail -bs']
+ '' else ""}
+ '';
+ }];
+ 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}-connexionswing > ${app.varDir}/currentKey
+ fi
+ '';
+ serviceDeps = [ "mysql.service" ];
+ socket = "/var/run/phpfpm/connexionswing-${app.environment}.sock";
+ phpConfig = ''
+ extension=${phpPackages.imagick}/lib/php/extensions/imagick.so