diff options
Diffstat (limited to 'modules/private/websites/piedsjaloux/production.nix')
-rw-r--r-- | modules/private/websites/piedsjaloux/production.nix | 106 |
1 files changed, 0 insertions, 106 deletions
diff --git a/modules/private/websites/piedsjaloux/production.nix b/modules/private/websites/piedsjaloux/production.nix deleted file mode 100644 index 422c7f0..0000000 --- a/modules/private/websites/piedsjaloux/production.nix +++ /dev/null | |||
@@ -1,106 +0,0 @@ | |||
1 | { lib, pkgs, config, ... }: | ||
2 | let | ||
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"; | ||
9 | }; | ||
10 | cfg = config.myServices.websites.piedsjaloux.production; | ||
11 | pcfg = config.services.phpApplication; | ||
12 | texlive = pkgs.texlive.combine { inherit (pkgs.texlive) attachfile preprint scheme-small; }; | ||
13 | in { | ||
14 | options.myServices.websites.piedsjaloux.production.enable = lib.mkEnableOption "enable PiedsJaloux's website in production"; | ||
15 | |||
16 | config = lib.mkIf cfg.enable { | ||
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; | ||
23 | varDirPaths = { | ||
24 | "tmp" = "0700"; | ||
25 | }; | ||
26 | inherit app; | ||
27 | serviceDeps = [ "mysql.service" ]; | ||
28 | preStartActions = [ | ||
29 | "./bin/console --env=${app.environment} cache:clear --no-warmup" | ||
30 | ]; | ||
31 | phpOpenbasedir = [ "/tmp" ]; | ||
32 | phpPool = { | ||
33 | "php_admin_value[upload_max_filesize]" = "20M"; | ||
34 | "php_admin_value[post_max_size]" = "20M"; | ||
35 | #"php_admin_flag[log_errors]" = "on"; | ||
36 | "pm" = "dynamic"; | ||
37 | "pm.max_children" = "20"; | ||
38 | "pm.start_servers" = "2"; | ||
39 | "pm.min_spare_servers" = "1"; | ||
40 | "pm.max_spare_servers" = "3"; | ||
41 | }; | ||
42 | phpEnv = { | ||
43 | PATH = lib.makeBinPath [ | ||
44 | pkgs.apg pkgs.unzip | ||
45 | # below ones don't need to be in the PATH but they’re used in | ||
46 | # secrets | ||
47 | pkgs.imagemagick texlive | ||
48 | ]; | ||
49 | }; | ||
50 | phpWatchFiles = [ | ||
51 | app.secretsPath | ||
52 | ]; | ||
53 | phpPackage = pkgs.php72; | ||
54 | }; | ||
55 | |||
56 | secrets.keys."websites/piedsjaloux/production" = { | ||
57 | user = config.services.httpd.Prod.user; | ||
58 | group = config.services.httpd.Prod.group; | ||
59 | permissions = "0400"; | ||
60 | text = '' | ||
61 | # This file is auto-generated during the composer install | ||
62 | parameters: | ||
63 | database_host: ${secrets.mysql.host} | ||
64 | database_port: ${secrets.mysql.port} | ||
65 | database_name: ${secrets.mysql.database} | ||
66 | database_user: ${secrets.mysql.user} | ||
67 | database_password: ${secrets.mysql.password} | ||
68 | database_server_version: ${pkgs.mariadb.mysqlVersion} | ||
69 | mailer_transport: smtp | ||
70 | mailer_host: 127.0.0.1 | ||
71 | mailer_user: null | ||
72 | mailer_password: null | ||
73 | secret: ${secrets.secret} | ||
74 | pdflatex: "${texlive}/bin/pdflatex" | ||
75 | leapt_im: | ||
76 | binary_path: ${pkgs.imagemagick}/bin | ||
77 | ''; | ||
78 | }; | ||
79 | |||
80 | services.websites.env.production.vhostConfs.piedsjaloux_production = { | ||
81 | certName = "piedsjaloux"; | ||
82 | certMainHost = "piedsjaloux.fr"; | ||
83 | hosts = [ "piedsjaloux.fr" "www.piedsjaloux.fr" ]; | ||
84 | root = app.webRoot; | ||
85 | extraConfig = [ | ||
86 | '' | ||
87 | RewriteEngine on | ||
88 | RewriteCond "%{HTTP_HOST}" "!^www.piedsjaloux\.fr$" [NC] | ||
89 | RewriteRule ^(.+)$ https://www.piedsjaloux.fr$1 [R=302,L] | ||
90 | |||
91 | <FilesMatch "\.php$"> | ||
92 | SetHandler "proxy:unix:${pcfg.phpListenPaths.piedsjaloux_production}|fcgi://localhost" | ||
93 | </FilesMatch> | ||
94 | |||
95 | Use Stats piedsjaloux.fr | ||
96 | |||
97 | <Directory ${app.webRoot}> | ||
98 | Options Indexes FollowSymLinks MultiViews Includes | ||
99 | AllowOverride All | ||
100 | Require all granted | ||
101 | </Directory> | ||
102 | '' | ||
103 | ]; | ||
104 | }; | ||
105 | }; | ||
106 | } | ||