]>
Commit | Line | Data |
---|---|---|
1 | { lib, pkgs, config, ... }: | |
2 | let | |
3 | secrets = config.myEnv.websites.connexionswing.production; | |
4 | app = pkgs.callPackage ./app { | |
5 | environment = secrets.environment; | |
6 | varDir = "/var/lib/connexionswing_production"; | |
7 | secretsPath = config.secrets.fullPaths."websites/connexionswing/production"; | |
8 | }; | |
9 | cfg = config.myServices.websites.connexionswing.production; | |
10 | pcfg = config.services.phpApplication; | |
11 | in { | |
12 | options.myServices.websites.connexionswing.production.enable = lib.mkEnableOption "enable Connexionswing's website in production"; | |
13 | ||
14 | config = lib.mkIf cfg.enable { | |
15 | services.duplyBackup.profiles.connexionswing_produdction.rootDir = app.varDir; | |
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 | }; | |
47 | ||
48 | secrets.keys = [ | |
49 | { | |
50 | dest = "websites/connexionswing/production"; | |
51 | user = config.services.httpd.Prod.user; | |
52 | group = config.services.httpd.Prod.group; | |
53 | permissions = "0400"; | |
54 | text = '' | |
55 | # This file is auto-generated during the composer install | |
56 | parameters: | |
57 | database_host: ${secrets.mysql.host} | |
58 | database_port: ${secrets.mysql.port} | |
59 | database_name: ${secrets.mysql.database} | |
60 | database_user: ${secrets.mysql.user} | |
61 | database_password: ${secrets.mysql.password} | |
62 | database_server_version: ${pkgs.mariadb.mysqlVersion} | |
63 | mailer_transport: sendmail | |
64 | mailer_host: null | |
65 | mailer_user: null | |
66 | mailer_password: null | |
67 | subscription_email: ${secrets.email} | |
68 | allow_robots: true | |
69 | secret: ${secrets.secret} | |
70 | services: | |
71 | swiftmailer.mailer.default.transport: | |
72 | class: Swift_SendmailTransport | |
73 | arguments: ['/run/wrappers/bin/sendmail -bs'] | |
74 | ''; | |
75 | } | |
76 | ]; | |
77 | ||
78 | services.websites.env.production.vhostConfs.connexionswing_production = { | |
79 | certName = "connexionswing"; | |
80 | certMainHost = "connexionswing.com"; | |
81 | hosts = ["connexionswing.com" "sandetludo.com" "www.connexionswing.com" "www.sandetludo.com" ]; | |
82 | root = pcfg.webappDirs.connexionswing_production; | |
83 | extraConfig = [ | |
84 | '' | |
85 | <FilesMatch "\.php$"> | |
86 | SetHandler "proxy:unix:${pcfg.phpListenPaths.connexionswing_production}|fcgi://localhost" | |
87 | </FilesMatch> | |
88 | ||
89 | <Directory ${app.varDir}/medias> | |
90 | Options FollowSymLinks | |
91 | AllowOverride None | |
92 | Require all granted | |
93 | </Directory> | |
94 | ||
95 | <Directory ${app.varDir}/uploads> | |
96 | Options FollowSymLinks | |
97 | AllowOverride None | |
98 | Require all granted | |
99 | </Directory> | |
100 | ||
101 | Use Stats connexionswing.com | |
102 | ||
103 | <Directory ${pcfg.webappDirs.connexionswing_production}> | |
104 | Options Indexes FollowSymLinks MultiViews Includes | |
105 | AllowOverride All | |
106 | Require all granted | |
107 | </Directory> | |
108 | '' | |
109 | ]; | |
110 | }; | |
111 | }; | |
112 | } |