git.iko.soy/typeable/nixpkgs
on master help sign in
wordpress: 4.3.1 -> 4.6.1 + add a test
commit4671806183e05e839fa4fe9459079ad527e52905 authorGraham Christensen <graham@grahamc.com> dateMon 26 Sep 2016, 18:06 (10 years ago) parentd4c66e2
2 files changed+66−5
nixos/modules/services/web-servers/apache-httpd/wordpress.nix+6−5 nixos/tests/wordpress.nix+60
nixos/modules/services/web-servers/apache-httpd/wordpress.nix+6−5
@@ -5,7 +5,8 @@ with lib;
55
66let
77
8− version = "4.3.1";
8+ # Upgrading? We have a test! nix-build ./nixos/tests/wordpress.nix
9+ version = "4.6.1";
910 fullversion = "${version}";
1011
1112 # Our bare-bones wp-config.php file using the above settings
@@ -74,7 +75,7 @@ let
7475 owner = "WordPress";
7576 repo = "WordPress";
7677 rev = "${fullversion}";
77− sha256 = "1rk10vcv4z9p04hfzc0wkbilrgx7m9ssyr6c3w6vw3vl1bcgqxza";
78+ sha256 = "0n82xgjg1ry2p73hhgpslnkdzrma5n6hxxq76s7qskkzj0qjfvpn";
7879 };
7980 installPhase = ''
8081 mkdir -p $out
@@ -98,7 +99,7 @@ let
9899 # symlink additional plugin(s)
99100 ${concatMapStrings (plugin: "ln -s ${plugin} $out/wp-content/plugins/${plugin.name}\n") (config.plugins) }
100101
101− # symlink additional translation(s)
102+ # symlink additional translation(s)
102103 mkdir -p $out/wp-content/languages
103104 ${concatMapStrings (language: "ln -s ${language}/*.mo ${language}/*.po $out/wp-content/languages/\n") (selectedLanguages) }
104105 '';
@@ -123,7 +124,7 @@ in
123124 options = {
124125 dbHost = mkOption {
125126 default = "localhost";
126− description = "The location of the database server.";
127+ description = "The location of the database server.";
127128 example = "localhost";
128129 };
129130 dbName = mkOption {
@@ -253,7 +254,7 @@ in
253254 done
254255 ${pkgs.mysql}/bin/mysql -e 'CREATE DATABASE ${config.dbName};'
255256 ${pkgs.mysql}/bin/mysql -e 'GRANT ALL ON ${config.dbName}.* TO ${config.dbUser}@localhost IDENTIFIED BY "${config.dbPassword}";'
256− else
257+ else
257258 echo "Good, no need to do anything database related."
258259 fi
259260 '';
nixos/tests/wordpress.nixnew file+60
@@ -0,0 +1,60 @@
1+import ./make-test.nix ({ pkgs, ... }:
2+
3+{
4+ name = "wordpress";
5+ meta = with pkgs.stdenv.lib.maintainers; {
6+ maintainers = [ grahamc ]; # under duress!
7+ };
8+
9+ nodes =
10+ { web =
11+ { config, pkgs, ... }:
12+ {
13+ services.mysql.enable = true;
14+ services.mysql.package = pkgs.mysql;
15+ services.mysql.initialScript = pkgs.writeText "start.sql" ''
16+ CREATE DATABASE wordpress;
17+ CREATE USER 'wordpress'@'localhost' IDENTIFIED BY 'wordpress';
18+ GRANT ALL on wordpress.* TO 'wordpress'@'localhost';
19+ '';
20+
21+ services.httpd = {
22+ enable = true;
23+ logPerVirtualHost = true;
24+ adminAddr="js@lastlog.de";
25+ extraModules = [
26+ { name = "php7"; path = "${pkgs.php}/modules/libphp7.so"; }
27+ ];
28+
29+ virtualHosts = [
30+ {
31+ hostName = "wordpress";
32+ extraSubservices =
33+ [
34+ {
35+ serviceType = "wordpress";
36+ dbPassword = "wordpress";
37+ wordpressUploads = "/data/uploads";
38+ languages = [ "de_DE" "en_GB" ];
39+ }
40+ ];
41+ }
42+ ];
43+ };
44+ };
45+ };
46+
47+ testScript =
48+ { nodes, ... }:
49+ ''
50+ startAll;
51+
52+ $web->waitForUnit("mysql");
53+ $web->waitForUnit("httpd");
54+
55+ $web->succeed("curl -L 127.0.0.1:80 | grep 'Welcome to the famous'");
56+
57+
58+ '';
59+
60+})