wordpress: 4.3.1 -> 4.6.1 + add a test
This commit is contained in:
parent
d4c66e2f46
commit
4671806183
2 changed files with 66 additions and 5 deletions
|
@ -5,7 +5,8 @@ with lib;
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
version = "4.3.1";
|
# Upgrading? We have a test! nix-build ./nixos/tests/wordpress.nix
|
||||||
|
version = "4.6.1";
|
||||||
fullversion = "${version}";
|
fullversion = "${version}";
|
||||||
|
|
||||||
# Our bare-bones wp-config.php file using the above settings
|
# Our bare-bones wp-config.php file using the above settings
|
||||||
|
@ -74,7 +75,7 @@ let
|
||||||
owner = "WordPress";
|
owner = "WordPress";
|
||||||
repo = "WordPress";
|
repo = "WordPress";
|
||||||
rev = "${fullversion}";
|
rev = "${fullversion}";
|
||||||
sha256 = "1rk10vcv4z9p04hfzc0wkbilrgx7m9ssyr6c3w6vw3vl1bcgqxza";
|
sha256 = "0n82xgjg1ry2p73hhgpslnkdzrma5n6hxxq76s7qskkzj0qjfvpn";
|
||||||
};
|
};
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
mkdir -p $out
|
mkdir -p $out
|
||||||
|
@ -98,7 +99,7 @@ let
|
||||||
# symlink additional plugin(s)
|
# symlink additional plugin(s)
|
||||||
${concatMapStrings (plugin: "ln -s ${plugin} $out/wp-content/plugins/${plugin.name}\n") (config.plugins) }
|
${concatMapStrings (plugin: "ln -s ${plugin} $out/wp-content/plugins/${plugin.name}\n") (config.plugins) }
|
||||||
|
|
||||||
# symlink additional translation(s)
|
# symlink additional translation(s)
|
||||||
mkdir -p $out/wp-content/languages
|
mkdir -p $out/wp-content/languages
|
||||||
${concatMapStrings (language: "ln -s ${language}/*.mo ${language}/*.po $out/wp-content/languages/\n") (selectedLanguages) }
|
${concatMapStrings (language: "ln -s ${language}/*.mo ${language}/*.po $out/wp-content/languages/\n") (selectedLanguages) }
|
||||||
'';
|
'';
|
||||||
|
@ -123,7 +124,7 @@ in
|
||||||
options = {
|
options = {
|
||||||
dbHost = mkOption {
|
dbHost = mkOption {
|
||||||
default = "localhost";
|
default = "localhost";
|
||||||
description = "The location of the database server.";
|
description = "The location of the database server.";
|
||||||
example = "localhost";
|
example = "localhost";
|
||||||
};
|
};
|
||||||
dbName = mkOption {
|
dbName = mkOption {
|
||||||
|
@ -253,7 +254,7 @@ in
|
||||||
done
|
done
|
||||||
${pkgs.mysql}/bin/mysql -e 'CREATE DATABASE ${config.dbName};'
|
${pkgs.mysql}/bin/mysql -e 'CREATE DATABASE ${config.dbName};'
|
||||||
${pkgs.mysql}/bin/mysql -e 'GRANT ALL ON ${config.dbName}.* TO ${config.dbUser}@localhost IDENTIFIED BY "${config.dbPassword}";'
|
${pkgs.mysql}/bin/mysql -e 'GRANT ALL ON ${config.dbName}.* TO ${config.dbUser}@localhost IDENTIFIED BY "${config.dbPassword}";'
|
||||||
else
|
else
|
||||||
echo "Good, no need to do anything database related."
|
echo "Good, no need to do anything database related."
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
|
|
60
nixos/tests/wordpress.nix
Normal file
60
nixos/tests/wordpress.nix
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
import ./make-test.nix ({ pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
name = "wordpress";
|
||||||
|
meta = with pkgs.stdenv.lib.maintainers; {
|
||||||
|
maintainers = [ grahamc ]; # under duress!
|
||||||
|
};
|
||||||
|
|
||||||
|
nodes =
|
||||||
|
{ web =
|
||||||
|
{ config, pkgs, ... }:
|
||||||
|
{
|
||||||
|
services.mysql.enable = true;
|
||||||
|
services.mysql.package = pkgs.mysql;
|
||||||
|
services.mysql.initialScript = pkgs.writeText "start.sql" ''
|
||||||
|
CREATE DATABASE wordpress;
|
||||||
|
CREATE USER 'wordpress'@'localhost' IDENTIFIED BY 'wordpress';
|
||||||
|
GRANT ALL on wordpress.* TO 'wordpress'@'localhost';
|
||||||
|
'';
|
||||||
|
|
||||||
|
services.httpd = {
|
||||||
|
enable = true;
|
||||||
|
logPerVirtualHost = true;
|
||||||
|
adminAddr="js@lastlog.de";
|
||||||
|
extraModules = [
|
||||||
|
{ name = "php7"; path = "${pkgs.php}/modules/libphp7.so"; }
|
||||||
|
];
|
||||||
|
|
||||||
|
virtualHosts = [
|
||||||
|
{
|
||||||
|
hostName = "wordpress";
|
||||||
|
extraSubservices =
|
||||||
|
[
|
||||||
|
{
|
||||||
|
serviceType = "wordpress";
|
||||||
|
dbPassword = "wordpress";
|
||||||
|
wordpressUploads = "/data/uploads";
|
||||||
|
languages = [ "de_DE" "en_GB" ];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
testScript =
|
||||||
|
{ nodes, ... }:
|
||||||
|
''
|
||||||
|
startAll;
|
||||||
|
|
||||||
|
$web->waitForUnit("mysql");
|
||||||
|
$web->waitForUnit("httpd");
|
||||||
|
|
||||||
|
$web->succeed("curl -L 127.0.0.1:80 | grep 'Welcome to the famous'");
|
||||||
|
|
||||||
|
|
||||||
|
'';
|
||||||
|
|
||||||
|
})
|
Loading…
Reference in a new issue