mirror of
https://codeberg.org/icewind/haze.git
synced 2026-06-03 09:04:12 +02:00
add dns for proxy inside container
This commit is contained in:
parent
ce34f302a1
commit
0d98667650
9 changed files with 37 additions and 12 deletions
|
|
@ -66,4 +66,22 @@ then
|
||||||
cp /etc/supervisor/blackfire.conf /etc/supervisor/enabled/
|
cp /etc/supervisor/blackfire.conf /etc/supervisor/enabled/
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -n "${PROXY_BASE:-}" ]; then
|
||||||
|
UPSTREAM_DNS=$(cat /etc/resolv.conf | grep nameserver | cut -d' ' -f 2)
|
||||||
|
(
|
||||||
|
RC=$(sed '/nameserver/d' /etc/resolv.conf)
|
||||||
|
echo "$RC" > /etc/resolv.conf
|
||||||
|
)
|
||||||
|
echo 'nameserver 127.0.0.22' >> /etc/resolv.conf
|
||||||
|
|
||||||
|
echo "s/UPSTREAM_DNS/${UPSTREAM_DNS}"
|
||||||
|
sed -i "s/UPSTREAM_DNS/${UPSTREAM_DNS}/" /etc/dnsmasq.conf
|
||||||
|
echo "s/PROXY_BASE/${PROXY_BASE}"
|
||||||
|
sed -i "s/PROXY_BASE/${PROXY_BASE}/" /etc/dnsmasq.conf
|
||||||
|
echo "s/HOST_IP/${HOST_IP}"
|
||||||
|
sed -i "s/HOST_IP/${HOST_IP}/" /etc/dnsmasq.conf
|
||||||
|
|
||||||
|
cp /etc/supervisor/dnsmasq.conf /etc/supervisor/enabled/
|
||||||
|
fi
|
||||||
|
|
||||||
exec supervisord -c /etc/supervisor/supervisord.conf
|
exec supervisord -c /etc/supervisor/supervisord.conf
|
||||||
|
|
@ -1,15 +1,7 @@
|
||||||
{runCommand}:
|
{runCommand}:
|
||||||
runCommand "configs" {} ''
|
runCommand "configs" {} ''
|
||||||
mkdir -p $out/etc
|
mkdir -p $out
|
||||||
mkdir -p $out/etc/sudoers.d
|
cp -r ${./configs} $out/etc
|
||||||
mkdir -p $out/conf
|
chmod -R +w $out/etc
|
||||||
cp ${./configs/cron.conf} $out/etc/oc-cron.conf
|
|
||||||
cp ${./configs/nginx-app.conf} $out/conf/nginx-app.conf
|
|
||||||
cp ${./configs/sudoers} $out/etc/sudoers.d/haze
|
|
||||||
cp -r ${./configs/nc} $out/etc/nc
|
|
||||||
cp ${./configs/php-fpm.conf} $out/etc/php-fpm.conf
|
|
||||||
cp ${./configs/nginx.conf} $out/etc/nginx.conf
|
|
||||||
cp -r ${./configs/supervisor} $out/etc/supervisor
|
|
||||||
chmod +w $out/etc/supervisor
|
|
||||||
mkdir $out/etc/supervisor/enabled/
|
mkdir $out/etc/supervisor/enabled/
|
||||||
''
|
''
|
||||||
|
|
|
||||||
6
nix/image/configs/dnsmasq.conf
Normal file
6
nix/image/configs/dnsmasq.conf
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
listen-address=127.0.0.22
|
||||||
|
no-resolv
|
||||||
|
|
||||||
|
address=/PROXY_BASE/HOST_IP
|
||||||
|
|
||||||
|
server=UPSTREAM_DNS
|
||||||
|
|
@ -79,7 +79,7 @@ http {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
include /conf/nginx-app.conf;
|
include /etc/nginx-app.conf;
|
||||||
|
|
||||||
location ~ \.php(?:$|/) {
|
location ~ \.php(?:$|/) {
|
||||||
rewrite ^/(?!index|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|ocs-provider\/.+|.+\/richdocumentscode\/proxy) /index.php$request_uri;
|
rewrite ^/(?!index|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|ocs-provider\/.+|.+\/richdocumentscode\/proxy) /index.php$request_uri;
|
||||||
|
|
|
||||||
2
nix/image/configs/supervisor/dnsmasq.conf
Normal file
2
nix/image/configs/supervisor/dnsmasq.conf
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
[program:dnsmasq]
|
||||||
|
command = /bin/dnsmasq --keep-in-foreground -u root
|
||||||
|
|
@ -34,6 +34,7 @@
|
||||||
vim,
|
vim,
|
||||||
helix,
|
helix,
|
||||||
python3Packages,
|
python3Packages,
|
||||||
|
dnsmasq,
|
||||||
}: let
|
}: let
|
||||||
inherit (builtins) toString;
|
inherit (builtins) toString;
|
||||||
inherit (lib) readFile getExe concatStringsSep splitString take;
|
inherit (lib) readFile getExe concatStringsSep splitString take;
|
||||||
|
|
@ -149,6 +150,7 @@
|
||||||
vim
|
vim
|
||||||
helix
|
helix
|
||||||
python3Packages.supervisor
|
python3Packages.supervisor
|
||||||
|
dnsmasq
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -160,6 +160,11 @@ impl PhpVersion {
|
||||||
proxy_config.addr(id, IpAddr::V4(Ipv4Addr::LOCALHOST))
|
proxy_config.addr(id, IpAddr::V4(Ipv4Addr::LOCALHOST))
|
||||||
));
|
));
|
||||||
|
|
||||||
|
env.push(format!("HOST_IP={host}"));
|
||||||
|
if !proxy_config.address.is_empty() {
|
||||||
|
env.push(format!("PROXY_BASE={}", proxy_config.address));
|
||||||
|
}
|
||||||
|
|
||||||
let mut labels = hashmap! {
|
let mut labels = hashmap! {
|
||||||
"haze-type".to_string() => "cloud".to_string(),
|
"haze-type".to_string() => "cloud".to_string(),
|
||||||
"haze-db".to_string() => db.name().to_string(),
|
"haze-db".to_string() => db.name().to_string(),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue