-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(nginx): link nginx.conf to dataDir (#173)
- Loading branch information
1 parent
c93d0ad
commit 75a42b9
Showing
2 changed files
with
40 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,43 @@ | ||
{ pkgs, config, ... }: { | ||
services.nginx."nginx1".enable = true; | ||
services.nginx."nginx1" = { | ||
enable = true; | ||
httpConfig = '' | ||
server { | ||
listen 8888; | ||
include ../../importedconfig.conf; | ||
} | ||
''; | ||
}; | ||
|
||
settings.processes.test = | ||
let | ||
cfg = config.services.nginx."nginx1"; | ||
in | ||
settings.processes = | ||
{ | ||
command = pkgs.writeShellApplication { | ||
runtimeInputs = [ cfg.package pkgs.gnugrep pkgs.curl ]; | ||
text = '' | ||
curl http://127.0.0.1:${builtins.toString cfg.port} | grep -q "nginx" | ||
''; | ||
name = "nginx-test"; | ||
init = { | ||
command = pkgs.writeShellApplication { | ||
runtimeInputs = [ pkgs.coreutils ]; | ||
text = '' | ||
cat >importedconfig.conf <<EOL | ||
location / { | ||
add_header Content-Type text/plain; | ||
return 200 'Looks good'; | ||
} | ||
EOL | ||
''; | ||
name = "init"; | ||
}; | ||
}; | ||
depends_on."nginx1".condition = "process_healthy"; | ||
}; | ||
test = | ||
let | ||
cfg = config.services.nginx."nginx1"; | ||
in | ||
{ | ||
command = pkgs.writeShellApplication { | ||
runtimeInputs = [ cfg.package pkgs.gnugrep pkgs.curl ]; | ||
text = '' | ||
curl -s -H "Accept: text/plain" http://127.0.0.1:8888 | grep -q "Looks good" | ||
''; | ||
name = "nginx-test"; | ||
}; | ||
depends_on."nginx1".condition = "process_healthy"; | ||
}; | ||
} // { "nginx1".depends_on."init".condition = "process_completed"; }; | ||
} |