mirror of
https://github.com/juspay/services-flake.git
synced 2024-09-11 04:15:36 +03:00
fix(nginx): link nginx.conf to dataDir (#173)
This commit is contained in:
parent
c93d0ad98f
commit
75a42b9e9e
@ -100,7 +100,8 @@ in
|
||||
if [[ ! -d "${config.dataDir}" ]]; then
|
||||
mkdir -p "${config.dataDir}"
|
||||
fi
|
||||
nginx -p "$(pwd)" -c ${config.configFile} -e /dev/stderr
|
||||
ln -sfn ${config.configFile} "${config.dataDir}/nginx.conf"
|
||||
nginx -p "$(pwd)" -c "${config.dataDir}/nginx.conf" -e /dev/stderr
|
||||
'';
|
||||
};
|
||||
in
|
||||
|
@ -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"; };
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user