mirror of
https://github.com/pi-hole/docker-pi-hole.git
synced 2024-06-26 00:59:07 +02:00
Merge branch 'master' of github.com:diginc/docker-pi-hole into dev
This commit is contained in:
commit
1111f81fbf
|
@ -1,4 +1,3 @@
|
|||
sudo: required
|
||||
services:
|
||||
- docker
|
||||
language: python
|
||||
|
|
|
@ -15,6 +15,7 @@ Options:
|
|||
|
||||
Examples:
|
||||
"""
|
||||
from __future__ import print_function
|
||||
|
||||
from docopt import docopt
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
|
@ -64,7 +65,7 @@ images = {
|
|||
|
||||
def generate_dockerfiles(args):
|
||||
if args['--no-generate']:
|
||||
print " ::: Skipping Dockerfile generation"
|
||||
print(" ::: Skipping Dockerfile generation")
|
||||
return
|
||||
|
||||
for version, archs in images.iteritems():
|
||||
|
@ -92,13 +93,13 @@ def generate_dockerfiles(args):
|
|||
|
||||
def build_dockerfiles(args):
|
||||
if args['--no-build']:
|
||||
print " ::: Skipping Dockerfile building"
|
||||
print(" ::: Skipping Dockerfile building")
|
||||
return
|
||||
|
||||
for arch in args['--arch']:
|
||||
# TODO: include from external .py that can be shared with Dockerfile.py / Tests / deploy scripts '''
|
||||
if arch == 'armel':
|
||||
print "Skipping armel, incompatible upstream binaries/broken"
|
||||
print("Skipping armel, incompatible upstream binaries/broken")
|
||||
continue
|
||||
build('pihole', arch, args)
|
||||
|
||||
|
@ -119,16 +120,16 @@ def build(docker_repo, arch, args):
|
|||
no_cache = '--no-cache'
|
||||
build_command = '{time}docker build {no_cache} --pull --cache-from="{cache},{create_tag}" -f {dockerfile} -t {create_tag} .'\
|
||||
.format(time=time, no_cache=no_cache, cache=cached_image, dockerfile=dockerfile, create_tag=repo_tag)
|
||||
print " ::: Building {} into {}".format(dockerfile, repo_tag)
|
||||
print(" ::: Building {} into {}".format(dockerfile, repo_tag))
|
||||
if args['-v']:
|
||||
print build_command, '\n'
|
||||
print(build_command, '\n')
|
||||
build_result = run_local(build_command)
|
||||
if args['-v']:
|
||||
print build_result.stdout
|
||||
print build_result.stderr
|
||||
print(build_result.stdout)
|
||||
print(build_result.stderr)
|
||||
if build_result.rc != 0:
|
||||
print " ::: Building {} encountered an error".format(dockerfile)
|
||||
print build_result.stderr
|
||||
print(" ::: Building {} encountered an error".format(dockerfile))
|
||||
print(build_result.stderr)
|
||||
assert build_result.rc == 0
|
||||
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ services:
|
|||
restart: unless-stopped
|
||||
```
|
||||
|
||||
[Here is an equivilent docker run script](https://github.com/pi-hole/docker-pi-hole/blob/master/docker_run.sh).
|
||||
[Here is an equivalent docker run script](https://github.com/pi-hole/docker-pi-hole/blob/master/docker_run.sh).
|
||||
|
||||
## Upgrade Notices:
|
||||
|
||||
|
@ -102,6 +102,12 @@ There are other environment variables if you want to customize various things in
|
|||
| `WEBPASSWORD: <Admin password>`<br/> **Recommended** *Default: random* | http://pi.hole/admin password. Run `docker logs pihole \| grep random` to find your random pass.
|
||||
| `DNS1: <IP>`<br/> *Optional* *Default: 8.8.8.8* | Primary upstream DNS provider, default is google DNS
|
||||
| `DNS2: <IP>`<br/> *Optional* *Default: 8.8.4.4* | Secondary upstream DNS provider, default is google DNS, `no` if only one DNS should used
|
||||
| `DNSSEC: <True\|False>`<br/> *Optional* *Default: false* | Enable DNSSEC support
|
||||
| `DNS_BOGUS_PRIV: <True\|False>`<br/> *Optional* *Default: true* | Enable forwarding of reverse lookups for private ranges
|
||||
| `CONDITIONAL_FORWARDING: <True\|False>`<br/> *Optional* *Default: False* | Enable DNS conditional forwarding for device name resolution
|
||||
| `CONDITIONAL_FORWARDING_IP: <Router's IP>`<br/> *Optional* | If conditional forwarding is enabled, set the IP of the local network router
|
||||
| `CONDITIONAL_FORWARDING_DOMAIN: <Network Domain>`<br/> *Optional* | If conditional forwarding is enabled, set the domain of the local network router
|
||||
| `CONDITIONAL_FORWARDING_REVERSE: <Reverse DNS>`<br/> *Optional* | If conditional forwarding is enabled, set the reverse DNS of the local network router (e.g. `0.168.192.in-addr.arpa`)
|
||||
| `ServerIP: <Host's IP>`<br/> **Recommended** | **--net=host mode requires** Set to your server's LAN IP, used by web block modes and lighttpd bind address
|
||||
| `ServerIPv6: <Host's IPv6>`<br/> *Required if using IPv6* | **If you have a v6 network** set to your server's LAN IPv6 to block IPv6 ads fully
|
||||
| `VIRTUAL_HOST: <Custom Hostname>`<br/> *Optional* *Default: $ServerIP* | What your web server 'virtual host' is, accessing admin through this Hostname/IP allows you to make changes to the whitelist / blacklists in addition to the default 'http://pi.hole/admin/' address
|
||||
|
|
12
start.sh
12
start.sh
|
@ -10,10 +10,16 @@ export HOSTNAME
|
|||
export WEBLOGDIR
|
||||
export DNS1
|
||||
export DNS2
|
||||
export DNSSEC
|
||||
export DNS_BOGUS_PRIV
|
||||
export INTERFACE
|
||||
export DNSMASQ_LISTENING_BEHAVIOUR="$DNSMASQ_LISTENING"
|
||||
export IPv6
|
||||
export WEB_PORT
|
||||
export CONDITIONAL_FORWARDING
|
||||
export CONDITIONAL_FORWARDING_IP
|
||||
export CONDITIONAL_FORWARDING_DOMAIN
|
||||
export CONDITIONAL_FORWARDING_REVERSE
|
||||
|
||||
export adlistFile='/etc/pihole/adlists.list'
|
||||
|
||||
|
@ -40,6 +46,12 @@ validate_env || exit 1
|
|||
prepare_configs
|
||||
change_setting "IPV4_ADDRESS" "$ServerIP"
|
||||
change_setting "IPV6_ADDRESS" "$ServerIPv6"
|
||||
change_setting "DNS_BOGUS_PRIV" "$DNS_BOGUS_PRIV"
|
||||
change_setting "DNSSEC" "$DNSSEC"
|
||||
change_setting "CONDITIONAL_FORWARDING" "$CONDITIONAL_FORWARDING"
|
||||
change_setting "CONDITIONAL_FORWARDING_IP" "$CONDITIONAL_FORWARDING_IP"
|
||||
change_setting "CONDITIONAL_FORWARDING_DOMAIN" "$CONDITIONAL_FORWARDING_DOMAIN"
|
||||
change_setting "CONDITIONAL_FORWARDING_REVERSE" "$CONDITIONAL_FORWARDING_REVERSE"
|
||||
setup_web_port "$WEB_PORT"
|
||||
setup_web_password "$WEBPASSWORD"
|
||||
setup_dnsmasq "$DNS1" "$DNS2" "$INTERFACE" "$DNSMASQ_LISTENING_BEHAVIOUR"
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import print_function
|
||||
import pytest
|
||||
import testinfra
|
||||
import os
|
||||
|
@ -41,7 +42,7 @@ def DockerGeneric(request, _test_args, _args, _image, _cmd, _entrypoint):
|
|||
docker_run = 'docker run -d -t {args} {test_args} {entry} {image} {cmd}'\
|
||||
.format(args=_args, test_args=_test_args, entry=_entrypoint, image=_image, cmd=_cmd)
|
||||
# Print a human runable version of the container run command for faster debugging
|
||||
print docker_run.replace('-d -t', '--rm -it').replace('tail -f /dev/null', 'bash')
|
||||
print(docker_run.replace('-d -t', '--rm -it').replace('tail -f /dev/null', 'bash'))
|
||||
docker_id = check_output(docker_run)
|
||||
|
||||
def teardown():
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import print_function
|
||||
import os
|
||||
import pytest
|
||||
import re
|
||||
|
@ -197,5 +198,5 @@ def test_webPassword_pre_existing_trumps_all_envs(Docker, args_env, test_args):
|
|||
def test_docker_checks_for_resolvconf_misconfiguration(Docker, args_dns, expected_stdout):
|
||||
''' The container checks for misconfigured resolv.conf '''
|
||||
function = Docker.run('. /bash_functions.sh ; eval `grep docker_checks /start.sh`')
|
||||
print function.stdout
|
||||
print(function.stdout)
|
||||
assert expected_stdout in function.stdout
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import print_function
|
||||
import pytest
|
||||
import time
|
||||
''' conftest.py provides the defaults through fixtures '''
|
||||
|
@ -44,10 +45,10 @@ def test_indecies_are_present(RunningPiHole):
|
|||
|
||||
def validate_curl(http_rc, expected_http_code, page_contents):
|
||||
if int(http_rc.rc) != 0 or int(http_rc.stdout) != expected_http_code:
|
||||
print 'CURL return code: {}'.format(http_rc.rc)
|
||||
print 'CURL stdout: {}'.format(http_rc.stdout)
|
||||
print 'CURL stderr:{}'.format(http_rc.stderr)
|
||||
print 'CURL file:\n{}\n'.format(page_contents.encode('utf-8'))
|
||||
print('CURL return code: {}'.format(http_rc.rc))
|
||||
print('CURL stdout: {}'.format(http_rc.stdout))
|
||||
print('CURL stderr:{}'.format(http_rc.stderr))
|
||||
print('CURL file:\n{}\n'.format(page_contents.encode('utf-8')))
|
||||
|
||||
|
||||
@pytest.mark.parametrize('addr', [ 'localhost' ] )
|
||||
|
|
Loading…
Reference in New Issue
Block a user