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