1 { lib, pkgs, config, ... }:
3 secrets = config.myEnv.websites.piedsjaloux.production;
4 app = pkgs.callPackage ./app {
5 composerEnv = pkgs.composerEnv.override { php = pkgs.php72; };
6 environment = secrets.environment;
7 varDir = "/var/lib/piedsjaloux_production";
8 secretsPath = config.secrets.fullPaths."websites/piedsjaloux/production";
10 cfg = config.myServices.websites.piedsjaloux.production;
11 pcfg = config.services.phpApplication;
12 texlive = pkgs.texlive.combine { inherit (pkgs.texlive) attachfile preprint scheme-small; };
14 options.myServices.websites.piedsjaloux.production.enable = lib.mkEnableOption "enable PiedsJaloux's website in production";
16 config = lib.mkIf cfg.enable {
17 services.duplyBackup.profiles.piedsjaloux_production.rootDir = app.varDir;
18 services.webstats.sites = [ { name = "piedsjaloux.fr"; } ];
19 services.phpApplication.apps.piedsjaloux_production = {
20 websiteEnv = "production";
21 httpdUser = config.services.httpd.Prod.user;
22 httpdGroup = config.services.httpd.Prod.group;
23 inherit (app) webRoot varDir;
28 serviceDeps = [ "mysql.service" ];
30 "./bin/console --env=${app.environment} cache:clear --no-warmup"
32 phpOpenbasedir = [ "/tmp" ];
34 "php_admin_value[upload_max_filesize]" = "20M";
35 "php_admin_value[post_max_size]" = "20M";
36 #"php_admin_flag[log_errors]" = "on";
38 "pm.max_children" = "20";
39 "pm.start_servers" = "2";
40 "pm.min_spare_servers" = "1";
41 "pm.max_spare_servers" = "3";
44 PATH = lib.makeBinPath [
46 # below ones don't need to be in the PATH but they’re used in
48 pkgs.imagemagick texlive
54 phpPackage = pkgs.php72;
59 dest = "websites/piedsjaloux/production";
60 user = config.services.httpd.Prod.user;
61 group = config.services.httpd.Prod.group;
64 # This file is auto-generated during the composer install
66 database_host: ${secrets.mysql.host}
67 database_port: ${secrets.mysql.port}
68 database_name: ${secrets.mysql.database}
69 database_user: ${secrets.mysql.user}
70 database_password: ${secrets.mysql.password}
71 database_server_version: ${pkgs.mariadb.mysqlVersion}
72 mailer_transport: smtp
73 mailer_host: 127.0.0.1
76 secret: ${secrets.secret}
77 pdflatex: "${texlive}/bin/pdflatex"
79 binary_path: ${pkgs.imagemagick}/bin
84 services.websites.env.production.vhostConfs.piedsjaloux_production = {
85 certName = "piedsjaloux";
86 certMainHost = "piedsjaloux.fr";
87 hosts = [ "piedsjaloux.fr" "www.piedsjaloux.fr" ];
88 root = pcfg.webappDirs.piedsjaloux_production;
92 RewriteCond "%{HTTP_HOST}" "!^www.piedsjaloux\.fr$" [NC]
93 RewriteRule ^(.+)$ https://www.piedsjaloux.fr$1 [R=302,L]
96 SetHandler "proxy:unix:${pcfg.phpListenPaths.piedsjaloux_production}|fcgi://localhost"
99 Use Stats piedsjaloux.fr
101 <Directory ${pcfg.webappDirs.piedsjaloux_production}>
102 Options Indexes FollowSymLinks MultiViews Includes