diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2020-04-18 16:10:56 +0200 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2020-04-20 01:51:48 +0200 |
commit | d3452fc59b9839846225fd254926c64a9c71f071 (patch) | |
tree | a98a0958b826ac4b2ab137720edf0195c65dd958 /modules/private/websites/piedsjaloux/integration.nix | |
parent | 514f9ec3beec470c4445be690673a0ceab9115b4 (diff) | |
download | Nix-d3452fc59b9839846225fd254926c64a9c71f071.tar.gz Nix-d3452fc59b9839846225fd254926c64a9c71f071.tar.zst Nix-d3452fc59b9839846225fd254926c64a9c71f071.zip |
Refactor websites
Diffstat (limited to 'modules/private/websites/piedsjaloux/integration.nix')
-rw-r--r-- | modules/private/websites/piedsjaloux/integration.nix | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/modules/private/websites/piedsjaloux/integration.nix b/modules/private/websites/piedsjaloux/integration.nix index 76523ed..d8790cc 100644 --- a/modules/private/websites/piedsjaloux/integration.nix +++ b/modules/private/websites/piedsjaloux/integration.nix | |||
@@ -1,15 +1,20 @@ | |||
1 | { lib, pkgs, config, ... }: | 1 | { lib, pkgs, config, ... }: |
2 | let | 2 | let |
3 | secrets = config.myEnv.websites.piedsjaloux.integration; | 3 | secrets = config.myEnv.websites.piedsjaloux.integration; |
4 | app = pkgs.webapps.piedsjaloux.override { environment = secrets.environment; }; | 4 | app = pkgs.callPackage ./app { |
5 | environment = secrets.environment; | ||
6 | varDir = "/var/lib/piedsjaloux_integration"; | ||
7 | secretsPath = config.secrets.fullPaths."websites/piedsjaloux/integration"; | ||
8 | }; | ||
5 | cfg = config.myServices.websites.piedsjaloux.integration; | 9 | cfg = config.myServices.websites.piedsjaloux.integration; |
6 | pcfg = config.services.phpApplication; | 10 | pcfg = config.services.phpApplication; |
11 | texlive = pkgs.texlive.combine { inherit (pkgs.texlive) attachfile preprint scheme-small; }; | ||
7 | in { | 12 | in { |
8 | options.myServices.websites.piedsjaloux.integration.enable = lib.mkEnableOption "enable PiedsJaloux's website in integration"; | 13 | options.myServices.websites.piedsjaloux.integration.enable = lib.mkEnableOption "enable PiedsJaloux's website in integration"; |
9 | 14 | ||
10 | config = lib.mkIf cfg.enable { | 15 | config = lib.mkIf cfg.enable { |
11 | services.duplyBackup.profiles.piedsjaloux_dev.rootDir = app.varDir; | 16 | services.duplyBackup.profiles.piedsjaloux_integration.rootDir = app.varDir; |
12 | services.phpApplication.apps.piedsjaloux_dev = { | 17 | services.phpApplication.apps.piedsjaloux_integration = { |
13 | websiteEnv = "integration"; | 18 | websiteEnv = "integration"; |
14 | httpdUser = config.services.httpd.Inte.user; | 19 | httpdUser = config.services.httpd.Inte.user; |
15 | httpdGroup = config.services.httpd.Inte.group; | 20 | httpdGroup = config.services.httpd.Inte.group; |
@@ -32,17 +37,22 @@ in { | |||
32 | "pm.process_idle_timeout" = "60"; | 37 | "pm.process_idle_timeout" = "60"; |
33 | }; | 38 | }; |
34 | phpEnv = { | 39 | phpEnv = { |
35 | PATH = lib.makeBinPath [ pkgs.apg pkgs.unzip ]; | 40 | PATH = lib.makeBinPath [ |
36 | SYMFONY_DEBUG_MODE = "yes"; | 41 | pkgs.apg pkgs.unzip |
42 | # below ones don't need to be in the PATH but they’re used in | ||
43 | # secrets | ||
44 | pkgs.imagemagick texlive | ||
45 | ]; | ||
46 | SYMFONY_DEBUG_MODE = "\"yes\""; | ||
37 | }; | 47 | }; |
38 | phpWatchFiles = [ | 48 | phpWatchFiles = [ |
39 | config.secrets.fullPaths."webapps/${app.environment}-piedsjaloux" | 49 | app.secretsPath |
40 | ]; | 50 | ]; |
41 | }; | 51 | }; |
42 | 52 | ||
43 | secrets.keys = [ | 53 | secrets.keys = [ |
44 | { | 54 | { |
45 | dest = "webapps/${app.environment}-piedsjaloux"; | 55 | dest = "websites/piedsjaloux/integration"; |
46 | user = config.services.httpd.Inte.user; | 56 | user = config.services.httpd.Inte.user; |
47 | group = config.services.httpd.Inte.group; | 57 | group = config.services.httpd.Inte.group; |
48 | permissions = "0400"; | 58 | permissions = "0400"; |
@@ -60,22 +70,22 @@ in { | |||
60 | mailer_user: null | 70 | mailer_user: null |
61 | mailer_password: null | 71 | mailer_password: null |
62 | secret: ${secrets.secret} | 72 | secret: ${secrets.secret} |
63 | pdflatex: "${pkgs.texlive.combine { inherit (pkgs.texlive) attachfile preprint scheme-small; }}/bin/pdflatex" | 73 | pdflatex: "${texlive}/bin/pdflatex" |
64 | leapt_im: | 74 | leapt_im: |
65 | binary_path: ${pkgs.imagemagick}/bin | 75 | binary_path: ${pkgs.imagemagick}/bin |
66 | ''; | 76 | ''; |
67 | } | 77 | } |
68 | ]; | 78 | ]; |
69 | 79 | ||
70 | services.websites.env.integration.vhostConfs.piedsjaloux_dev = { | 80 | services.websites.env.integration.vhostConfs.piedsjaloux_integration = { |
71 | certName = "integration"; | 81 | certName = "integration"; |
72 | addToCerts = true; | 82 | addToCerts = true; |
73 | hosts = [ "piedsjaloux.immae.eu" ]; | 83 | hosts = [ "piedsjaloux.immae.eu" ]; |
74 | root = pcfg.webappDirs.piedsjaloux_dev; | 84 | root = pcfg.webappDirs.piedsjaloux_integration; |
75 | extraConfig = [ | 85 | extraConfig = [ |
76 | '' | 86 | '' |
77 | <FilesMatch "\.php$"> | 87 | <FilesMatch "\.php$"> |
78 | SetHandler "proxy:unix:${pcfg.phpListenPaths.piedsjaloux_dev}|fcgi://localhost" | 88 | SetHandler "proxy:unix:${pcfg.phpListenPaths.piedsjaloux_integration}|fcgi://localhost" |
79 | </FilesMatch> | 89 | </FilesMatch> |
80 | 90 | ||
81 | <Location /> | 91 | <Location /> |
@@ -84,7 +94,7 @@ in { | |||
84 | ErrorDocument 401 "<html><meta http-equiv=\"refresh\" content=\"0;url=https://piedsjaloux.fr\"></html>" | 94 | ErrorDocument 401 "<html><meta http-equiv=\"refresh\" content=\"0;url=https://piedsjaloux.fr\"></html>" |
85 | </Location> | 95 | </Location> |
86 | 96 | ||
87 | <Directory ${pcfg.webappDirs.piedsjaloux_dev}> | 97 | <Directory ${pcfg.webappDirs.piedsjaloux_integration}> |
88 | Options Indexes FollowSymLinks MultiViews Includes | 98 | Options Indexes FollowSymLinks MultiViews Includes |
89 | AllowOverride None | 99 | AllowOverride None |
90 | Require all granted | 100 | Require all granted |