| 
									
										
										
										
											2016-09-26 18:06:56 -04:00
										 |  |  | import ./make-test.nix ({ pkgs, ... }: | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   name = "wordpress"; | 
					
						
							|  |  |  |   meta = with pkgs.stdenv.lib.maintainers; { | 
					
						
							|  |  |  |     maintainers = [ grahamc ]; # under duress! | 
					
						
							|  |  |  |   }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-02 10:36:14 -04:00
										 |  |  |   machine = | 
					
						
							| 
									
										
										
										
											2018-07-20 20:56:59 +00:00
										 |  |  |     { ... }: | 
					
						
							| 
									
										
										
										
											2019-06-02 10:36:14 -04:00
										 |  |  |     { services.httpd.adminAddr = "webmaster@site.local"; | 
					
						
							|  |  |  |       services.httpd.logPerVirtualHost = true; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       services.wordpress."site1.local" = { | 
					
						
							|  |  |  |         database.tablePrefix = "site1_"; | 
					
						
							|  |  |  |       }; | 
					
						
							| 
									
										
										
										
											2016-09-26 18:06:56 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-02 10:36:14 -04:00
										 |  |  |       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 - -" | 
					
						
							|  |  |  |       ]; | 
					
						
							|  |  |  |     }; | 
					
						
							| 
									
										
										
										
											2016-09-26 18:06:56 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-02 10:36:14 -04:00
										 |  |  |   testScript = ''
 | 
					
						
							|  |  |  |     startAll; | 
					
						
							| 
									
										
										
										
											2016-09-26 18:06:56 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-02 10:36:14 -04:00
										 |  |  |     $machine->waitForUnit("httpd"); | 
					
						
							|  |  |  |     $machine->waitForUnit("phpfpm-wordpress-site1.local"); | 
					
						
							|  |  |  |     $machine->waitForUnit("phpfpm-wordpress-site2.local"); | 
					
						
							| 
									
										
										
										
											2016-09-26 18:06:56 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-02 10:36:14 -04:00
										 |  |  |     $machine->succeed("curl -L site1.local | grep 'Welcome to the famous'"); | 
					
						
							|  |  |  |     $machine->succeed("curl -L site2.local | grep 'Welcome to the famous'"); | 
					
						
							|  |  |  |   '';
 | 
					
						
							| 
									
										
										
										
											2016-09-26 18:06:56 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | }) |