re-do a few things to fix up test/handle updated code
This commit is contained in:
parent
73c054cbc5
commit
5404d6124f
|
@ -58,5 +58,6 @@ ENV IPv6 True
|
|||
EXPOSE 53 53/udp
|
||||
EXPOSE 80
|
||||
|
||||
SHELL ["/bin/bash", "-c"]
|
||||
ENTRYPOINT ["/tini", "--"]
|
||||
CMD [ "/start.sh" ]
|
||||
|
|
|
@ -27,9 +27,10 @@ http {
|
|||
add_header X-Pi-hole "The Pi-hole Web interface is working!";
|
||||
location ~ .php$ {
|
||||
fastcgi_pass 127.0.0.1:9000;
|
||||
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
||||
fastcgi_index index.php;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
include fastcgi_params;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
setupVars="${setupVars:-/etc/pihole/setupVars.conf}"
|
||||
. /opt/pihole/webpage.sh
|
||||
|
||||
validate_env() {
|
||||
if [ -z "$ServerIP" ] ; then
|
||||
|
@ -7,14 +7,8 @@ validate_env() {
|
|||
fi;
|
||||
}
|
||||
|
||||
setup_saved_variables() {
|
||||
# /tmp/piholeIP is the current override of auto-lookup in gravity.sh
|
||||
echo "$ServerIP" > /etc/pihole/piholeIP;
|
||||
echo "IPV4_ADDRESS=$ServerIP" > "${setupVars}";
|
||||
echo "IPV6_ADDRESS=$ServerIPv6" >> "${setupVars}";
|
||||
}
|
||||
|
||||
setup_dnsmasq_dns() {
|
||||
. /opt/pihole/webpage.sh
|
||||
local DNS1="${1:-8.8.8.8}"
|
||||
local DNS2="${2:-8.8.4.4}"
|
||||
local dnsType='default'
|
||||
|
@ -22,10 +16,10 @@ setup_dnsmasq_dns() {
|
|||
dnsType='custom'
|
||||
fi;
|
||||
|
||||
set -x
|
||||
echo "Using $dnsType DNS servers: $DNS1 & $DNS2"
|
||||
sed -i 's/ProcessDnsmasqSettings/ProcessDNSSettings/g' /opt/pihole/webpage.sh
|
||||
sudo pihole -a setdns "$DNS1" "$DNS2"
|
||||
[ -n "$DNS1" ] && change_setting "PIHOLE_DNS_1" "${DNS1}"
|
||||
[ -n "$DNS2" ] && change_setting "PIHOLE_DNS_2" "${DNS2}"
|
||||
ProcessDNSSettings
|
||||
}
|
||||
|
||||
setup_dnsmasq_hostnames() {
|
||||
|
@ -155,9 +149,9 @@ test_framework_stubbing() {
|
|||
if [ -n "$PYTEST" ] ; then sed -i 's/^gravity_spinup$/#gravity_spinup # DISABLED FOR PYTEST/g' "$(which gravity.sh)"; fi;
|
||||
}
|
||||
|
||||
main() {
|
||||
docker_main() {
|
||||
echo -n '::: Starting up DNS and Webserver ...'
|
||||
pihole restartdns # Just get DNS up. The webserver is down!!!
|
||||
service dnsmasq restart # Just get DNS up. The webserver is down!!!
|
||||
|
||||
IMAGE="$1"
|
||||
case $IMAGE in # Setup webserver
|
||||
|
|
|
@ -35,6 +35,7 @@ ENV IPv6 True
|
|||
EXPOSE 53 53/udp
|
||||
EXPOSE 80
|
||||
|
||||
SHELL ["/bin/bash", "-c"]
|
||||
ENTRYPOINT ["/tini", "--"]
|
||||
CMD [ "/start.sh" ]
|
||||
|
||||
|
|
|
@ -33,5 +33,6 @@ ENV IPv6 True
|
|||
EXPOSE 53 53/udp
|
||||
EXPOSE 80
|
||||
|
||||
SHELL ["/bin/bash", "-c"]
|
||||
ENTRYPOINT ["/tini", "--"]
|
||||
CMD [ "/start.sh" ]
|
||||
|
|
|
@ -49,7 +49,9 @@ export IPV6_ADDRESS=0:0:0:0:0:0
|
|||
export PIHOLE_DNS_1=8.8.8.8
|
||||
export PIHOLE_DNS_2=8.8.4.4
|
||||
export QUERY_LOGGING=true
|
||||
|
||||
installPihole | tee "${tmpLog}"
|
||||
sed -i 's/readonly //g' /opt/pihole/webpage.sh
|
||||
|
||||
mv "${tmpLog}" "${instalLogLoc}"
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
docker-compose
|
||||
pytest==2.9.2
|
||||
pytest-cov==2.3.0
|
||||
pytest-xdist==1.14
|
||||
pytest
|
||||
pytest-cov
|
||||
pytest-xdist
|
||||
testinfra==1.5.1
|
||||
|
|
15
start.sh
15
start.sh
|
@ -1,5 +1,4 @@
|
|||
#!/bin/bash -e
|
||||
. /bash_functions.sh
|
||||
#!/bin/bash -ex
|
||||
# Dockerfile variables
|
||||
export IMAGE
|
||||
export ServerIP
|
||||
|
@ -9,16 +8,22 @@ export PHP_ENV_CONFIG
|
|||
export PHP_ERROR_LOG
|
||||
export HOSTNAME
|
||||
export WEBLOGDIR
|
||||
export DNS1
|
||||
export DNS2
|
||||
export IPv6
|
||||
#export setupVars="${setupVars:-/etc/pihole/setupVars.conf}"
|
||||
|
||||
. /bash_functions.sh
|
||||
|
||||
echo " ::: Starting docker specific setup for docker diginc/pi-hole"
|
||||
validate_env
|
||||
setup_saved_variables
|
||||
setup_php_env
|
||||
change_setting "IPV4_ADDRESS" "$ServerIP"
|
||||
change_setting "IPV6_ADDRESS" "$ServerIPv6"
|
||||
setup_dnsmasq_dns "$DNS1" "$DNS2"
|
||||
setup_php_env
|
||||
setup_dnsmasq_hostnames "$ServerIP" "$ServerIPv6" "$HOSTNAME"
|
||||
setup_ipv4_ipv6
|
||||
test_configs
|
||||
test_framework_stubbing
|
||||
|
||||
main "$IMAGE"
|
||||
docker_main "$IMAGE"
|
||||
|
|
|
@ -14,9 +14,10 @@ def cmd(request):
|
|||
])
|
||||
def test_IPv6_not_True_removes_ipv6(Docker, tag, args, expected_ipv6, expected_stdout):
|
||||
''' When a user overrides IPv6=True they only get IPv4 listening webservers '''
|
||||
IPV6_LINE = { 'alpine': 'listen \[::\]:80', 'debian': 'use-ipv6.pl' }
|
||||
WEB_CONFIG = { 'alpine': '/etc/nginx/nginx.conf', 'debian': '/etc/lighttpd/lighttpd.conf' }
|
||||
|
||||
IPV6_LINE = { 'alpine': 'listen \[::\]:80',
|
||||
'debian': 'use-ipv6.pl' }
|
||||
WEB_CONFIG = { 'alpine': '/etc/nginx/nginx.conf',
|
||||
'debian': '/etc/lighttpd/lighttpd.conf' }
|
||||
|
||||
function = Docker.run('. /bash_functions.sh ; setup_ipv4_ipv6')
|
||||
assert "Using {}".format(expected_stdout) in function.stdout
|
||||
|
@ -38,7 +39,7 @@ def test_DNS_Envs_override_defaults(Docker, args, expected_stdout, dns1, dns2):
|
|||
expected_servers = 'server={}\nserver={}\n'.format(dns1, dns2)
|
||||
assert expected_servers == docker_dns_servers
|
||||
|
||||
expected_debian_lines = [
|
||||
expected_debian_lines = [
|
||||
'"VIRTUAL_HOST" => "192.168.100.2"',
|
||||
'"ServerIP" => "192.168.100.2"',
|
||||
'"PHP_ERROR_LOG" => "/var/log/lighttpd/error.log"'
|
||||
|
|
Loading…
Reference in New Issue