From 34e2fd14c7091f85b667667cb2b74c1b75e005db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Sun, 6 Jan 2019 17:57:28 +0100 Subject: Add piedsjaloux website --- virtual/packages/aten.nix | 4 +- virtual/packages/ludivinecassal.nix | 4 +- virtual/packages/piedsjaloux.json | 14 +++ virtual/packages/piedsjaloux.nix | 169 +++++++++++++++++++++++++++++ virtual/packages/piedsjaloux_goaccess.conf | 99 +++++++++++++++++ 5 files changed, 286 insertions(+), 4 deletions(-) create mode 100644 virtual/packages/piedsjaloux.json create mode 100644 virtual/packages/piedsjaloux.nix create mode 100644 virtual/packages/piedsjaloux_goaccess.conf (limited to 'virtual/packages') diff --git a/virtual/packages/aten.nix b/virtual/packages/aten.nix index 21bbff0..8251b31 100644 --- a/virtual/packages/aten.nix +++ b/virtual/packages/aten.nix @@ -37,8 +37,6 @@ let assert checkEnv "NIXOPS_${varPrefix}_${envName}_SECRET"; assert checkEnv "NIXOPS_${varPrefix}_${envName}_PSQL_URL"; '' - Use Stats aten.pro - SetHandler "proxy:unix:${phpFpm.socket}|fcgi://localhost" @@ -60,6 +58,8 @@ let ErrorDocument 401 "" '' else '' + Use Stats aten.pro + Use LDAPConnect Require ldap-group cn=aten.pro,cn=httpd,ou=services,dc=immae,dc=eu diff --git a/virtual/packages/ludivinecassal.nix b/virtual/packages/ludivinecassal.nix index 03f68f7..c078722 100644 --- a/virtual/packages/ludivinecassal.nix +++ b/virtual/packages/ludivinecassal.nix @@ -71,8 +71,6 @@ let group = "wwwrun"; modules = [ "proxy_fcgi" ]; vhostConf = '' - Use Stats ludivinecassal.com - SetHandler "proxy:unix:${phpFpm.socket}|fcgi://localhost" @@ -125,6 +123,8 @@ let '' else '' + Use Stats ludivinecassal.com + Options Indexes FollowSymLinks MultiViews Includes AllowOverride All diff --git a/virtual/packages/piedsjaloux.json b/virtual/packages/piedsjaloux.json new file mode 100644 index 0000000..c4aae16 --- /dev/null +++ b/virtual/packages/piedsjaloux.json @@ -0,0 +1,14 @@ +{ + "tag": "c7a5593-master", + "meta": { + "name": "piedsjaloux", + "url": "gitolite@git.immae.eu:Pieds_jaloux/NewSite", + "branch": "master" + }, + "git": { + "url": "gitolite@git.immae.eu:Pieds_jaloux/NewSite", + "rev": "c7a5593c37040c6f1f57f8163bc13256aabf6b3e", + "sha256": "1zvyd90d6xns6ypnp1p3fgbcl30pqwdv335qagbbjak1cn8jaq4l", + "fetchSubmodules": true + } +} diff --git a/virtual/packages/piedsjaloux.nix b/virtual/packages/piedsjaloux.nix new file mode 100644 index 0000000..819bafb --- /dev/null +++ b/virtual/packages/piedsjaloux.nix @@ -0,0 +1,169 @@ +{ lib, checkEnv, writeText, fetchedGitPrivate, stdenv, php, git, cacert, phpPackages, texlive, imagemagick }: +let + piedsjaloux = { environment ? "dev" }: rec { + varPrefix = "PIEDSJALOUX"; + varDir = "/var/lib/piedsjaloux_${environment}"; + envName= lib.strings.toUpper environment; + configRoot = + assert checkEnv "NIXOPS_${varPrefix}_${envName}_MYSQL_PASSWORD"; + assert checkEnv "NIXOPS_${varPrefix}_${envName}_MYSQL_USER"; + assert checkEnv "NIXOPS_${varPrefix}_${envName}_MYSQL_NAME"; + assert checkEnv "NIXOPS_${varPrefix}_${envName}_SECRET"; + writeText "parameters.yml" '' + # This file is auto-generated during the composer install + parameters: + database_host: db-1.immae.eu + database_port: null + database_name: ${builtins.getEnv "NIXOPS_${varPrefix}_${envName}_MYSQL_NAME"} + database_user: ${builtins.getEnv "NIXOPS_${varPrefix}_${envName}_MYSQL_USER"} + database_password: ${builtins.getEnv "NIXOPS_${varPrefix}_${envName}_MYSQL_PASSWORD"} + mailer_transport: smtp + mailer_host: mail.immae.eu + mailer_user: null + mailer_password: null + secret: ${builtins.getEnv "NIXOPS_${varPrefix}_${envName}_SECRET"} + pdflatex: "${texlive.combine { inherit (texlive) attachfile preprint scheme-small; }}/bin/pdflatex" + leapt_im: + binary_path: ${imagemagick}/bin + ''; + phpFpm = rec { + socket = "/var/run/phpfpm/piedsjaloux-${environment}.sock"; + pool = '' + listen = ${socket} + user = ${apache.user} + group = ${apache.group} + listen.owner = ${apache.user} + listen.group = ${apache.group} + 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] = "${configRoot}:${webappDir}:${varDir}:/tmp" + ${if environment == "dev" then '' + pm = ondemand + pm.max_children = 5 + pm.process_idle_timeout = 60 + env[SYMFONY_DEBUG_MODE] = "yes" + '' else '' + pm = dynamic + pm.max_children = 20 + pm.start_servers = 2 + pm.min_spare_servers = 1 + pm.max_spare_servers = 3 + ''}''; + }; + apache = { + user = "wwwrun"; + group = "wwwrun"; + modules = [ "proxy_fcgi" ]; + vhostConf = '' + + SetHandler "proxy:unix:${phpFpm.socket}|fcgi://localhost" + + + ${if environment == "dev" then '' + + Use LDAPConnect + Require ldap-group cn=piedsjaloux.immae.eu,cn=httpd,ou=services,dc=immae,dc=eu + ErrorDocument 401 "" + + + + Options Indexes FollowSymLinks MultiViews Includes + AllowOverride None + Require all granted + + DirectoryIndex app_dev.php + + + Options -MultiViews + + + + RewriteEngine On + + RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$ + RewriteRule ^(.*) - [E=BASE:%1] + + # Maintenance script + RewriteCond %{DOCUMENT_ROOT}/maintenance.php -f + RewriteCond %{SCRIPT_FILENAME} !maintenance.php + RewriteRule ^.*$ %{ENV:BASE}/maintenance.php [R=503,L] + ErrorDocument 503 /maintenance.php + + # Sets the HTTP_AUTHORIZATION header removed by Apache + RewriteCond %{HTTP:Authorization} . + RewriteRule ^ - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] + + RewriteCond %{ENV:REDIRECT_STATUS} ^$ + RewriteRule ^app_dev\.php(?:/(.*)|$) %{ENV:BASE}/$1 [R=301,L] + + # If the requested filename exists, simply serve it. + # We only want to let Apache serve files and not directories. + RewriteCond %{REQUEST_FILENAME} -f + RewriteRule ^ - [L] + + # Rewrite all other queries to the front controller. + RewriteRule ^ %{ENV:BASE}/app_dev.php [L] + + + + '' else '' + Use Stats piedsjaloux.fr + + + Options Indexes FollowSymLinks MultiViews Includes + AllowOverride All + Require all granted + + ''} + ''; + }; + activationScript = { + deps = [ "wrappers" ]; + text = '' + install -m 0755 -o ${apache.user} -g ${apache.group} -d ${varDir} \ + ${varDir}/tmp + if [ ! -f "${varDir}/currentWebappDir" -o \ + "${webappDir}" != "$(cat ${varDir}/currentWebappDir 2>/dev/null)" ]; then + pushd ${webappDir} > /dev/null + $wrapperDir/sudo -u wwwrun ./bin/console --env=${environment} cache:clear --no-warmup + popd > /dev/null + echo -n "${webappDir}" > ${varDir}/currentWebappDir + fi + ''; + }; + webappDir = stdenv.mkDerivation (fetchedGitPrivate ./piedsjaloux.json // rec { + # FIXME: can we do better than symlink? + # FIXME: initial sync + # FIXME: backup + # FIXME: miniatures and data need to be in the same dir due to a + # bug in leapt.im (searches for data/../miniatures) + # FIXME: var/bootstrap.php.cache doesn't get created + # (cannot work with var as a symlink since the file + # references ..) + # FIXME: configuration change should not trigger a rebuild + buildPhase = '' + export GIT_SSL_CAINFO=${cacert}/etc/ssl/certs/ca-bundle.crt + export SSL_CERT_FILE=${cacert}/etc/ssl/certs/ca-bundle.crt + + ln -sf ${configRoot} app/config/parameters.yml + sed -i -e "/Incenteev..ParameterHandler..ScriptHandler::buildParameters/d" composer.json + ${if environment == "dev" then '' + composer install + '' else '' + SYMFONY_ENV=prod composer install --no-dev + ''} + rm -rf var + ln -sf ../../../../../${varDir} var + ''; + installPhase = '' + cp -a . $out + ''; + buildInputs = [ + php git cacert phpPackages.composer + ]; + }); + webRoot = "${webappDir}/web"; + }; +in + piedsjaloux diff --git a/virtual/packages/piedsjaloux_goaccess.conf b/virtual/packages/piedsjaloux_goaccess.conf new file mode 100644 index 0000000..3950f7e --- /dev/null +++ b/virtual/packages/piedsjaloux_goaccess.conf @@ -0,0 +1,99 @@ +time-format %H:%M:%S +date-format %d/%b/%Y + +#sur immae.eu +#log-format %v %h %^[%d:%t %^] "%r" %s %b "%R" "%u" $^ + +log-format VCOMBINED +#= %v:%^ %h %^[%d:%t %^] "%r" %s %b "%R" "%u" + +html-prefs {"theme":"bright","layout":"vertical"} + +exclude-ip 188.165.209.148 +exclude-ip 178.33.252.96 +exclude-ip 2001:41d0:2:9c94::1 +exclude-ip 2001:41d0:2:9c94:: +exclude-ip 176.9.151.89 +exclude-ip 2a01:4f8:160:3445:: +exclude-ip 82.255.56.72 + +no-query-string true + +keep-db-files true +load-from-disk true +db-path /var/lib/goaccess/piedsjaloux.fr + +ignore-panel REFERRERS +ignore-panel KEYPHRASES + +static-file .css +static-file .js +static-file .jpg +static-file .png +static-file .gif +static-file .ico +static-file .jpeg +static-file .pdf +static-file .csv +static-file .mpeg +static-file .mpg +static-file .swf +static-file .woff +static-file .woff2 +static-file .xls +static-file .xlsx +static-file .doc +static-file .docx +static-file .ppt +static-file .pptx +static-file .txt +static-file .zip +static-file .ogg +static-file .mp3 +static-file .mp4 +static-file .exe +static-file .iso +static-file .gz +static-file .rar +static-file .svg +static-file .bmp +static-file .tar +static-file .tgz +static-file .tiff +static-file .tif +static-file .ttf +static-file .flv +#static-file .less +#static-file .ac3 +#static-file .avi +#static-file .bz2 +#static-file .class +#static-file .cue +#static-file .dae +#static-file .dat +#static-file .dts +#static-file .ejs +#static-file .eot +#static-file .eps +#static-file .img +#static-file .jar +#static-file .map +#static-file .mid +#static-file .midi +#static-file .ogv +#static-file .webm +#static-file .mkv +#static-file .odp +#static-file .ods +#static-file .odt +#static-file .otf +#static-file .pict +#static-file .pls +#static-file .ps +#static-file .qt +#static-file .rm +#static-file .svgz +#static-file .wav +#static-file .webp + + -- cgit v1.2.3