1 { lib, config, pkgs, ... }:
3 cfg = config.myServices.websites.richie.production;
4 vardir = "/var/lib/richie_production";
5 richieSrc = pkgs.stdenv.mkDerivation rec {
6 version = pkgs.sources.websites-richie-app.version;
8 name = "${pname}-${version}";
9 src = pkgs.sources.websites-richie-app;
10 phases = "installPhase";
14 ln -sf ${vardir}/files $out/
15 ln -sf ${vardir}/drapeaux $out/images/
16 ln -sf ${vardir}/photos $out/
17 sed -i "s@localedef --list-archive@localedef --list-archive /run/current-system/sw/lib/locale/locale-archive@" $out/admin/parametres.php
20 webappdir = config.services.websites.webappDirsPaths.richie_production;
21 secretPath = config.secrets.fullPaths."websites/richie/production";
22 apacheUser = config.services.httpd.Prod.user;
23 apacheGroup = config.services.httpd.Prod.group;
26 options.myServices.websites.richie.production.enable = lib.mkEnableOption "enable Richie's website";
27 config = lib.mkIf cfg.enable {
28 services.duplyBackup.profiles.richie_production.rootDir = vardir;
29 services.webstats.sites = [ { name = "europe-richie.org"; } ];
32 dest = "websites/richie/production";
36 text = with config.myEnv.websites.richie; ''
39 $hote_sql = '${mysql.host}';
40 $login_sql = '${mysql.user}';
41 $bdd_sql = '${mysql.database}';
42 $mdp_sql = '${mysql.password}';
44 $db = mysqli_connect($hote_sql,$login_sql,$mdp_sql);
47 $smtp_mailer->Auth('${smtp_mailer.user}', '${smtp_mailer.password}');
51 services.websites.webappDirs.richie_production = richieSrc;
52 system.activationScripts.richie_production = {
55 install -m 0755 -o ${apacheUser} -g ${apacheGroup} -d /var/lib/php/sessions/richie_production
56 install -m 0755 -o ${apacheUser} -g ${apacheGroup} -d ${vardir}
59 services.phpfpm.pools.richie_production = {
63 "listen.owner" = apacheUser;
64 "listen.group" = apacheGroup;
67 "pm.max_children" = "5";
68 "pm.process_idle_timeout" = "60";
70 "php_admin_value[open_basedir]" = "${vardir}:/var/lib/php/sessions/richie_production:${secretPath}:${richieSrc}:/tmp";
71 "php_admin_value[session.save_path]" = "/var/lib/php/sessions/richie_production";
74 PATH = "/run/current-system/sw/bin:${lib.makeBinPath [ pkgs.imagemagick ]}";
75 BDD_CONNECT = secretPath;
77 phpOptions = config.services.phpfpm.phpOptions + ''
78 date.timezone = 'Europe/Paris'
80 phpPackage = pkgs.php72;
82 services.websites.env.production.modules = [ "proxy_fcgi" ];
83 services.websites.env.production.vhostConfs.richie_production = {
86 certMainHost = "europe-richie.org";
87 hosts = [ "europe-richie.org" "www.europe-richie.org" ];
91 Use Stats europe-richie.org
92 ErrorDocument 404 /404.html
93 <LocationMatch "^/files/.*/admin/">
96 <Directory ${webappdir}>
97 DirectoryIndex index.php index.htm index.html
98 Options Indexes FollowSymLinks MultiViews Includes
102 <FilesMatch "\.php$">
103 SetHandler "proxy:unix:${config.services.phpfpm.pools.richie_production.socket}|fcgi://localhost"