]>
Commit | Line | Data |
---|---|---|
ab8f306d | 1 | { lib, pkgs, config, ... }: |
f8026b6e | 2 | let |
ab8f306d | 3 | secrets = config.myEnv.websites.aten.integration; |
717ccfd9 | 4 | app = pkgs.webapps.aten.override { environment = secrets.environment; }; |
f8026b6e | 5 | cfg = config.myServices.websites.aten.integration; |
717ccfd9 | 6 | pcfg = config.services.phpApplication; |
f8026b6e IB |
7 | in { |
8 | options.myServices.websites.aten.integration.enable = lib.mkEnableOption "enable Aten's website in integration"; | |
9 | ||
10 | config = lib.mkIf cfg.enable { | |
d2e703c5 | 11 | services.duplyBackup.profiles.aten_dev.rootDir = app.varDir; |
717ccfd9 | 12 | services.phpApplication.apps.aten_dev = { |
2e48907d IB |
13 | websiteEnv = "integration"; |
14 | httpdUser = config.services.httpd.Inte.user; | |
15 | httpdGroup = config.services.httpd.Inte.group; | |
717ccfd9 IB |
16 | httpdWatchFiles = [ |
17 | config.secrets.fullPaths."webapps/${app.environment}-aten" | |
18 | ]; | |
2e48907d IB |
19 | inherit (app) webRoot varDir; |
20 | inherit app; | |
21 | serviceDeps = [ "postgresql.service" ]; | |
22 | preStartActions = [ | |
23 | "APP_ENV=${app.environment} ./bin/console --env=${app.environment} cache:clear --no-warmup" | |
24 | ]; | |
717ccfd9 IB |
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 = ondemand | |
31 | pm.max_children = 5 | |
32 | pm.process_idle_timeout = 60 | |
33 | env[SYMFONY_DEBUG_MODE] = "yes" | |
34 | ''; | |
2e48907d IB |
35 | }; |
36 | ||
717ccfd9 IB |
37 | secrets.keys = [{ |
38 | dest = "webapps/${app.environment}-aten"; | |
39 | user = config.services.httpd.Inte.user; | |
9f66adf4 | 40 | group = config.services.httpd.Inte.group; |
717ccfd9 | 41 | permissions = "0400"; |
ab8f306d IB |
42 | text = let |
43 | # cf: | |
44 | # https://secure.php.net/manual/fr/function.parse-url.php | |
45 | # vendor/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php#parseDatabaseUrlQuery | |
46 | psql_url = with secrets.postgresql; "pdo-pgsql://${user}:${password}@invalid:${port}/${database}?host=${socket}"; | |
47 | in '' | |
717ccfd9 IB |
48 | SetEnv APP_ENV "${app.environment}" |
49 | SetEnv APP_SECRET "${secrets.secret}" | |
ab8f306d | 50 | SetEnv DATABASE_URL "${psql_url}" |
717ccfd9 IB |
51 | ''; |
52 | }]; | |
53 | services.websites.env.integration.vhostConfs.aten_dev = { | |
f8026b6e IB |
54 | certName = "eldiron"; |
55 | addToCerts = true; | |
56 | hosts = [ "dev.aten.pro" ]; | |
717ccfd9 IB |
57 | root = pcfg.webappDirs.aten_dev; |
58 | extraConfig = [ | |
59 | '' | |
60 | <FilesMatch "\.php$"> | |
61 | SetHandler "proxy:unix:${pcfg.phpListenPaths.aten_dev}|fcgi://localhost" | |
62 | </FilesMatch> | |
63 | ||
64 | Include ${config.secrets.fullPaths."webapps/${app.environment}-aten"} | |
65 | ||
66 | <Location /> | |
67 | Use LDAPConnect | |
68 | Require ldap-group cn=dev.aten.pro,cn=httpd,ou=services,dc=immae,dc=eu | |
69 | ErrorDocument 401 "<html><meta http-equiv=\"refresh\" content=\"0;url=https://aten.pro\"></html>" | |
70 | </Location> | |
71 | ||
72 | <Location /backend> | |
73 | Use LDAPConnect | |
74 | Require ldap-group cn=dev.aten.pro,cn=httpd,ou=services,dc=immae,dc=eu | |
75 | ErrorDocument 401 "<html><meta http-equiv=\"refresh\" content=\"0;url=https://aten.pro\"></html>" | |
76 | </Location> | |
77 | ||
78 | <Directory ${pcfg.webappDirs.aten_dev}> | |
79 | Options Indexes FollowSymLinks MultiViews Includes | |
80 | AllowOverride All | |
81 | Require all granted | |
82 | DirectoryIndex index.php | |
83 | FallbackResource /index.php | |
84 | </Directory> | |
85 | '' | |
86 | ]; | |
f8026b6e IB |
87 | }; |
88 | }; | |
89 | } |