]>
Commit | Line | Data |
---|---|---|
f8026b6e IB |
1 | { lib, pkgs, config, myconfig, ... }: |
2 | let | |
8164ed90 IB |
3 | secrets = myconfig.env.websites.ludivinecassal.production; |
4 | app = pkgs.webapps.ludivinecassal.override { environment = secrets.environment; }; | |
5 | pcfg = config.services.phpApplication; | |
f8026b6e IB |
6 | cfg = config.myServices.websites.ludivinecassal.production; |
7 | in { | |
8 | options.myServices.websites.ludivinecassal.production.enable = lib.mkEnableOption "enable Ludivine's website in production"; | |
9 | ||
10 | config = lib.mkIf cfg.enable { | |
f8026b6e | 11 | services.webstats.sites = [ { name = "ludivinecassal.com"; } ]; |
8164ed90 IB |
12 | services.phpApplication.apps.ludivinecassal_prod = { |
13 | websiteEnv = "production"; | |
14 | httpdUser = config.services.httpd.Prod.user; | |
15 | httpdGroup = config.services.httpd.Prod.group; | |
16 | inherit (app) webRoot varDir; | |
17 | varDirPaths = { | |
18 | "tmp" = "0700"; | |
19 | }; | |
20 | inherit app; | |
21 | serviceDeps = [ "mysql.service" ]; | |
22 | preStartActions = [ | |
23 | "./bin/console --env=${app.environment} cache:clear --no-warmup" | |
24 | ]; | |
25 | phpOpenbasedir = [ "/tmp" ]; | |
26 | phpPool = '' | |
27 | php_admin_value[upload_max_filesize] = 20M | |
28 | php_admin_value[post_max_size] = 20M | |
29 | ;php_admin_flag[log_errors] = on | |
30 | pm = dynamic | |
31 | pm.max_children = 20 | |
32 | pm.start_servers = 2 | |
33 | pm.min_spare_servers = 1 | |
34 | pm.max_spare_servers = 3 | |
35 | ''; | |
36 | phpWatchFiles = [ | |
37 | config.secrets.fullPaths."webapps/${app.environment}-ludivinecassal" | |
38 | ]; | |
39 | }; | |
40 | ||
41 | secrets.keys = [ | |
42 | { | |
43 | dest = "webapps/${app.environment}-ludivinecassal"; | |
44 | user = config.services.httpd.Prod.user; | |
45 | group = config.services.httpd.Prod.group; | |
46 | permissions = "0400"; | |
47 | text = '' | |
48 | # This file is auto-generated during the composer install | |
49 | parameters: | |
50 | database_host: ${secrets.mysql.host} | |
51 | database_port: ${secrets.mysql.port} | |
52 | database_name: ${secrets.mysql.name} | |
53 | database_user: ${secrets.mysql.user} | |
54 | database_password: ${secrets.mysql.password} | |
55 | database_server_version: ${pkgs.mariadb.mysqlVersion} | |
56 | mailer_transport: smtp | |
57 | mailer_host: 127.0.0.1 | |
58 | mailer_user: null | |
59 | mailer_password: null | |
60 | secret: ${secrets.secret} | |
61 | ldap_host: ldap.immae.eu | |
62 | ldap_port: 636 | |
63 | ldap_version: 3 | |
64 | ldap_ssl: true | |
65 | ldap_tls: false | |
66 | ldap_user_bind: 'uid={username},ou=users,dc=immae,dc=eu' | |
67 | ldap_base_dn: 'dc=immae,dc=eu' | |
68 | ldap_search_dn: '${secrets.ldap.dn}' | |
69 | ldap_search_password: '${secrets.ldap.password}' | |
70 | ldap_search_filter: '${secrets.ldap.search}' | |
71 | leapt_im: | |
72 | binary_path: ${pkgs.imagemagick}/bin | |
73 | assetic: | |
74 | sass: ${pkgs.sass}/bin/sass | |
75 | ruby: ${pkgs.ruby}/bin/ruby | |
76 | ''; | |
77 | } | |
78 | ]; | |
f8026b6e | 79 | |
8164ed90 | 80 | services.websites.env.production.vhostConfs.ludivinecassal_prod = { |
f8026b6e IB |
81 | certName = "ludivinecassal"; |
82 | certMainHost = "ludivinecassal.com"; | |
83 | hosts = ["ludivinecassal.com" "www.ludivinecassal.com" ]; | |
8164ed90 IB |
84 | root = pcfg.webappDirs.ludivinecassal_prod; |
85 | extraConfig = [ | |
86 | '' | |
87 | <FilesMatch "\.php$"> | |
88 | SetHandler "proxy:unix:${pcfg.phpListenPaths.ludivinecassal_prod}|fcgi://localhost" | |
89 | </FilesMatch> | |
90 | ||
91 | Use Stats ludivinecassal.com | |
92 | ||
93 | <Directory ${pcfg.webappDirs.ludivinecassal_prod}> | |
94 | Options Indexes FollowSymLinks MultiViews Includes | |
95 | AllowOverride All | |
96 | Require all granted | |
97 | </Directory> | |
98 | '' | |
99 | ]; | |
17f6eae9 | 100 | }; |
f8026b6e IB |
101 | }; |
102 | } |