1 { lib, pkgs, config, ... }:
3 secrets = config.myEnv.websites.piedsjaloux.production;
4 app = pkgs.callPackage ./app {
5 environment = secrets.environment;
6 varDir = "/var/lib/piedsjaloux_production";
7 secretsPath = config.secrets.fullPaths."websites/piedsjaloux/production";
9 cfg = config.myServices.websites.piedsjaloux.production;
10 pcfg = config.services.phpApplication;
11 texlive = pkgs.texlive.combine { inherit (pkgs.texlive) attachfile preprint scheme-small; };
13 options.myServices.websites.piedsjaloux.production.enable = lib.mkEnableOption "enable PiedsJaloux's website in production";
15 config = lib.mkIf cfg.enable {
16 services.duplyBackup.profiles.piedsjaloux_production.rootDir = app.varDir;
17 services.webstats.sites = [ { name = "piedsjaloux.fr"; } ];
18 services.phpApplication.apps.piedsjaloux_production = {
19 websiteEnv = "production";
20 httpdUser = config.services.httpd.Prod.user;
21 httpdGroup = config.services.httpd.Prod.group;
22 inherit (app) webRoot varDir;
27 serviceDeps = [ "mysql.service" ];
29 "./bin/console --env=${app.environment} cache:clear --no-warmup"
31 phpOpenbasedir = [ "/tmp" ];
33 "php_admin_value[upload_max_filesize]" = "20M";
34 "php_admin_value[post_max_size]" = "20M";
35 #"php_admin_flag[log_errors]" = "on";
37 "pm.max_children" = "20";
38 "pm.start_servers" = "2";
39 "pm.min_spare_servers" = "1";
40 "pm.max_spare_servers" = "3";
43 PATH = lib.makeBinPath [
45 # below ones don't need to be in the PATH but they’re used in
47 pkgs.imagemagick texlive
57 dest = "websites/piedsjaloux/production";
58 user = config.services.httpd.Prod.user;
59 group = config.services.httpd.Prod.group;
62 # This file is auto-generated during the composer install
64 database_host: ${secrets.mysql.host}
65 database_port: ${secrets.mysql.port}
66 database_name: ${secrets.mysql.database}
67 database_user: ${secrets.mysql.user}
68 database_password: ${secrets.mysql.password}
69 database_server_version: ${pkgs.mariadb.mysqlVersion}
70 mailer_transport: smtp
71 mailer_host: 127.0.0.1
74 secret: ${secrets.secret}
75 pdflatex: "${texlive}/bin/pdflatex"
77 binary_path: ${pkgs.imagemagick}/bin
82 services.websites.env.production.vhostConfs.piedsjaloux_production = {
83 certName = "piedsjaloux";
84 certMainHost = "piedsjaloux.fr";
85 hosts = [ "piedsjaloux.fr" "www.piedsjaloux.fr" ];
86 root = pcfg.webappDirs.piedsjaloux_production;
90 RewriteCond "%{HTTP_HOST}" "!^www.piedsjaloux\.fr$" [NC]
91 RewriteRule ^(.+)$ https://www.piedsjaloux.fr$1 [R=302,L]
94 SetHandler "proxy:unix:${pcfg.phpListenPaths.piedsjaloux_production}|fcgi://localhost"
97 Use Stats piedsjaloux.fr
99 <Directory ${pcfg.webappDirs.piedsjaloux_production}>
100 Options Indexes FollowSymLinks MultiViews Includes