aboutsummaryrefslogtreecommitdiff
path: root/modules/private/websites/isabelle/aten_production.nix
diff options
context:
space:
mode:
Diffstat (limited to 'modules/private/websites/isabelle/aten_production.nix')
-rw-r--r--modules/private/websites/isabelle/aten_production.nix25
1 files changed, 14 insertions, 11 deletions
diff --git a/modules/private/websites/isabelle/aten_production.nix b/modules/private/websites/isabelle/aten_production.nix
index cf7e4a2..e34d659 100644
--- a/modules/private/websites/isabelle/aten_production.nix
+++ b/modules/private/websites/isabelle/aten_production.nix
@@ -1,21 +1,24 @@
1{ lib, pkgs, config, ... }: 1{ lib, pkgs, config, ... }:
2let 2let
3 secrets = config.myEnv.websites.isabelle.aten_production; 3 secrets = config.myEnv.websites.isabelle.aten_production;
4 app = pkgs.webapps.aten.override { environment = secrets.environment; }; 4 app = pkgs.callPackage ./aten_app {
5 environment = secrets.environment;
6 varDir = "/var/lib/isabelle_aten_production";
7 };
5 cfg = config.myServices.websites.isabelle.aten_production; 8 cfg = config.myServices.websites.isabelle.aten_production;
6 pcfg = config.services.phpApplication; 9 pcfg = config.services.phpApplication;
7in { 10in {
8 options.myServices.websites.isabelle.aten_production.enable = lib.mkEnableOption "enable Aten's website in production"; 11 options.myServices.websites.isabelle.aten_production.enable = lib.mkEnableOption "enable Aten's website in production";
9 12
10 config = lib.mkIf cfg.enable { 13 config = lib.mkIf cfg.enable {
11 services.duplyBackup.profiles.aten_prod.rootDir = app.varDir; 14 services.duplyBackup.profiles.isabelle_aten_production.rootDir = app.varDir;
12 services.webstats.sites = [ { name = "aten.pro"; } ]; 15 services.webstats.sites = [ { name = "aten.pro"; } ];
13 services.phpApplication.apps.aten_prod = { 16 services.phpApplication.apps.isabelle_aten_production = {
14 websiteEnv = "production"; 17 websiteEnv = "production";
15 httpdUser = config.services.httpd.Prod.user; 18 httpdUser = config.services.httpd.Prod.user;
16 httpdGroup = config.services.httpd.Prod.group; 19 httpdGroup = config.services.httpd.Prod.group;
17 httpdWatchFiles = [ 20 httpdWatchFiles = [
18 config.secrets.fullPaths."webapps/${app.environment}-aten" 21 config.secrets.fullPaths."websites/isabelle/aten_production"
19 ]; 22 ];
20 inherit (app) webRoot varDir; 23 inherit (app) webRoot varDir;
21 inherit app; 24 inherit app;
@@ -37,7 +40,7 @@ in {
37 }; 40 };
38 41
39 secrets.keys = [{ 42 secrets.keys = [{
40 dest = "webapps/${app.environment}-aten"; 43 dest = "websites/isabelle/aten_production";
41 user = config.services.httpd.Prod.user; 44 user = config.services.httpd.Prod.user;
42 group = config.services.httpd.Prod.group; 45 group = config.services.httpd.Prod.group;
43 permissions = "0400"; 46 permissions = "0400";
@@ -52,18 +55,18 @@ in {
52 SetEnv DATABASE_URL "${psql_url}" 55 SetEnv DATABASE_URL "${psql_url}"
53 ''; 56 '';
54 }]; 57 }];
55 services.websites.env.production.vhostConfs.aten_prod = { 58 services.websites.env.production.vhostConfs.isabelle_aten_production = {
56 certName = "aten"; 59 certName = "isabelle";
57 certMainHost = "aten.pro"; 60 certMainHost = "aten.pro";
58 hosts = [ "aten.pro" "www.aten.pro" ]; 61 hosts = [ "aten.pro" "www.aten.pro" ];
59 root = pcfg.webappDirs.aten_prod; 62 root = pcfg.webappDirs.isabelle_aten_production;
60 extraConfig = [ 63 extraConfig = [
61 '' 64 ''
62 <FilesMatch "\.php$"> 65 <FilesMatch "\.php$">
63 SetHandler "proxy:unix:${pcfg.phpListenPaths.aten_prod}|fcgi://localhost" 66 SetHandler "proxy:unix:${pcfg.phpListenPaths.isabelle_aten_production}|fcgi://localhost"
64 </FilesMatch> 67 </FilesMatch>
65 68
66 Include ${config.secrets.fullPaths."webapps/${app.environment}-aten"} 69 Include ${config.secrets.fullPaths."websites/isabelle/aten_production"}
67 70
68 Use Stats aten.pro 71 Use Stats aten.pro
69 72
@@ -73,7 +76,7 @@ in {
73 ErrorDocument 401 "<html><meta http-equiv=\"refresh\" content=\"0;url=https://aten.pro\"></html>" 76 ErrorDocument 401 "<html><meta http-equiv=\"refresh\" content=\"0;url=https://aten.pro\"></html>"
74 </Location> 77 </Location>
75 78
76 <Directory ${pcfg.webappDirs.aten_prod}> 79 <Directory ${pcfg.webappDirs.isabelle_aten_production}>
77 Options Indexes FollowSymLinks MultiViews Includes 80 Options Indexes FollowSymLinks MultiViews Includes
78 AllowOverride All 81 AllowOverride All
79 Require all granted 82 Require all granted