nixos/wordpress: create module to replace the httpd subservice

This commit is contained in:
Aaron Andersen
2019-07-03 11:47:33 -04:00
parent e1857b7808
commit aa05aad470
4 changed files with 399 additions and 323 deletions
+27 -38
View File
@@ -6,48 +6,37 @@ import ./make-test.nix ({ pkgs, ... }:
maintainers = [ grahamc ]; # under duress!
};
nodes =
{ web =
{ pkgs, ... }:
{
services.mysql = {
enable = true;
package = pkgs.mysql;
};
services.httpd = {
enable = true;
logPerVirtualHost = true;
adminAddr="js@lastlog.de";
machine =
{ ... }:
{ services.httpd.adminAddr = "webmaster@site.local";
services.httpd.logPerVirtualHost = true;
virtualHosts = [
{
hostName = "wordpress";
extraSubservices =
[
{
serviceType = "wordpress";
dbPassword = "wordpress";
dbHost = "127.0.0.1";
languages = [ "de_DE" "en_GB" ];
}
];
}
];
};
};
services.wordpress."site1.local" = {
database.tablePrefix = "site1_";
};
services.wordpress."site2.local" = {
database.tablePrefix = "site2_";
};
networking.hosts."127.0.0.1" = [ "site1.local" "site2.local" ];
# required for wordpress-init.service to succeed
systemd.tmpfiles.rules = [
"F /var/lib/wordpress/site1.local/secret-keys.php 0440 wordpress wwwrun - -"
"F /var/lib/wordpress/site2.local/secret-keys.php 0440 wordpress wwwrun - -"
];
};
testScript =
{ ... }:
''
startAll;
testScript = ''
startAll;
$web->waitForUnit("mysql");
$web->waitForUnit("httpd");
$machine->waitForUnit("httpd");
$machine->waitForUnit("phpfpm-wordpress-site1.local");
$machine->waitForUnit("phpfpm-wordpress-site2.local");
$web->succeed("curl -L 127.0.0.1:80 | grep 'Welcome to the famous'");
'';
$machine->succeed("curl -L site1.local | grep 'Welcome to the famous'");
$machine->succeed("curl -L site2.local | grep 'Welcome to the famous'");
'';
})