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.duplyBackup.profiles.piedsjaloux_production.remotes = ["eriomem" "ovh"];
19 services.webstats.sites = [ { name = "piedsjaloux.fr"; } ];
20 services.phpApplication.apps.piedsjaloux_production = {
21 websiteEnv = "production";
22 httpdUser = config.services.httpd.Prod.user;
23 httpdGroup = config.services.httpd.Prod.group;
24 inherit (app) webRoot varDir;
29 serviceDeps = [ "mysql.service" ];
31 "./bin/console --env=${app.environment} cache:clear --no-warmup"
33 phpOpenbasedir = [ "/tmp" ];
35 "php_admin_value[upload_max_filesize]" = "20M";
36 "php_admin_value[post_max_size]" = "20M";
37 #"php_admin_flag[log_errors]" = "on";
39 "pm.max_children" = "20";
40 "pm.start_servers" = "2";
41 "pm.min_spare_servers" = "1";
42 "pm.max_spare_servers" = "3";
45 PATH = lib.makeBinPath [
47 # below ones don't need to be in the PATH but they’re used in
49 pkgs.imagemagick texlive
55 phpPackage = pkgs.php72;
60 dest = "websites/piedsjaloux/production";
61 user = config.services.httpd.Prod.user;
62 group = config.services.httpd.Prod.group;
65 # This file is auto-generated during the composer install
67 database_host: ${secrets.mysql.host}
68 database_port: ${secrets.mysql.port}
69 database_name: ${secrets.mysql.database}
70 database_user: ${secrets.mysql.user}
71 database_password: ${secrets.mysql.password}
72 database_server_version: ${pkgs.mariadb.mysqlVersion}
73 mailer_transport: smtp
74 mailer_host: 127.0.0.1
77 secret: ${secrets.secret}
78 pdflatex: "${texlive}/bin/pdflatex"
80 binary_path: ${pkgs.imagemagick}/bin
85 services.websites.env.production.vhostConfs.piedsjaloux_production = {
86 certName = "piedsjaloux";
87 certMainHost = "piedsjaloux.fr";
88 hosts = [ "piedsjaloux.fr" "www.piedsjaloux.fr" ];
89 root = pcfg.webappDirs.piedsjaloux_production;
93 RewriteCond "%{HTTP_HOST}" "!^www.piedsjaloux\.fr$" [NC]
94 RewriteRule ^(.+)$ https://www.piedsjaloux.fr$1 [R=302,L]
97 SetHandler "proxy:unix:${pcfg.phpListenPaths.piedsjaloux_production}|fcgi://localhost"
100 Use Stats piedsjaloux.fr
102 <Directory ${pcfg.webappDirs.piedsjaloux_production}>
103 Options Indexes FollowSymLinks MultiViews Includes