1 { lib, pkgs, config, ... }:
3 secrets = config.myEnv.websites.isabelle.aten_production;
4 app = pkgs.callPackage ./aten_app {
5 composerEnv = pkgs.composerEnv.override { php = pkgs.php72; };
6 environment = secrets.environment;
7 varDir = "/var/lib/isabelle_aten_production";
9 cfg = config.myServices.websites.isabelle.aten_production;
10 pcfg = config.services.phpApplication;
12 options.myServices.websites.isabelle.aten_production.enable = lib.mkEnableOption "enable Aten's website in production";
14 config = lib.mkIf cfg.enable {
15 services.duplyBackup.profiles.isabelle_aten_production.rootDir = app.varDir;
16 services.duplyBackup.profiles.isabelle_aten_production.remotes = ["eriomem" "ovh"];
17 services.webstats.sites = [ { name = "aten.pro"; } ];
18 services.phpApplication.apps.isabelle_aten_production = {
19 websiteEnv = "production";
20 httpdUser = config.services.httpd.Prod.user;
21 httpdGroup = config.services.httpd.Prod.group;
23 config.secrets.fullPaths."websites/isabelle/aten_production"
25 inherit (app) webRoot varDir;
27 serviceDeps = [ "postgresql.service" ];
29 "APP_ENV=${app.environment} ./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";
42 phpPackage = pkgs.php72;
46 dest = "websites/isabelle/aten_production";
47 user = config.services.httpd.Prod.user;
48 group = config.services.httpd.Prod.group;
52 # https://secure.php.net/manual/fr/function.parse-url.php
53 # vendor/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php#parseDatabaseUrlQuery
54 psql_url = with secrets.postgresql; "pdo-pgsql://${user}:${password}@invalid:${port}/${database}?host=${socket}";
56 SetEnv APP_ENV "${app.environment}"
57 SetEnv APP_SECRET "${secrets.secret}"
58 SetEnv DATABASE_URL "${psql_url}"
61 services.websites.env.production.vhostConfs.isabelle_aten_production = {
62 certName = "isabelle";
63 certMainHost = "aten.pro";
64 hosts = [ "aten.pro" "www.aten.pro" ];
65 root = pcfg.webappDirs.isabelle_aten_production;
69 SetHandler "proxy:unix:${pcfg.phpListenPaths.isabelle_aten_production}|fcgi://localhost"
72 Include ${config.secrets.fullPaths."websites/isabelle/aten_production"}
78 Require ldap-group cn=aten.pro,cn=httpd,ou=services,dc=immae,dc=eu
79 ErrorDocument 401 "<html><meta http-equiv=\"refresh\" content=\"0;url=https://aten.pro\"></html>"
82 <Directory ${pcfg.webappDirs.isabelle_aten_production}>
83 Options Indexes FollowSymLinks MultiViews Includes
86 DirectoryIndex index.php
87 FallbackResource /index.php