X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=nixops%2Fmodules%2Fwebsites%2Fconnexionswing%2Fconnexionswing.nix;h=c1781841db51d16dadd1041e909953fbbf1bb6cc;hb=a754e9dbf5d6c35398f3c4ec52c3daf5f8ed2dd3;hp=307def0ad5b619d057aef27aaa21e9d27b96d5b6;hpb=6f75a415ce4eaa362329c42e31102cef7b9a5c81;p=perso%2FImmae%2FConfig%2FNix.git diff --git a/nixops/modules/websites/connexionswing/connexionswing.nix b/nixops/modules/websites/connexionswing/connexionswing.nix index 307def0..c178184 100644 --- a/nixops/modules/websites/connexionswing/connexionswing.nix +++ b/nixops/modules/websites/connexionswing/connexionswing.nix @@ -3,8 +3,12 @@ let connexionswing = { config }: rec { environment = config.environment; varDir = "/var/lib/connexionswing_${environment}"; - configRoot = - writeText "parameters.yml" '' + keys."${environment}-connexionswing" = { + destDir = "/run/keys/webapps"; + user = apache.user; + group = apache.group; + permissions = "0700"; + text = '' # This file is auto-generated during the composer install parameters: database_host: ${config.mysql.host} @@ -27,6 +31,7 @@ let arguments: ['/run/wrappers/bin/sendmail -bs'] '' else ""} ''; + }; phpFpm = rec { socket = "/var/run/phpfpm/connexionswing-${environment}.sock"; phpConfig = '' @@ -41,7 +46,7 @@ let php_admin_value[upload_max_filesize] = 20M php_admin_value[post_max_size] = 20M ;php_admin_flag[log_errors] = on - php_admin_value[open_basedir] = "/run/wrappers/bin/sendmail:${configRoot}:${webappDir}:${varDir}:/tmp" + php_admin_value[open_basedir] = "/run/wrappers/bin/sendmail:/run/keys/webapps/${environment}-connexionswing:${webappDir}:${varDir}:/tmp" php_admin_value[session.save_path] = "${varDir}/phpSessions" ${if environment == "dev" then '' pm = ondemand @@ -56,10 +61,12 @@ let pm.max_spare_servers = 3 ''}''; }; - apache = { + apache = rec { user = "wwwrun"; group = "wwwrun"; modules = [ "proxy_fcgi" ]; + webappName = "connexionswing_${environment}"; + root = "/run/current-system/webapps/${webappName}"; vhostConf = '' SetHandler "proxy:unix:${phpFpm.socket}|fcgi://localhost" @@ -84,7 +91,7 @@ let ErrorDocument 401 "" - + Options Indexes FollowSymLinks MultiViews Includes AllowOverride None Require all granted @@ -127,7 +134,7 @@ let '' else '' Use Stats connexionswing.com - + Options Indexes FollowSymLinks MultiViews Includes AllowOverride All Require all granted @@ -164,10 +171,10 @@ let cd $out ${if environment == "prod" then "php ./bin/console assetic:dump --env=prod --no-debug" else ""} rm app/config/parameters.yml - ln -sf ${configRoot} app/config/parameters.yml + ln -sf /run/keys/webapps/${environment}-connexionswing app/config/parameters.yml rm -rf var/{logs,cache} - ln -sf ../../../../../../${varDir}/var/{logs,cache} var/ - ln -sf ../../../../../${varDir}/{medias,uploads} web/images/ + ln -sf ${varDir}/var/{logs,cache} var/ + ln -sf ${varDir}/{medias,uploads} web/images/ ''; }); webRoot = "${webappDir}/web";