]>
Commit | Line | Data |
---|---|---|
1 | { lib, pkgs, config, ... }: | |
2 | let | |
3 | secrets = config.myEnv.websites.connexionswing.production; | |
4 | app = pkgs.callPackage ./app { | |
5 | composerEnv = pkgs.composerEnv.override { php = pkgs.php72; }; | |
6 | environment = secrets.environment; | |
7 | varDir = "/var/lib/connexionswing_production"; | |
8 | secretsPath = config.secrets.fullPaths."websites/connexionswing/production"; | |
9 | }; | |
10 | cfg = config.myServices.websites.connexionswing.production; | |
11 | pcfg = config.services.phpApplication; | |
12 | in { | |
13 | options.myServices.websites.connexionswing.production.enable = lib.mkEnableOption "enable Connexionswing's website in production"; | |
14 | ||
15 | config = lib.mkIf cfg.enable { | |
16 | services.webstats.sites = [ { name = "connexionswing.com"; } ]; | |
17 | services.phpApplication.apps.connexionswing_production = { | |
18 | websiteEnv = "production"; | |
19 | httpdUser = config.services.httpd.Prod.user; | |
20 | httpdGroup = config.services.httpd.Prod.group; | |
21 | inherit (app) webRoot varDir; | |
22 | varDirPaths = { | |
23 | "medias" = "0700"; | |
24 | "uploads" = "0700"; | |
25 | "var" = "0700"; | |
26 | }; | |
27 | inherit app; | |
28 | serviceDeps = [ "mysql.service" ]; | |
29 | preStartActions = [ | |
30 | "./bin/console --env=${app.environment} cache:clear --no-warmup" | |
31 | ]; | |
32 | phpOpenbasedir = [ "/tmp" "/run/wrappers/bin/sendmail" ]; | |
33 | phpPool = { | |
34 | "php_admin_value[upload_max_filesize]" = "20M"; | |
35 | "php_admin_value[post_max_size]" = "20M"; | |
36 | #"php_admin_flag[log_errors]" = "on"; | |
37 | "pm" = "dynamic"; | |
38 | "pm.max_children" = "20"; | |
39 | "pm.start_servers" = "2"; | |
40 | "pm.min_spare_servers" = "1"; | |
41 | "pm.max_spare_servers" = "3"; | |
42 | }; | |
43 | phpWatchFiles = [ | |
44 | config.secrets.fullPaths."websites/connexionswing/production" | |
45 | ]; | |
46 | phpPackage = pkgs.php72; | |
47 | }; | |
48 | ||
49 | secrets.keys."websites/connexionswing/production" = { | |
50 | user = config.services.httpd.Prod.user; | |
51 | group = config.services.httpd.Prod.group; | |
52 | permissions = "0400"; | |
53 | text = '' | |
54 | # This file is auto-generated during the composer install | |
55 | parameters: | |
56 | database_host: ${secrets.mysql.host} | |
57 | database_port: ${secrets.mysql.port} | |
58 | database_name: ${secrets.mysql.database} | |
59 | database_user: ${secrets.mysql.user} | |
60 | database_password: ${secrets.mysql.password} | |
61 | database_server_version: ${pkgs.mariadb.mysqlVersion} | |
62 | mailer_transport: sendmail | |
63 | mailer_host: null | |
64 | mailer_user: null | |
65 | mailer_password: null | |
66 | subscription_email: ${secrets.email} | |
67 | allow_robots: true | |
68 | secret: ${secrets.secret} | |
69 | services: | |
70 | swiftmailer.mailer.default.transport: | |
71 | class: Swift_SendmailTransport | |
72 | arguments: ['/run/wrappers/bin/sendmail -bs'] | |
73 | ''; | |
74 | }; | |
75 | ||
76 | services.websites.env.production.vhostConfs.connexionswing_production = { | |
77 | certName = "connexionswing"; | |
78 | certMainHost = "connexionswing.com"; | |
79 | hosts = ["connexionswing.com" "sandetludo.com" "www.connexionswing.com" "www.sandetludo.com" ]; | |
80 | root = app.webRoot; | |
81 | extraConfig = [ | |
82 | '' | |
83 | <FilesMatch "\.php$"> | |
84 | SetHandler "proxy:unix:${pcfg.phpListenPaths.connexionswing_production}|fcgi://localhost" | |
85 | </FilesMatch> | |
86 | ||
87 | <Directory ${app.varDir}/medias> | |
88 | Options FollowSymLinks | |
89 | AllowOverride None | |
90 | Require all granted | |
91 | </Directory> | |
92 | ||
93 | <Directory ${app.varDir}/uploads> | |
94 | Options FollowSymLinks | |
95 | AllowOverride None | |
96 | Require all granted | |
97 | </Directory> | |
98 | ||
99 | Use Stats connexionswing.com | |
100 | ||
101 | <Directory ${app.webRoot}> | |
102 | Options Indexes FollowSymLinks MultiViews Includes | |
103 | AllowOverride All | |
104 | Require all granted | |
105 | </Directory> | |
106 | '' | |
107 | ]; | |
108 | }; | |
109 | }; | |
110 | } |