60 lines
1.4 KiB
Nix
60 lines
1.4 KiB
Nix
{
|
|
self,
|
|
config,
|
|
lib,
|
|
hostPkgs,
|
|
...
|
|
}:
|
|
{
|
|
name = "service-wordpress";
|
|
result.update-vars =
|
|
let
|
|
relativeDir = lib.removePrefix "${self}/" (toString config.clan.directory);
|
|
in
|
|
hostPkgs.writeShellScriptBin "update-vars" ''
|
|
set -x
|
|
export PRJ_ROOT=$(git rev-parse --show-toplevel)
|
|
${
|
|
self.inputs.clan-core.packages.${hostPkgs.system}.clan-cli
|
|
}/bin/clan-generate-test-vars $PRJ_ROOT/${relativeDir} ${config.name}
|
|
'';
|
|
|
|
clan = {
|
|
test.useContainers = false;
|
|
directory = ./.;
|
|
inventory = {
|
|
machines.server = { };
|
|
|
|
instances = {
|
|
wordpress-test = {
|
|
module.name = "@clan/wordpress";
|
|
module.input = "self";
|
|
roles.server.machines."server".settings = {
|
|
tenants = [
|
|
"localhost"
|
|
"site2.localhost"
|
|
];
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
|
|
nodes = {
|
|
server = { };
|
|
};
|
|
|
|
testScript = ''
|
|
start_all()
|
|
|
|
server.wait_for_unit("phpfpm-wordpress-localhost.service")
|
|
server.wait_for_unit("phpfpm-wordpress-site2.localhost.service")
|
|
|
|
server.succeed("systemctl status phpfpm-wordpress-localhost.service")
|
|
server.succeed("systemctl status phpfpm-wordpress-site2.localhost.service")
|
|
server.wait_for_open_port(80)
|
|
server.succeed("curl -H \"Host: localhost\" http://127.0.0.1:80 ")
|
|
server.succeed("curl -H \"Host: site2.localhost\" http://127.0.0.1:80 ")
|
|
'';
|
|
}
|