Compare commits
627 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
72634fcbc2 | ||
|
|
f2a84ce3dc | ||
|
|
66aeeb8542 | ||
|
|
f2d42a5b40 | ||
|
|
62ca934d07 | ||
|
|
cbe61e0b44 | ||
|
|
b7a1e924ed | ||
|
|
40224be544 | ||
|
|
4acba89c3e | ||
|
|
0f3f8fb571 | ||
|
|
4f5330f8f0 | ||
|
|
08837c5dcb | ||
|
|
6830b99e4a | ||
|
|
b9df80b1ee | ||
|
|
1970ffd97d | ||
|
|
4fe91be9c9 | ||
|
|
fc99c98f30 | ||
|
|
e75e3800a2 | ||
|
|
970c45c950 | ||
|
|
e7e9004ac2 | ||
|
|
2c963a0f01 | ||
|
|
1d59f257ff | ||
|
|
318720fab9 | ||
|
|
74dec72bbb | ||
|
|
eb5c86ed3e | ||
|
|
d6dde5a1fd | ||
|
|
13c45454dd | ||
|
|
c82c33b5a3 | ||
|
|
6edd1fd494 | ||
|
|
84a497038d | ||
|
|
49062e17f1 | ||
|
|
7863fe5016 | ||
|
|
611df9b3f0 | ||
|
|
7e817b9360 | ||
|
|
2ebefaab12 | ||
|
|
970bc62836 | ||
|
|
e13586aa1e | ||
|
|
64c31b8374 | ||
|
|
7e69551be1 | ||
|
|
8a294e875f | ||
|
|
faf8e29751 | ||
|
|
39021c66f9 | ||
|
|
a957aba602 | ||
|
|
50efb1f50c | ||
|
|
c784963b83 | ||
|
|
2f0fc391c4 | ||
|
|
0ec6f866cd | ||
|
|
33bae3207f | ||
|
|
9fd7719638 | ||
|
|
b86db0fc3f | ||
|
|
795af5f87a | ||
|
|
d0b6c21f8f | ||
|
|
8153363b2d | ||
|
|
8fae8a1fdc | ||
|
|
d038a96f5c | ||
|
|
855086caa7 | ||
|
|
c3a4a832dd | ||
|
|
aacc3efc93 | ||
|
|
543adf1f64 | ||
|
|
b1c2555528 | ||
|
|
afdb7a110d | ||
|
|
4e6bc66ce5 | ||
|
|
bb99fae517 | ||
|
|
a6d0e49ed1 | ||
|
|
4399f41473 | ||
|
|
dba2235c8d | ||
|
|
b71bec2266 | ||
|
|
05bf32abda | ||
|
|
f17898bf6f | ||
|
|
1900d567c9 | ||
|
|
b7016668b4 | ||
|
|
1c369e3dea | ||
|
|
96332db038 | ||
|
|
60e252c414 | ||
|
|
cb16942096 | ||
|
|
29f81fcfbc | ||
|
|
b3717000ae | ||
|
|
5b0ea12766 | ||
|
|
64e449c133 | ||
|
|
6b9a4e6216 | ||
|
|
67fc925153 | ||
|
|
f9d990145a | ||
|
|
9f9010edaa | ||
|
|
20e51e77da | ||
|
|
1570a7682e | ||
|
|
8cedb5b030 | ||
|
|
0e7013e890 | ||
|
|
c7d1fe5e82 | ||
|
|
bd3a69e056 | ||
|
|
6d894a3f34 | ||
|
|
f246384bb3 | ||
|
|
62c1fee49a | ||
|
|
33baaa4bb0 | ||
|
|
6037832d5d | ||
|
|
725711c9aa | ||
|
|
820c4818e9 | ||
|
|
287c45a624 | ||
|
|
ab6bdd7e77 | ||
|
|
f7c4053179 | ||
|
|
d083079b17 | ||
|
|
6d3ab13a4d | ||
|
|
ad9d7cb710 | ||
|
|
2079c6adce | ||
|
|
6e36311d6f | ||
|
|
08627a1ba7 | ||
|
|
f1c5662265 | ||
|
|
3d27c94595 | ||
|
|
c4542d651d | ||
|
|
c4b105853c | ||
|
|
84766ff1cb | ||
|
|
89480b1e9d | ||
|
|
99b43a8795 | ||
|
|
e1dc289d7d | ||
|
|
59b3ae999f | ||
|
|
ebbbdae2df | ||
|
|
93e7daddc1 | ||
|
|
2afb0fc703 | ||
|
|
a88124acdd | ||
|
|
f6d6a31743 | ||
|
|
f3260fb0f9 | ||
|
|
4b9e142d54 | ||
|
|
fedf69beeb | ||
|
|
12ded16443 | ||
|
|
edd67d73c5 | ||
|
|
d52eaaa622 | ||
|
|
b0878f1750 | ||
|
|
bcbbdb7a58 | ||
|
|
509ca4b39a | ||
|
|
95f0eeea00 | ||
|
|
a4cb3cf0ca | ||
|
|
1723f8d5ca | ||
|
|
10c960dd92 | ||
|
|
4fa8bbe04c | ||
|
|
1630116ecb | ||
|
|
c1ea9dac8c | ||
|
|
709210291d | ||
|
|
51cffa7e56 | ||
|
|
f6947f1497 | ||
|
|
18e2e11541 | ||
|
|
0db0df5231 | ||
|
|
a84ede1a5f | ||
|
|
5bae002db3 | ||
|
|
cc079aa198 | ||
|
|
60241e3f9a | ||
|
|
ce75910d28 | ||
|
|
b76ffa4e67 | ||
|
|
6b9abc23a0 | ||
|
|
279b206cdd | ||
|
|
321b89e1a6 | ||
|
|
e510bb7588 | ||
|
|
70bad9f08f | ||
|
|
5df71380b7 | ||
|
|
4dc9504330 | ||
|
|
658658ebc9 | ||
|
|
91432ada4d | ||
|
|
f1a4bb8584 | ||
|
|
af0af5a59a | ||
|
|
7a1546c001 | ||
|
|
2ec62a3e9b | ||
|
|
54f56a717e | ||
|
|
5d8fd599bf | ||
|
|
ecb0a8c87b | ||
|
|
72b1c8679c | ||
|
|
3cb043eb10 | ||
|
|
c31599c403 | ||
|
|
41c1596915 | ||
|
|
f8cc0878e1 | ||
|
|
a485e238ca | ||
|
|
ca315e4ee9 | ||
|
|
cf06b7ead3 | ||
|
|
086dd6cc86 | ||
|
|
946dc195e8 | ||
|
|
ee20e52d75 | ||
|
|
b5e656491e | ||
|
|
099f81b2d2 | ||
|
|
99dc2e0952 | ||
|
|
2bfc7f57de | ||
|
|
1221d91685 | ||
|
|
06232c767e | ||
|
|
442d181925 | ||
|
|
109879ae6c | ||
|
|
3aee0e1eaf | ||
|
|
d46a1e3356 | ||
|
|
fb112ce1bf | ||
|
|
06569a5bcd | ||
|
|
1c24b96048 | ||
|
|
e4a1abb5fb | ||
|
|
ae5a5afdc5 | ||
|
|
0897c1e418 | ||
|
|
c8179fa62c | ||
|
|
e6cde29cc1 | ||
|
|
e459169d8a | ||
|
|
1b35e7fdd4 | ||
|
|
90f4ebe882 | ||
|
|
6b5f746a15 | ||
|
|
2a705ecfe9 | ||
|
|
5b41b63fa0 | ||
|
|
0a7427371e | ||
|
|
5efcd88b20 | ||
|
|
fd0b9bf9d3 | ||
|
|
a42f67f5ee | ||
|
|
89b03445a1 | ||
|
|
13c81a9091 | ||
|
|
3d6f53899f | ||
|
|
69d4349bbb | ||
|
|
1d51da7f47 | ||
|
|
351b9a7f85 | ||
|
|
19bb9dcc2f | ||
|
|
2db09515d7 | ||
|
|
06d6b74c63 | ||
|
|
140312b79c | ||
|
|
e6dd028c61 | ||
|
|
1f3951431b | ||
|
|
a29faad9df | ||
|
|
2eb9afc350 | ||
|
|
25539a9c99 | ||
|
|
778e993903 | ||
|
|
510ca0b873 | ||
|
|
eed203530e | ||
|
|
fe1676b9ed | ||
|
|
c2870031e3 | ||
|
|
0ecde45d22 | ||
|
|
2cec4fa719 | ||
|
|
b29ac1ec18 | ||
|
|
0a20ef8955 | ||
|
|
13a3da65c8 | ||
|
|
b901a899ae | ||
|
|
9436389095 | ||
|
|
6262433f4d | ||
|
|
e0f05ef372 | ||
|
|
2fb2202a17 | ||
|
|
c6e859723c | ||
|
|
69e9272a91 | ||
|
|
6e9790870c | ||
|
|
0baf7b63d9 | ||
|
|
5e79db52ab | ||
|
|
0018e46a28 | ||
|
|
25a8e0dcba | ||
|
|
74707b576c | ||
|
|
9deb685cc0 | ||
|
|
28892f4533 | ||
|
|
4cc3587084 | ||
|
|
2567ab9940 | ||
|
|
6b29503dd0 | ||
|
|
806f734cdc | ||
|
|
2c6bc33e8d | ||
|
|
2a7ea09d00 | ||
|
|
a5eda6844e | ||
|
|
44bdfc1438 | ||
|
|
0eb1a60d78 | ||
|
|
8ea5f9c8dc | ||
|
|
2dde4a64c9 | ||
|
|
3f97e6e4fc | ||
|
|
b0a5a0f163 | ||
|
|
523762e47d | ||
|
|
7848d06325 | ||
|
|
54ca7e9ce4 | ||
|
|
9a9ee41a45 | ||
|
|
f70a4f4022 | ||
|
|
7049b5df03 | ||
|
|
4aaf0998a3 | ||
|
|
27bdf81665 | ||
|
|
ff776c2ba4 | ||
|
|
e874dc1f3e | ||
|
|
c0d05f291d | ||
|
|
a39726d183 | ||
|
|
5ed8b8ec7b | ||
|
|
aefeb2bc8d | ||
|
|
4782f15123 | ||
|
|
73a335533b | ||
|
|
d036e0d0c0 | ||
|
|
3696f6065f | ||
|
|
9740d2b86a | ||
|
|
1b6318c0d9 | ||
|
|
c371768800 | ||
|
|
bc545b6049 | ||
|
|
3942d9a740 | ||
|
|
944bc8eb79 | ||
|
|
55a682a94c | ||
|
|
7624fc3d56 | ||
|
|
9b106e6275 | ||
|
|
17453166c2 | ||
|
|
521bed1c4f | ||
|
|
1cc3159518 | ||
|
|
ca69e29514 | ||
|
|
b553462c95 | ||
|
|
155d87f8c1 | ||
|
|
6cec6f937f | ||
|
|
1a7bfdc2ee | ||
|
|
d84851c7a3 | ||
|
|
f0f96ee1ab | ||
|
|
9a800f7efd | ||
|
|
52b21c6ef6 | ||
|
|
0cceed3c83 | ||
|
|
300fcf0c9e | ||
|
|
ec3b4609bc | ||
|
|
22ce49a123 | ||
|
|
d821dcb2f0 | ||
|
|
ef54216986 | ||
|
|
93092da023 | ||
|
|
3153346ec8 | ||
|
|
ee6e1b36a9 | ||
|
|
73ad23b3b6 | ||
|
|
8700afa74d | ||
|
|
1f19941b4c | ||
|
|
d69a8febae | ||
|
|
a26eb9c6ad | ||
|
|
2fcc4f66ee | ||
|
|
066f891cc1 | ||
|
|
f50ce4637f | ||
|
|
56f4933237 | ||
|
|
ea95c4f3e5 | ||
|
|
88518b036d | ||
|
|
eb36372dea | ||
|
|
3865e77c6e | ||
|
|
388f0f01a1 | ||
|
|
6c3ccfcd4f | ||
|
|
bdaf352a23 | ||
|
|
55b257126b | ||
|
|
1f1dc03a69 | ||
|
|
2b2e05dce3 | ||
|
|
451fc19432 | ||
|
|
8d536703d9 | ||
|
|
58e1eac241 | ||
|
|
91d75416b8 | ||
|
|
e65890208b | ||
|
|
559b317148 | ||
|
|
92999dff08 | ||
|
|
1c6ba2d3c7 | ||
|
|
a45725ed37 | ||
|
|
e98dff970f | ||
|
|
e674bb4b81 | ||
|
|
6820b2e55c | ||
|
|
cec28c79f4 | ||
|
|
a44b7f1205 | ||
|
|
bf82c2e8f5 | ||
|
|
73f1cb3e74 | ||
|
|
8565c3828d | ||
|
|
d0e6b77fdb | ||
|
|
b5046af667 | ||
|
|
408f71a480 | ||
|
|
7650896158 | ||
|
|
4dba6339c7 | ||
|
|
ba9d2e54bf | ||
|
|
d13ae118b4 | ||
|
|
7d82719839 | ||
|
|
70c573b69e | ||
|
|
bd121aa471 | ||
|
|
28b5154e52 | ||
|
|
918e6b1a21 | ||
|
|
9292d8e58a | ||
|
|
76be304d79 | ||
|
|
0c5ffd72f4 | ||
|
|
3022fa5092 | ||
|
|
2bc1e9c5cb | ||
|
|
f95bcba67a | ||
|
|
437e8ddbf5 | ||
|
|
901ee3d10b | ||
|
|
5ed2b9ab2c | ||
|
|
6b1765c638 | ||
|
|
67b04365c5 | ||
|
|
39fa779653 | ||
|
|
2484c9ced2 | ||
|
|
c4caf293f7 | ||
|
|
d0c152eb25 | ||
|
|
995ec08608 | ||
|
|
504f3bac3b | ||
|
|
99de0dce83 | ||
|
|
58d2c6a934 | ||
|
|
0954c9f3dd | ||
|
|
c436a8a053 | ||
|
|
3acf505a1a | ||
|
|
60063a81fd | ||
|
|
4963578fb5 | ||
|
|
e64b1d0c0a | ||
|
|
73378d1231 | ||
|
|
47c15eb65d | ||
|
|
fcd002d507 | ||
|
|
bd343fc3da | ||
|
|
1f46ed4cbe | ||
|
|
3db66a66fa | ||
|
|
622294a7a1 | ||
|
|
70ae3baf75 | ||
|
|
2b270c75b7 | ||
|
|
1ff3d7a5fc | ||
|
|
35b5c80408 | ||
|
|
59e177525a | ||
|
|
27135f263f | ||
|
|
ac444c44f2 | ||
|
|
96408f91a7 | ||
|
|
151d588c4c | ||
|
|
071b169896 | ||
|
|
f9c51379b0 | ||
|
|
42f1fa3380 | ||
|
|
5ca1dbf35f | ||
|
|
ebe72b45e4 | ||
|
|
c36d6ae501 | ||
|
|
2e04f5abee | ||
|
|
17f6ef8e56 | ||
|
|
c9a3ac0df1 | ||
|
|
784be64178 | ||
|
|
82ef6544a4 | ||
|
|
59c08f36ee | ||
|
|
dba2317072 | ||
|
|
4b7c35be7e | ||
|
|
f6b9716a75 | ||
|
|
14e3bcb480 | ||
|
|
e88429a65d | ||
|
|
4f531d9e78 | ||
|
|
87c99a0b8c | ||
|
|
6f865b1699 | ||
|
|
ba6f7f9d62 | ||
|
|
1207b5cb88 | ||
|
|
1633a976a4 | ||
|
|
fa771f74fd | ||
|
|
6f21b020f8 | ||
|
|
6292fd1294 | ||
|
|
68ad7b045d | ||
|
|
fe7f0c8612 | ||
|
|
692a12c2c6 | ||
|
|
731cd5e907 | ||
|
|
e6a45eb96b | ||
|
|
f53015157d | ||
|
|
190844d0b0 | ||
|
|
6532390647 | ||
|
|
26aea62e22 | ||
|
|
ededb44601 | ||
|
|
c0e55c156f | ||
|
|
6d9913e824 | ||
|
|
20cd9c3abf | ||
|
|
e6307df638 | ||
|
|
14f6262491 | ||
|
|
bcd9ad5157 | ||
|
|
6e1e93112d | ||
|
|
5acc88ef86 | ||
|
|
8d57c8ce7b | ||
|
|
ea7f659874 | ||
|
|
abdf9f1130 | ||
|
|
75328c63f8 | ||
|
|
3f0a7d85b1 | ||
|
|
c5484e6a85 | ||
|
|
dad930f9d2 | ||
|
|
b39f53d12e | ||
|
|
a51f69bef9 | ||
|
|
0669b0fe91 | ||
|
|
3d42c16217 | ||
|
|
6b6ba9b458 | ||
|
|
c23b1d6894 | ||
|
|
29cf35b2c5 | ||
|
|
8cf36e6f7e | ||
|
|
7adccc0287 | ||
|
|
7c135f5ce8 | ||
|
|
79ead80720 | ||
|
|
302924a3e2 | ||
|
|
0a8d174ef7 | ||
|
|
5735495ec7 | ||
|
|
512f610afa | ||
|
|
e40ed3b5cc | ||
|
|
c5f682d1e7 | ||
|
|
4902b4cc6a | ||
|
|
0f618ffc31 | ||
|
|
91fd3933aa | ||
|
|
c75ca906e7 | ||
|
|
494667c85d | ||
|
|
9bcd8e163a | ||
|
|
b154947cb9 | ||
|
|
1d35a336b4 | ||
|
|
0d9fc510cf | ||
|
|
1aefa3b063 | ||
|
|
39090babf5 | ||
|
|
8f53e1bd22 | ||
|
|
64a1f548ef | ||
|
|
5c21f146f4 | ||
|
|
99b6dc9503 | ||
|
|
a445507627 | ||
|
|
f445660079 | ||
|
|
c0bf6c91f6 | ||
|
|
a6eaf7313c | ||
|
|
5dbf46aa05 | ||
|
|
6ef8ef1f15 | ||
|
|
7485a84d2d | ||
|
|
e6bff1ac32 | ||
|
|
f1cc22e5e0 | ||
|
|
325c49f7b3 | ||
|
|
0cb7324a60 | ||
|
|
f77e4609ce | ||
|
|
b0a14b7eb9 | ||
|
|
c525df56fa | ||
|
|
02a28b25ae | ||
|
|
9bdfe868bd | ||
|
|
5d1d394b1b | ||
|
|
8c62a1437a | ||
|
|
89972b3ce5 | ||
|
|
90dada0a8a | ||
|
|
121f3f92c9 | ||
|
|
ee42fdae04 | ||
|
|
b669826149 | ||
|
|
105eb1165f | ||
|
|
941e433834 | ||
|
|
e7bfad6301 | ||
|
|
1c421b0f7c | ||
|
|
72a1c8290d | ||
|
|
f1d4efe766 | ||
|
|
7792b91ccc | ||
|
|
9a94ade8dd | ||
|
|
c90f3c5aa5 | ||
|
|
352bb55f4c | ||
|
|
2bd15dea8f | ||
|
|
e67952eaec | ||
|
|
fa065c2434 | ||
|
|
e64f2d682b | ||
|
|
30bf5fe0d1 | ||
|
|
8ba1eea803 | ||
|
|
9324107088 | ||
|
|
2c7be7c3cb | ||
|
|
1f64381ebb | ||
|
|
a779c7fc37 | ||
|
|
87132465b5 | ||
|
|
97d00cd936 | ||
|
|
5a35eca5e2 | ||
|
|
6e5bf71595 | ||
|
|
a9f423ff37 | ||
|
|
a30bd0528f | ||
|
|
8770b9789b | ||
|
|
7248b3c915 | ||
|
|
e15017d69a | ||
|
|
52e819a975 | ||
|
|
7199d938e1 | ||
|
|
93b86c8981 | ||
|
|
daa3c1e45c | ||
|
|
41f109cf48 | ||
|
|
fda66e2f67 | ||
|
|
54e5846c16 | ||
|
|
bba93dea3e | ||
|
|
d96a7fe887 | ||
|
|
28bec77984 | ||
|
|
9c791f099f | ||
|
|
6fc9d4d186 | ||
|
|
7ad7b0824f | ||
|
|
c8781ee427 | ||
|
|
51daf5cba2 | ||
|
|
8e5b17e7d3 | ||
|
|
562b6c1d5a | ||
|
|
0b2c4642df | ||
|
|
1b4677b5ed | ||
|
|
0958583bf2 | ||
|
|
b50e94e22d | ||
|
|
bb8a8aeedd | ||
|
|
d49eebc25d | ||
|
|
4808b9fe8d | ||
|
|
88fd258043 | ||
|
|
752d83aeaa | ||
|
|
3b8227c29d | ||
|
|
25d32da895 | ||
|
|
022b039718 | ||
|
|
d832213e3c | ||
|
|
765eccea22 | ||
|
|
3b34fecc41 | ||
|
|
9213bbd322 | ||
|
|
5b75953d91 | ||
|
|
ce3d6e866e | ||
|
|
b093aaabd9 | ||
|
|
e7bb456701 | ||
|
|
ecb0aaf805 | ||
|
|
55ee5d0e60 | ||
|
|
72f5730d56 | ||
|
|
0da5afcd61 | ||
|
|
e621670df4 | ||
|
|
04ab6d447f | ||
|
|
92c19555bd | ||
|
|
caad778b0c | ||
|
|
808359e832 | ||
|
|
8e409bdf6f | ||
|
|
bd831bcc30 | ||
|
|
d7fdb188ed | ||
|
|
a5b827917e | ||
|
|
6939ea024f | ||
|
|
c619303a30 | ||
|
|
cecf602df7 | ||
|
|
8cb67fde23 | ||
|
|
740248f18b | ||
|
|
bb292a301c | ||
|
|
a1300b4c01 | ||
|
|
3140814a30 | ||
|
|
441bc67159 | ||
|
|
59753e30a3 | ||
|
|
edde439023 | ||
|
|
34ef3d4d86 | ||
|
|
0a4c0af9a2 | ||
|
|
eb637e07cc | ||
|
|
e78260cf8b | ||
|
|
6265a3c88f | ||
|
|
2c47cfa8c5 | ||
|
|
154272be8a | ||
|
|
d444a11ad1 | ||
|
|
ce10b7b655 | ||
|
|
032b53799d | ||
|
|
2228115a97 | ||
|
|
9778b5d9a4 | ||
|
|
415ccbb132 | ||
|
|
b9b8b1f8bd | ||
|
|
3c510e2edb | ||
|
|
36c1e66dc1 | ||
|
|
1b5abd4ad6 | ||
|
|
0f73f390a9 | ||
|
|
e0e6b491c9 | ||
|
|
e6a9cd5ce2 | ||
|
|
931aad4cb1 | ||
|
|
64892423b6 | ||
|
|
b39a6af9b5 | ||
|
|
db919a22cc | ||
|
|
18eb5ffbc8 | ||
|
|
a378a0f696 | ||
|
|
b74f50ba37 | ||
|
|
31132aa4ec | ||
|
|
5367761311 | ||
|
|
6091299fbf | ||
|
|
f523449d73 | ||
|
|
eb683cf043 | ||
|
|
8264a46ed5 | ||
|
|
fe545c6bb2 | ||
|
|
1dafcb6946 | ||
|
|
4c4e9c3bc9 | ||
|
|
e92dfcfa38 | ||
|
|
c88f12a351 | ||
|
|
6e38238dc1 | ||
|
|
b5356568d5 |
@@ -1,65 +0,0 @@
|
||||
version: 2
|
||||
|
||||
.job_template: &job_template
|
||||
machine:
|
||||
enabled: true
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
command: ./circle-test.sh
|
||||
- persist_to_workspace:
|
||||
root: .
|
||||
paths: [ 'ci-workspace' ]
|
||||
|
||||
jobs:
|
||||
amd64:
|
||||
<<: *job_template
|
||||
arm64:
|
||||
<<: *job_template
|
||||
armhf:
|
||||
<<: *job_template
|
||||
armel:
|
||||
<<: *job_template
|
||||
deploy:
|
||||
docker:
|
||||
- image: circleci/python:latest
|
||||
steps:
|
||||
- setup_remote_docker:
|
||||
version: 18.06.0-ce
|
||||
- checkout
|
||||
- attach_workspace:
|
||||
at: .
|
||||
- run:
|
||||
command: ./circle-deploy.sh
|
||||
|
||||
|
||||
|
||||
workflows:
|
||||
version: 2
|
||||
build:
|
||||
jobs:
|
||||
- amd64:
|
||||
filters:
|
||||
tags:
|
||||
only: /^v.*/
|
||||
- arm64:
|
||||
filters:
|
||||
tags:
|
||||
only: /^v.*/
|
||||
- armhf:
|
||||
filters:
|
||||
tags:
|
||||
only: /^v.*/
|
||||
- armel:
|
||||
filters:
|
||||
tags:
|
||||
only: /^v.*/
|
||||
- deploy:
|
||||
requires:
|
||||
- amd64
|
||||
- arm64
|
||||
- armhf
|
||||
- armel
|
||||
filters:
|
||||
tags:
|
||||
only: /^v.*/
|
||||
52
.github/ISSUE_TEMPLATE.md
vendored
52
.github/ISSUE_TEMPLATE.md
vendored
@@ -1,52 +0,0 @@
|
||||
<!-- Provide a general summary of the issue in the Title above -->
|
||||
<!-- Note: these are comments that don't show up in the actual issue, no need to delete them as you fill out the template -->
|
||||
|
||||
This is a... <!-- To choose ONE, put an [x] in the box that applies -->
|
||||
|
||||
- [ ] Request for a new or modified feature
|
||||
- [ ] Issue trying to run the docker image
|
||||
- [ ] Issue trying to build / test / develop the docker image
|
||||
|
||||
## Description
|
||||
<!-- Provide a more detailed introduction to the issue or feature -->
|
||||
|
||||
## Expected Behavior
|
||||
<!-- Tell us what should happen -->
|
||||
|
||||
## Actual Behavior
|
||||
<!-- Tell us what happens instead -->
|
||||
|
||||
## Possible Fix
|
||||
<!-- Not obligatory, but suggest a fix or reason for the bug -->
|
||||
|
||||
## Steps to Reproduce and debugging done
|
||||
<!-- Reproduce this bug. Include code to reproduce, if relevant -->
|
||||
e.g. your docker run command, pages to visit, CLI commands you ran
|
||||
1.
|
||||
2.
|
||||
3.
|
||||
4.
|
||||
|
||||
## Debug steps I have tried
|
||||
<!-- Please attempt these debug steps to see if it helps you resolve or understand your own issue -->
|
||||
|
||||
- [ ] I have tried destroying my container instance, pulling the newest image version, and re-creating a new container
|
||||
- [ ] I have tried running the nearly stock `docker run` example in the readme (removing any customizations I added)
|
||||
- [ ] I have tried running without my volume data mounts to eliminate volumes as the cause
|
||||
- [ ] I have searched this repository for existing issues and pull requests that look similar <!-- Add links below! -->
|
||||
|
||||
<!-- Note: If volumes are your issue, I strongly recommend just starting with fresh volume data -->
|
||||
|
||||
<!-- Add any other debugging steps you've taken that maybe relevant information -->
|
||||
|
||||
## Context and extra information
|
||||
<!-- How has this bug affected you? What were you trying to accomplish? -->
|
||||
<!-- Got any other relevant links to similar issues? -->
|
||||
|
||||
## Your Environment
|
||||
<!--- Include as many relevant details about the environment you experienced the bug in -->
|
||||
* Docker Host Operating System and OS Version:
|
||||
* Docker Version:
|
||||
* Hardware architecture: <!-- ARMv7, x86 -->
|
||||
|
||||
|
||||
57
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
57
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
<!-- Provide a general summary of the issue in the Title above -->
|
||||
<!-- Note: these are comments that don't show up in the actual issue, no need to delete them as you fill out the template -->
|
||||
|
||||
<!-- IMPORTANT Complete the entire template please, the info gathered here is usually needed to debug issues anyway so it saves time in the long run. Incomplete/stock template issues may be closed -->
|
||||
|
||||
<!-- pick ONE: Bug,
|
||||
Feature Request,
|
||||
Run Issue (running Pi-hole container failing),
|
||||
Build Issue (Building image failing)
|
||||
Enter in line below: -->
|
||||
This is a: **FILL ME IN**
|
||||
|
||||
|
||||
## Details
|
||||
<!-- Provide a more detailed introduction to the issue or feature, try not to duplicate info from lower sections by reviewing the entire template first -->
|
||||
|
||||
## Related Issues
|
||||
- [ ] I have searched this repository/Pi-hole forums for existing issues and pull requests that look similar
|
||||
<!-- Add links below! -->
|
||||
|
||||
<!------- FEATURE REQUESTS CAN STOP FILLING IN TEMPLATE HERE -------->
|
||||
<!------- ISSUES SHOULD FILL OUT REMAINDER OF TEMPLATE -------->
|
||||
|
||||
## How to reproduce the issue
|
||||
|
||||
1. Environment data
|
||||
* Operating System: **ENTER HERE** <!-- Debian, Ubuntu, Rasbian, etc -->
|
||||
* Hardware: <!-- PC, RasPi B/2B/3B/4B, Mac, Synology, QNAP, etc -->
|
||||
* Kernel Architecture: <!-- x86/amd64, ArmV7, ArmV8 32bit, ArmV8 64bit, etc -->
|
||||
* Docker Install Info and version:
|
||||
- Software source: <!-- official docker-ce, OS provided package, Hypriot -->
|
||||
- Supplimentary Software: <!-- synology, portainer, etc -->
|
||||
* Hardware architecture: <!-- ARMv7, x86 -->
|
||||
|
||||
2. docker-compose.yml contents, docker run shell command, or paste a screenshot of any UI based configuration of containers here
|
||||
3. any additional info to help reproduce
|
||||
|
||||
|
||||
## These common fixes didn't work for my issue
|
||||
<!-- IMPORTANT! Help me help you! Ordered with most common fixes first. -->
|
||||
- [ ] I have tried removing/destroying my container, and re-creating a new container
|
||||
- [ ] I have tried fresh volume data by backing up and moving/removing the old volume data
|
||||
- [ ] I have tried running the stock `docker run` example(s) in the readme (removing any customizations I added)
|
||||
- [ ] I have tried a newer or older version of Docker Pi-hole (depending what version the issue started in for me)
|
||||
- [ ] I have tried running without my volume data mounts to eliminate volumes as the cause
|
||||
|
||||
If the above debugging / fixes revealed any new information note it here.
|
||||
Add any other debugging steps you've taken or theories on root cause that may help.
|
||||
12
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
12
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: Questions and Configurations
|
||||
url: https://discourse.pi-hole.net
|
||||
about: Ask a question or get help with configurations.
|
||||
- name: Feature Requests
|
||||
url: https://discourse.pi-hole.net/c/feature-requests/8
|
||||
about: See existing Feature Requests and suggest new ones.
|
||||
- name: Documentation
|
||||
url: https://docs.pi-hole.net
|
||||
about: Documentation and guides.
|
||||
|
||||
2
.github/PULL_REQUEST_TEMPLATE.md
vendored
2
.github/PULL_REQUEST_TEMPLATE.md
vendored
@@ -1,3 +1,5 @@
|
||||
`{Please select 'base: dev' as target branch above! (you can delete this line)}`
|
||||
|
||||
<!--- Provide a general summary of your changes in the Title above -->
|
||||
|
||||
## Description
|
||||
|
||||
2
.github/dco.yml
vendored
Normal file
2
.github/dco.yml
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
require:
|
||||
members: false
|
||||
7
.github/dependabot.yml
vendored
Normal file
7
.github/dependabot.yml
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
version: 2
|
||||
updates:
|
||||
# Maintain dependencies for GitHub Actions
|
||||
- package-ecosystem: "github-actions"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
7
.github/release.yml
vendored
Normal file
7
.github/release.yml
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
changelog:
|
||||
exclude:
|
||||
labels:
|
||||
- internal
|
||||
authors:
|
||||
- dependabot
|
||||
- github-actions
|
||||
18
.github/workflows/codespell.yml
vendored
Normal file
18
.github/workflows/codespell.yml
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
name: Codespell
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, synchronize, reopened, ready_for_review]
|
||||
|
||||
jobs:
|
||||
spell-check:
|
||||
if: github.event.pull_request.draft == false
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
-
|
||||
name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
-
|
||||
name: Spell-Checking
|
||||
uses: codespell-project/actions-codespell@master
|
||||
with:
|
||||
ignore_words_file: .codespellignore
|
||||
26
.github/workflows/stale.yml
vendored
Normal file
26
.github/workflows/stale.yml
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
name: Mark stale issues
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 8 * * *'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
stale:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
issues: write
|
||||
|
||||
steps:
|
||||
- uses: actions/stale@v5
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
days-before-stale: 30
|
||||
days-before-close: 5
|
||||
stale-issue-message: 'This issue is stale because it has been open 30 days with no activity. Please comment or update this issue or it will be closed in 5 days.'
|
||||
stale-issue-label: 'stale'
|
||||
exempt-issue-labels: 'pinned, Fixed in next release, bug, never-stale, documentation, investigating'
|
||||
exempt-all-issue-assignees: true
|
||||
operations-per-run: 300
|
||||
close-issue-reason: 'not_planned'
|
||||
27
.github/workflows/sync-back-to-dev.yml
vendored
Normal file
27
.github/workflows/sync-back-to-dev.yml
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
name: Sync Back to Development
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
sync-branches:
|
||||
runs-on: ubuntu-latest
|
||||
name: Syncing branches
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
- name: Opening pull request
|
||||
id: pull
|
||||
uses: tretuna/sync-branches@1.4.0
|
||||
with:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
FROM_BRANCH: 'master'
|
||||
TO_BRANCH: 'dev'
|
||||
- name: Label the pull request to ignore for release note generation
|
||||
uses: actions-ecosystem/action-add-labels@v1
|
||||
with:
|
||||
labels: internal
|
||||
repo: ${{ github.repository }}
|
||||
number: ${{ steps.pull.outputs.PULL_REQUEST_NUMBER }}
|
||||
83
.github/workflows/test-and-build.yaml
vendored
Normal file
83
.github/workflows/test-and-build.yaml
vendored
Normal file
@@ -0,0 +1,83 @@
|
||||
name: Test & Build
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 2 * * *'
|
||||
push:
|
||||
branches:
|
||||
- dev
|
||||
pull_request:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Repo
|
||||
uses: actions/checkout@v3
|
||||
- name: Run Tests
|
||||
run: |
|
||||
echo "Building image to test"
|
||||
./build-and-test.sh
|
||||
|
||||
build-and-publish:
|
||||
if: github.event_name != 'pull_request'
|
||||
# If only readme has been touched, for example, then the `test` job will have been skipped. This job will therefore be skipped, too.
|
||||
needs: test
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
if: github.event_name != 'schedule'
|
||||
uses: actions/checkout@v3
|
||||
-
|
||||
name: Checkout dev branch if we are building nightly
|
||||
if: github.event_name == 'schedule'
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
ref: dev
|
||||
-
|
||||
name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
-
|
||||
name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
-
|
||||
name: Docker meta
|
||||
id: meta
|
||||
uses: docker/metadata-action@v4
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
images: |
|
||||
${{ secrets.DOCKERHUB_NAMESPACE }}/pihole
|
||||
ghcr.io/${{ github.repository_owner }}/pihole
|
||||
flavor: |
|
||||
latest=${{ startsWith(github.ref, 'refs/tags/') }}
|
||||
tags: |
|
||||
type=schedule
|
||||
type=ref,event=branch,enable=${{ github.event_name != 'schedule' }}
|
||||
type=ref,event=tag
|
||||
-
|
||||
name: Login to DockerHub
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USER }}
|
||||
password: ${{ secrets.DOCKERHUB_PASS }}
|
||||
-
|
||||
name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
-
|
||||
name: Build and push
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
context: ./src/
|
||||
platforms: linux/amd64, linux/arm64, linux/386, linux/arm/v7, linux/arm/v6
|
||||
build-args: |
|
||||
PIHOLE_DOCKER_TAG=${{ steps.meta.outputs.version }}
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
5
.gitignore
vendored
5
.gitignore
vendored
@@ -8,6 +8,11 @@ __pycache__
|
||||
UNKNOWN.egg-info
|
||||
.env
|
||||
ci-workspace
|
||||
.gh-workspace
|
||||
docker-compose.yml
|
||||
etc-dnsmasq.d/
|
||||
etc-pihole/
|
||||
var-log/
|
||||
|
||||
# WIP/test stuff
|
||||
doco.yml
|
||||
|
||||
@@ -2,4 +2,4 @@
|
||||
|
||||
Notes about releases will be documented on [docker-pi-hole's github releases page](https://github.com/pi-hole/docker-pi-hole/releases). Breaking changes will be copied to the top of the docker repo's README file to assist with common upgrade issues.
|
||||
|
||||
See the [Pi-hole releases](https://github.com/pi-hole/pi-hole/releases) for details on updates unreleated to docker image releases
|
||||
See the [Pi-hole releases](https://github.com/pi-hole/pi-hole/releases) for details on updates unrelated to docker image releases
|
||||
|
||||
@@ -6,5 +6,5 @@ Please review the following before opening a pull request (PR) to help your PR g
|
||||
* To ensure proper testing and quality control, target any code change pull requests against `dev` branch.
|
||||
|
||||
* Make sure the tests pass
|
||||
* Take a look at [TESTING.md](TESTING.md) to see how to run tests locally so you do not have to push all your code to a PR and have travis-ci run it.
|
||||
* Take a look at [TESTING.md](TESTING.md) to see how to run tests locally so you do not have to push all your code to a PR and have GitHub Actions run it.
|
||||
* Your tests will probably run faster locally and you get a faster feedback loop.
|
||||
|
||||
149
Dockerfile.py
149
Dockerfile.py
@@ -1,149 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
""" Dockerfile.py - generates and build dockerfiles
|
||||
|
||||
Usage:
|
||||
Dockerfile.py [--hub_tag=<tag>] [--arch=<arch> ...] [-v] [-t] [--no-build | --no-generate] [--no-cache]
|
||||
|
||||
Options:
|
||||
--no-build Skip building the docker images
|
||||
--no-cache Build without using any cache data
|
||||
--no-generate Skip generating Dockerfiles from template
|
||||
--hub_tag=<tag> What the Docker Hub Image should be tagged as [default: None]
|
||||
--arch=<arch> What Architecture(s) to build [default: amd64 armel armhf arm64]
|
||||
-v Print docker's command output [default: False]
|
||||
-t Print docker's build time [default: False]
|
||||
|
||||
Examples:
|
||||
"""
|
||||
|
||||
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
from docopt import docopt
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
THIS_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
base_vars = {
|
||||
'name': 'pihole/pihole',
|
||||
'maintainer' : 'adam@diginc.us',
|
||||
's6_version' : 'v1.22.1.0',
|
||||
}
|
||||
|
||||
os_base_vars = {
|
||||
'php_env_config': '/etc/lighttpd/conf-enabled/15-fastcgi-php.conf',
|
||||
'php_error_log': '/var/log/lighttpd/error.log'
|
||||
}
|
||||
|
||||
__version__ = None
|
||||
dot = os.path.abspath('.')
|
||||
with open('{}/VERSION'.format(dot), 'r') as v:
|
||||
raw_version = v.read().strip()
|
||||
__version__ = raw_version.replace('release/', 'release-')
|
||||
|
||||
images = {
|
||||
__version__: [
|
||||
{
|
||||
'base': 'pihole/debian-base:latest',
|
||||
'arch': 'amd64',
|
||||
's6arch': 'amd64',
|
||||
},
|
||||
{
|
||||
'base': 'multiarch/debian-debootstrap:armel-stretch-slim',
|
||||
'arch': 'armel',
|
||||
's6arch': 'arm',
|
||||
},
|
||||
{
|
||||
'base': 'multiarch/debian-debootstrap:armhf-stretch-slim',
|
||||
'arch': 'arm',
|
||||
's6arch' : 'arm',
|
||||
},
|
||||
{
|
||||
'base': 'multiarch/debian-debootstrap:arm64-stretch-slim',
|
||||
'arch': 'arm64',
|
||||
's6arch' : 'aarch64',
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
def generate_dockerfiles(args):
|
||||
if args['--no-generate']:
|
||||
print(" ::: Skipping Dockerfile generation")
|
||||
return
|
||||
|
||||
for version, archs in images.items():
|
||||
for image in archs:
|
||||
if image['arch'] not in args['--arch']:
|
||||
continue
|
||||
s6arch = image['s6arch'] if image['s6arch'] else image['arch']
|
||||
merged_data = dict(
|
||||
list({ 'version': version }.items()) +
|
||||
list(base_vars.items()) +
|
||||
list(os_base_vars.items()) +
|
||||
list(image.items()) +
|
||||
list({ 's6arch': s6arch }.items())
|
||||
)
|
||||
j2_env = Environment(loader=FileSystemLoader(THIS_DIR),
|
||||
trim_blocks=True)
|
||||
template = j2_env.get_template('Dockerfile.template')
|
||||
|
||||
dockerfile = 'Dockerfile_{}'.format(image['arch'])
|
||||
with open(dockerfile, 'w') as f:
|
||||
f.write(template.render(pihole=merged_data))
|
||||
|
||||
|
||||
def build_dockerfiles(args):
|
||||
if args['--no-build']:
|
||||
print(" ::: Skipping Dockerfile building")
|
||||
return
|
||||
|
||||
for arch in args['--arch']:
|
||||
build('pihole', arch, args)
|
||||
|
||||
|
||||
def run_and_stream_command_output(command, args):
|
||||
print("Running", command)
|
||||
build_result = subprocess.Popen(command.split(), stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
|
||||
bufsize=1, universal_newlines=True)
|
||||
if args['-v']:
|
||||
while build_result.poll() is None:
|
||||
for line in build_result.stdout:
|
||||
print(line, end='')
|
||||
build_result.wait()
|
||||
if build_result.returncode != 0:
|
||||
print(" ::: Error running".format(command))
|
||||
print(build_result.stderr)
|
||||
|
||||
|
||||
def build(docker_repo, arch, args):
|
||||
dockerfile = 'Dockerfile_{}'.format(arch)
|
||||
repo_tag = '{}:{}_{}'.format(docker_repo, __version__, arch)
|
||||
cached_image = '{}/{}'.format('pihole', repo_tag)
|
||||
print(" ::: Building {}".format(repo_tag))
|
||||
time=''
|
||||
if args['-t']:
|
||||
time='time '
|
||||
no_cache = ''
|
||||
if args['--no-cache']:
|
||||
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))
|
||||
run_and_stream_command_output(build_command, args)
|
||||
if args['-v']:
|
||||
print(build_command, '\n')
|
||||
if args['--hub_tag']:
|
||||
hub_tag_command = "{time}docker tag {create_tag} {hub_tag}"\
|
||||
.format(time=time, create_tag=repo_tag, hub_tag=args['--hub_tag'])
|
||||
print(" ::: Tagging {} into {}".format(repo_tag, args['--hub_tag']))
|
||||
run_and_stream_command_output(hub_tag_command, args)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
args = docopt(__doc__, version='Dockerfile 1.1')
|
||||
if args['-v']:
|
||||
print(args)
|
||||
|
||||
generate_dockerfiles(args)
|
||||
build_dockerfiles(args)
|
||||
@@ -1,8 +0,0 @@
|
||||
#!/usr/bin/env sh
|
||||
# alpine sh only
|
||||
|
||||
set -eux
|
||||
./Dockerfile.py -v --arch="${ARCH}" --hub_tag="${ARCH_IMAGE}"
|
||||
# TODO: Add junitxml output and have circleci consume it
|
||||
# 2 parallel max b/c race condition with docker fixture (I think?)
|
||||
py.test -vv -n 2 -k "${ARCH}" ./test/
|
||||
@@ -1,49 +0,0 @@
|
||||
FROM {{ pihole.base }}
|
||||
|
||||
ENV ARCH {{ pihole.arch }}
|
||||
ENV S6OVERLAY_RELEASE https://github.com/just-containers/s6-overlay/releases/download/{{ pihole.s6_version }}/s6-overlay-{{ pihole.s6arch }}.tar.gz
|
||||
|
||||
COPY install.sh /usr/local/bin/install.sh
|
||||
COPY VERSION /etc/docker-pi-hole-version
|
||||
ENV PIHOLE_INSTALL /root/ph_install.sh
|
||||
|
||||
RUN bash -ex install.sh 2>&1 && \
|
||||
rm -rf /var/cache/apt/archives /var/lib/apt/lists/*
|
||||
|
||||
ENTRYPOINT [ "/s6-init" ]
|
||||
|
||||
ADD s6/debian-root /
|
||||
COPY s6/service /usr/local/bin/service
|
||||
|
||||
# php config start passes special ENVs into
|
||||
ENV PHP_ENV_CONFIG '{{ pihole.php_env_config }}'
|
||||
ENV PHP_ERROR_LOG '{{ pihole.php_error_log }}'
|
||||
COPY ./start.sh /
|
||||
COPY ./bash_functions.sh /
|
||||
|
||||
# IPv6 disable flag for networks/devices that do not support it
|
||||
ENV IPv6 True
|
||||
|
||||
EXPOSE 53 53/udp
|
||||
EXPOSE 67/udp
|
||||
EXPOSE 80
|
||||
EXPOSE 443
|
||||
|
||||
ENV S6_LOGGING 0
|
||||
ENV S6_KEEP_ENV 1
|
||||
ENV S6_BEHAVIOUR_IF_STAGE2_FAILS 2
|
||||
|
||||
ENV ServerIP 0.0.0.0
|
||||
ENV FTL_CMD no-daemon
|
||||
ENV DNSMASQ_USER root
|
||||
|
||||
ENV VERSION {{ pihole.version }}
|
||||
ENV PATH /opt/pihole:${PATH}
|
||||
|
||||
LABEL image="{{ pihole.name }}:{{ pihole.version }}_{{ pihole.arch }}"
|
||||
LABEL maintainer="{{ pihole.maintainer }}"
|
||||
LABEL url="https://www.github.com/pi-hole/docker-pi-hole"
|
||||
|
||||
HEALTHCHECK CMD dig +norecurse +retry=0 @127.0.0.1 pi.hole || exit 1
|
||||
|
||||
SHELL ["/bin/bash", "-c"]
|
||||
@@ -1,49 +0,0 @@
|
||||
FROM pihole/debian-base:latest
|
||||
|
||||
ENV ARCH amd64
|
||||
ENV S6OVERLAY_RELEASE https://github.com/just-containers/s6-overlay/releases/download/v1.22.1.0/s6-overlay-amd64.tar.gz
|
||||
|
||||
COPY install.sh /usr/local/bin/install.sh
|
||||
COPY VERSION /etc/docker-pi-hole-version
|
||||
ENV PIHOLE_INSTALL /root/ph_install.sh
|
||||
|
||||
RUN bash -ex install.sh 2>&1 && \
|
||||
rm -rf /var/cache/apt/archives /var/lib/apt/lists/*
|
||||
|
||||
ENTRYPOINT [ "/s6-init" ]
|
||||
|
||||
ADD s6/debian-root /
|
||||
COPY s6/service /usr/local/bin/service
|
||||
|
||||
# php config start passes special ENVs into
|
||||
ENV PHP_ENV_CONFIG '/etc/lighttpd/conf-enabled/15-fastcgi-php.conf'
|
||||
ENV PHP_ERROR_LOG '/var/log/lighttpd/error.log'
|
||||
COPY ./start.sh /
|
||||
COPY ./bash_functions.sh /
|
||||
|
||||
# IPv6 disable flag for networks/devices that do not support it
|
||||
ENV IPv6 True
|
||||
|
||||
EXPOSE 53 53/udp
|
||||
EXPOSE 67/udp
|
||||
EXPOSE 80
|
||||
EXPOSE 443
|
||||
|
||||
ENV S6_LOGGING 0
|
||||
ENV S6_KEEP_ENV 1
|
||||
ENV S6_BEHAVIOUR_IF_STAGE2_FAILS 2
|
||||
|
||||
ENV ServerIP 0.0.0.0
|
||||
ENV FTL_CMD no-daemon
|
||||
ENV DNSMASQ_USER root
|
||||
|
||||
ENV VERSION v4.4
|
||||
ENV PATH /opt/pihole:${PATH}
|
||||
|
||||
LABEL image="pihole/pihole:v4.4_amd64"
|
||||
LABEL maintainer="adam@diginc.us"
|
||||
LABEL url="https://www.github.com/pi-hole/docker-pi-hole"
|
||||
|
||||
HEALTHCHECK CMD dig @127.0.0.1 pi.hole || exit 1
|
||||
|
||||
SHELL ["/bin/bash", "-c"]
|
||||
@@ -1,49 +0,0 @@
|
||||
FROM multiarch/debian-debootstrap:arm64-stretch-slim
|
||||
|
||||
ENV ARCH arm64
|
||||
ENV S6OVERLAY_RELEASE https://github.com/just-containers/s6-overlay/releases/download/v1.22.1.0/s6-overlay-aarch64.tar.gz
|
||||
|
||||
COPY install.sh /usr/local/bin/install.sh
|
||||
COPY VERSION /etc/docker-pi-hole-version
|
||||
ENV PIHOLE_INSTALL /root/ph_install.sh
|
||||
|
||||
RUN bash -ex install.sh 2>&1 && \
|
||||
rm -rf /var/cache/apt/archives /var/lib/apt/lists/*
|
||||
|
||||
ENTRYPOINT [ "/s6-init" ]
|
||||
|
||||
ADD s6/debian-root /
|
||||
COPY s6/service /usr/local/bin/service
|
||||
|
||||
# php config start passes special ENVs into
|
||||
ENV PHP_ENV_CONFIG '/etc/lighttpd/conf-enabled/15-fastcgi-php.conf'
|
||||
ENV PHP_ERROR_LOG '/var/log/lighttpd/error.log'
|
||||
COPY ./start.sh /
|
||||
COPY ./bash_functions.sh /
|
||||
|
||||
# IPv6 disable flag for networks/devices that do not support it
|
||||
ENV IPv6 True
|
||||
|
||||
EXPOSE 53 53/udp
|
||||
EXPOSE 67/udp
|
||||
EXPOSE 80
|
||||
EXPOSE 443
|
||||
|
||||
ENV S6_LOGGING 0
|
||||
ENV S6_KEEP_ENV 1
|
||||
ENV S6_BEHAVIOUR_IF_STAGE2_FAILS 2
|
||||
|
||||
ENV ServerIP 0.0.0.0
|
||||
ENV FTL_CMD no-daemon
|
||||
ENV DNSMASQ_USER root
|
||||
|
||||
ENV VERSION v4.4
|
||||
ENV PATH /opt/pihole:${PATH}
|
||||
|
||||
LABEL image="pihole/pihole:v4.4_arm64"
|
||||
LABEL maintainer="adam@diginc.us"
|
||||
LABEL url="https://www.github.com/pi-hole/docker-pi-hole"
|
||||
|
||||
HEALTHCHECK CMD dig @127.0.0.1 pi.hole || exit 1
|
||||
|
||||
SHELL ["/bin/bash", "-c"]
|
||||
@@ -1,49 +0,0 @@
|
||||
FROM multiarch/debian-debootstrap:armel-stretch-slim
|
||||
|
||||
ENV ARCH armel
|
||||
ENV S6OVERLAY_RELEASE https://github.com/just-containers/s6-overlay/releases/download/v1.22.1.0/s6-overlay-arm.tar.gz
|
||||
|
||||
COPY install.sh /usr/local/bin/install.sh
|
||||
COPY VERSION /etc/docker-pi-hole-version
|
||||
ENV PIHOLE_INSTALL /root/ph_install.sh
|
||||
|
||||
RUN bash -ex install.sh 2>&1 && \
|
||||
rm -rf /var/cache/apt/archives /var/lib/apt/lists/*
|
||||
|
||||
ENTRYPOINT [ "/s6-init" ]
|
||||
|
||||
ADD s6/debian-root /
|
||||
COPY s6/service /usr/local/bin/service
|
||||
|
||||
# php config start passes special ENVs into
|
||||
ENV PHP_ENV_CONFIG '/etc/lighttpd/conf-enabled/15-fastcgi-php.conf'
|
||||
ENV PHP_ERROR_LOG '/var/log/lighttpd/error.log'
|
||||
COPY ./start.sh /
|
||||
COPY ./bash_functions.sh /
|
||||
|
||||
# IPv6 disable flag for networks/devices that do not support it
|
||||
ENV IPv6 True
|
||||
|
||||
EXPOSE 53 53/udp
|
||||
EXPOSE 67/udp
|
||||
EXPOSE 80
|
||||
EXPOSE 443
|
||||
|
||||
ENV S6_LOGGING 0
|
||||
ENV S6_KEEP_ENV 1
|
||||
ENV S6_BEHAVIOUR_IF_STAGE2_FAILS 2
|
||||
|
||||
ENV ServerIP 0.0.0.0
|
||||
ENV FTL_CMD no-daemon
|
||||
ENV DNSMASQ_USER root
|
||||
|
||||
ENV VERSION v4.4
|
||||
ENV PATH /opt/pihole:${PATH}
|
||||
|
||||
LABEL image="pihole/pihole:v4.4_armel"
|
||||
LABEL maintainer="adam@diginc.us"
|
||||
LABEL url="https://www.github.com/pi-hole/docker-pi-hole"
|
||||
|
||||
HEALTHCHECK CMD dig @127.0.0.1 pi.hole || exit 1
|
||||
|
||||
SHELL ["/bin/bash", "-c"]
|
||||
@@ -1,49 +0,0 @@
|
||||
FROM multiarch/debian-debootstrap:armhf-stretch-slim
|
||||
|
||||
ENV ARCH armhf
|
||||
ENV S6OVERLAY_RELEASE https://github.com/just-containers/s6-overlay/releases/download/v1.21.7.0/s6-overlay-armhf.tar.gz
|
||||
|
||||
COPY install.sh /usr/local/bin/install.sh
|
||||
COPY VERSION /etc/docker-pi-hole-version
|
||||
ENV PIHOLE_INSTALL /root/ph_install.sh
|
||||
|
||||
RUN bash -ex install.sh 2>&1 && \
|
||||
rm -rf /var/cache/apt/archives /var/lib/apt/lists/*
|
||||
|
||||
ENTRYPOINT [ "/s6-init" ]
|
||||
|
||||
ADD s6/debian-root /
|
||||
COPY s6/service /usr/local/bin/service
|
||||
|
||||
# php config start passes special ENVs into
|
||||
ENV PHP_ENV_CONFIG '/etc/lighttpd/conf-enabled/15-fastcgi-php.conf'
|
||||
ENV PHP_ERROR_LOG '/var/log/lighttpd/error.log'
|
||||
COPY ./start.sh /
|
||||
COPY ./bash_functions.sh /
|
||||
|
||||
# IPv6 disable flag for networks/devices that do not support it
|
||||
ENV IPv6 True
|
||||
|
||||
EXPOSE 53 53/udp
|
||||
EXPOSE 67/udp
|
||||
EXPOSE 80
|
||||
EXPOSE 443
|
||||
|
||||
ENV S6_LOGGING 0
|
||||
ENV S6_KEEP_ENV 1
|
||||
ENV S6_BEHAVIOUR_IF_STAGE2_FAILS 2
|
||||
|
||||
ENV ServerIP 0.0.0.0
|
||||
ENV FTL_CMD no-daemon
|
||||
ENV DNSMASQ_USER root
|
||||
|
||||
ENV VERSION v4.4
|
||||
ENV PATH /opt/pihole:${PATH}
|
||||
|
||||
LABEL image="pihole/pihole:v4.4_armhf"
|
||||
LABEL maintainer="adam@diginc.us"
|
||||
LABEL url="https://www.github.com/pi-hole/docker-pi-hole"
|
||||
|
||||
HEALTHCHECK CMD dig @127.0.0.1 pi.hole || exit 1
|
||||
|
||||
SHELL ["/bin/bash", "-c"]
|
||||
@@ -1,23 +0,0 @@
|
||||
FROM docker:latest
|
||||
|
||||
# Based on https://github.com/Ilhicas/alpine-pipenv
|
||||
ARG packages
|
||||
RUN apk --update add python3 python3-dev curl gcc make \
|
||||
musl-dev libffi-dev openssl-dev ${packages} \
|
||||
&& rm -rf /var/cache/apk/* \
|
||||
&& pip3 install -U pip pipenv
|
||||
|
||||
|
||||
# -v "$(pwd):/$(pwd)" -w "$(pwd)" to prevent nested docker path confusion
|
||||
COPY ./Dockerfile.sh /usr/local/bin/
|
||||
COPY Pipfile* /root/
|
||||
WORKDIR /root
|
||||
|
||||
RUN pipenv install --system \
|
||||
&& sed -i 's|/bin/sh|/bin/bash|g' /usr/lib/python3.8/site-packages/testinfra/backend/docker.py
|
||||
|
||||
|
||||
RUN echo "set -ex && Dockerfile.sh && \$@" > /usr/local/bin/entrypoint.sh
|
||||
RUN chmod +x /usr/local/bin/entrypoint.sh
|
||||
ENTRYPOINT entrypoint.sh
|
||||
CMD Dockerfile.sh
|
||||
215
README.md
215
README.md
@@ -5,8 +5,26 @@
|
||||
</p>
|
||||
<!-- Delete above HTML and insert markdown for dockerhub :  -->
|
||||
|
||||
## Upgrade Notes
|
||||
|
||||
- **Using Watchtower? See the [Note on Watchtower](#note-on-watchtower) at the bottom of this readme**
|
||||
|
||||
- Due to [a known issue with Docker and libseccomp <2.5](https://github.com/moby/moby/issues/40734), you may run into issues running `2022.04` and later on host systems with an older version of `libseccomp2` ([Such as Debian/Raspbian buster or Ubuntu 20.04](https://pkgs.org/download/libseccomp2), and maybe [CentOS 7](https://pkgs.org/download/libseccomp)).
|
||||
|
||||
The first recommendation is to upgrade your host OS, which will include a more up to date (and fixed) version of `libseccomp`.
|
||||
|
||||
_If you absolutely cannot do this, some users [have reported](https://github.com/pi-hole/docker-pi-hole/issues/1042#issuecomment-1086728157) success in updating `libseccomp2` via backports on debian, or similar via updates on Ubuntu. You can try this workaround at your own risk_ (Note, you may also find that you need the latest `docker.io` (more details [here](https://blog.samcater.com/fix-workaround-rpi4-docker-libseccomp2-docker-20/))
|
||||
|
||||
- Some users [have reported issues](https://github.com/pi-hole/docker-pi-hole/issues/963#issuecomment-1095602502) with using the `--privileged` flag on `2022.04` and above. TL;DR, don't use that that mode, and be [explicit with the permitted caps](https://github.com/pi-hole/docker-pi-hole#note-on-capabilities) (if needed) instead
|
||||
|
||||
- As of `2022.04.01`, setting `CAP_NET_ADMIN` is only required if you are using Pi-hole as your DHCP server. The container will only try to set caps that are explicitly granted (or natively available)
|
||||
|
||||
- In `2022.01` and later, the default `DNSMASQ_USER` has been changed to `pihole`, however this may cause issues on some systems such as Synology, see Issue [#963](https://github.com/pi-hole/docker-pi-hole/issues/963) for more information.
|
||||
If the container won't start due to issues setting capabilities, set `DNSMASQ_USER` to `root` in your environment.
|
||||
|
||||
## Quick Start
|
||||
|
||||
1. Copy docker-compose.yml.example to docker-compose.yml and update as needed. See example below:
|
||||
[Docker-compose](https://docs.docker.com/compose/install/) example:
|
||||
|
||||
```yaml
|
||||
@@ -17,74 +35,53 @@ services:
|
||||
pihole:
|
||||
container_name: pihole
|
||||
image: pihole/pihole:latest
|
||||
# For DHCP it is recommended to remove these ports and instead add: network_mode: "host"
|
||||
ports:
|
||||
- "53:53/tcp"
|
||||
- "53:53/udp"
|
||||
- "67:67/udp"
|
||||
- "67:67/udp" # Only required if you are using Pi-hole as your DHCP server
|
||||
- "80:80/tcp"
|
||||
- "443:443/tcp"
|
||||
environment:
|
||||
TZ: 'America/Chicago'
|
||||
# WEBPASSWORD: 'set a secure password here or it will be random'
|
||||
# Volumes store your data between container upgrades
|
||||
volumes:
|
||||
- './etc-pihole/:/etc/pihole/'
|
||||
- './etc-dnsmasq.d/:/etc/dnsmasq.d/'
|
||||
dns:
|
||||
- 127.0.0.1
|
||||
- 1.1.1.1
|
||||
# Recommended but not required (DHCP needs NET_ADMIN)
|
||||
- './etc-pihole:/etc/pihole'
|
||||
- './etc-dnsmasq.d:/etc/dnsmasq.d'
|
||||
# https://github.com/pi-hole/docker-pi-hole#note-on-capabilities
|
||||
cap_add:
|
||||
- NET_ADMIN
|
||||
- NET_ADMIN # Required if you are using Pi-hole as your DHCP server, else not needed
|
||||
restart: unless-stopped
|
||||
```
|
||||
2. Run `docker-compose up -d` to build and start pi-hole
|
||||
3. Use the Pi-hole web UI to change the DNS settings *Interface listening behavior* to "Listen on all interfaces, permit all origins", if using Docker's default `bridge` network setting
|
||||
|
||||
[Here is an equivalent docker run script](https://github.com/pi-hole/docker-pi-hole/blob/master/docker_run.sh).
|
||||
|
||||
## Upgrade Notices:
|
||||
|
||||
### Docker Pi-Hole v4.2.2
|
||||
|
||||
- ServerIP no longer a required enviroment variable **unless you run network 'host' mode**! Feel free to remove it unless you need it to customize lighttpd
|
||||
- --cap-add NET_ADMIN no longer required unless using DHCP, leaving in examples for consistency
|
||||
|
||||
### Docker Pi-Hole v4.1.1+
|
||||
|
||||
Starting with the v4.1.1 release your Pi-hole container may encounter issues starting the DNS service unless ran with the following setting:
|
||||
|
||||
- `--dns=127.0.0.1 --dns=1.1.1.1` The second server can be any DNS IP of your choosing, but the **first dns must be 127.0.0.1**
|
||||
- A WARNING stating "Misconfigured DNS in /etc/resolv.conf" may show in docker logs without this.
|
||||
- 4.1 required --cap-add NET_ADMIN until 4.2.1-1
|
||||
|
||||
These are the raw [docker run cli](https://docs.docker.com/engine/reference/commandline/cli/) versions of the commands. We provide no official support for docker GUIs but the community forums may be able to help if you do not see a place for these settings. Remember, always consult your manual too!
|
||||
[Here is an equivalent docker run script](https://github.com/pi-hole/docker-pi-hole/blob/master/examples/docker_run.sh).
|
||||
|
||||
## Overview
|
||||
|
||||
#### Renamed from `diginc/pi-hole` to `pihole/pihole`
|
||||
|
||||
A [Docker](https://www.docker.com/what-docker) project to make a lightweight x86 and ARM container with [Pi-hole](https://pi-hole.net) functionality.
|
||||
|
||||
1) Install docker for your [x86-64 system](https://www.docker.com/community-edition) or [ARMv7 system](https://www.raspberrypi.org/blog/docker-comes-to-raspberry-pi/) using those links. [Docker-compose](https://docs.docker.com/compose/install/) is also recommended.
|
||||
2) Use the above quick start example, customize if desired.
|
||||
3) Enjoy!
|
||||
|
||||
[](https://travis-ci.org/pi-hole/docker-pi-hole) [](https://store.docker.com/community/images/pihole/pihole) [](https://store.docker.com/community/images/pihole/pihole)
|
||||
[](https://github.com/pi-hole/docker-pi-hole/actions?query=workflow%3A%22Test+%26+Build%22) [](https://store.docker.com/community/images/pihole/pihole) [](https://store.docker.com/community/images/pihole/pihole)
|
||||
|
||||
## Running Pi-hole Docker
|
||||
|
||||
This container uses 2 popular ports, port 53 and port 80, so **may conflict with existing applications ports**. If you have no other services or docker containers using port 53/80 (if you do, keep reading below for a reverse proxy example), the minimum arguments required to run this container are in the script [docker_run.sh](https://github.com/pi-hole/docker-pi-hole/blob/master/docker_run.sh)
|
||||
This container uses 2 popular ports, port 53 and port 80, so **may conflict with existing applications ports**. If you have no other services or docker containers using port 53/80 (if you do, keep reading below for a reverse proxy example), the minimum arguments required to run this container are in the script [docker_run.sh](https://github.com/pi-hole/docker-pi-hole/blob/master/examples/docker_run.sh)
|
||||
|
||||
If you're using a Red Hat based distribution with an SELinux Enforcing policy add `:z` to line with volumes like so:
|
||||
|
||||
```
|
||||
-v "$(pwd)/etc-pihole/:/etc/pihole/:z" \
|
||||
-v "$(pwd)/etc-dnsmasq.d/:/etc/dnsmasq.d/:z" \
|
||||
-v "$(pwd)/etc-pihole:/etc/pihole:z" \
|
||||
-v "$(pwd)/etc-dnsmasq.d:/etc/dnsmasq.d:z" \
|
||||
```
|
||||
|
||||
Volumes are recommended for persisting data across container re-creations for updating images. The IP lookup variables may not work for everyone, please review their values and hard code IP and IPv6 if necessary.
|
||||
|
||||
Port 443 is to provide a sinkhole for ads that use SSL. If only port 80 is used, then blocked HTTPS queries will fail to connect to port 443 and may cause long loading times. Rejecting 443 on your firewall can also serve this same purpose. Ubuntu firewall example: `sudo ufw reject https`
|
||||
You can customize where to store persistent data by setting the `PIHOLE_BASE` environment variable when invoking `docker_run.sh` (e.g. `PIHOLE_BASE=/opt/pihole-storage ./docker_run.sh`). If `PIHOLE_BASE` is not set, files are stored in your current directory when you invoke the script.
|
||||
|
||||
**Automatic Ad List Updates** - since the 3.0+ release, `cron` is baked into the container and will grab the newest versions of your lists and flush your logs. **Set your TZ** environment variable to make sure the midnight log rotation syncs up with your timezone's midnight.
|
||||
|
||||
@@ -96,27 +93,78 @@ There are multiple different ways to run DHCP from within your Docker Pi-hole co
|
||||
|
||||
There are other environment variables if you want to customize various things inside the docker container:
|
||||
|
||||
| Docker Environment Var. | Description |
|
||||
| ----------------------- | ----------- |
|
||||
| `TZ: <Timezone>`<br/> **Recommended** *Default: UTC* | Set your [timezone](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) to make sure logs rotate at local midnight instead of at UTC midnight.
|
||||
| `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
|
||||
| `DNS_FQDN_REQUIRED: <True\|False>`<br/> *Optional* *Default: true* | Never forward non-FQDNs
|
||||
| `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
|
||||
| `IPv6: <True\|False>`<br/> *Optional* *Default: True* | For unraid compatibility, strips out all the IPv6 configuration from DNS/Web services when false.
|
||||
| `INTERFACE: <NIC>`<br/> *Advanced/Optional* | The default works fine with our basic example docker run commands. If you're trying to use DHCP with `--net host` mode then you may have to customize this or DNSMASQ_LISTENING.
|
||||
| `DNSMASQ_LISTENING: <local\|all\|NIC>`<br/> *Advanced/Optional* | `local` listens on all local subnets, `all` permits listening on internet origin subnets in addition to local.
|
||||
| `WEB_PORT: <PORT>`<br/> *Advanced/Optional* | **This will break the 'webpage blocked' functionality of Pi-hole** however it may help advanced setups like those running synology or `--net=host` docker argument. This guide explains how to restore webpage blocked functionality using a linux router DNAT rule: [Alternative Synology installation method](https://discourse.pi-hole.net/t/alternative-synology-installation-method/5454?u=diginc)
|
||||
| `DNSMASQ_USER: <pihole\|root>`<br/> *Experimental Default: root* | Allows running FTLDNS as non-root.
|
||||
### Recommended Variables
|
||||
|
||||
| Variable | Default | Value | Description |
|
||||
| -------- | ------- | ----- | ---------- |
|
||||
| `TZ` | UTC | `<Timezone>` | Set your [timezone](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) to make sure logs rotate at local midnight instead of at UTC midnight.
|
||||
| `WEBPASSWORD` | random | `<Admin password>` | http://pi.hole/admin password. Run `docker logs pihole \| grep random` to find your random pass.
|
||||
| `FTLCONF_REPLY_ADDR4` | unset | `<Host's IP>` | Set to your server's LAN IP, used by web block modes and lighttpd bind address.
|
||||
|
||||
### Optional Variables
|
||||
|
||||
| Variable | Default | Value | Description |
|
||||
| -------- | ------- | ----- | ---------- |
|
||||
| `ADMIN_EMAIL` | unset | email address | Set an administrative contact address for the Block Page |
|
||||
| `PIHOLE_DNS_` | `8.8.8.8;8.8.4.4` | IPs delimited by `;` | Upstream DNS server(s) for Pi-hole to forward queries to, separated by a semicolon <br/> (supports non-standard ports with `#[port number]`) e.g `127.0.0.1#5053;8.8.8.8;8.8.4.4` <br/> (supports [Docker service names and links](https://docs.docker.com/compose/networking/) instead of IPs) e.g `upstream0;upstream1` where `upstream0` and `upstream1` are the service names of or links to docker services <br/> Note: The existence of this environment variable assumes this as the _sole_ management of upstream DNS. Upstream DNS added via the web interface will be overwritten on container restart/recreation |
|
||||
| `DNSSEC` | `false` | `<"true"\|"false">` | Enable DNSSEC support |
|
||||
| `DNS_BOGUS_PRIV` | `true` |`<"true"\|"false">`| Never forward reverse lookups for private ranges |
|
||||
| `DNS_FQDN_REQUIRED` | `true` | `<"true"\|"false">`| Never forward non-FQDNs |
|
||||
| `REV_SERVER` | `false` | `<"true"\|"false">` | Enable DNS conditional forwarding for device name resolution |
|
||||
| `REV_SERVER_DOMAIN` | unset | Network Domain | If conditional forwarding is enabled, set the domain of the local network router |
|
||||
| `REV_SERVER_TARGET` | unset | Router's IP | If conditional forwarding is enabled, set the IP of the local network router |
|
||||
| `REV_SERVER_CIDR` | unset | Reverse DNS | If conditional forwarding is enabled, set the reverse DNS zone (e.g. `192.168.0.0/24`) |
|
||||
| `DHCP_ACTIVE` | `false` | `<"true"\|"false">` | Enable DHCP server. Static DHCP leases can be configured with a custom `/etc/dnsmasq.d/04-pihole-static-dhcp.conf`
|
||||
| `DHCP_START` | unset | `<Start IP>` | Start of the range of IP addresses to hand out by the DHCP server (mandatory if DHCP server is enabled).
|
||||
| `DHCP_END` | unset | `<End IP>` | End of the range of IP addresses to hand out by the DHCP server (mandatory if DHCP server is enabled).
|
||||
| `DHCP_ROUTER` | unset | `<Router's IP>` | Router (gateway) IP address sent by the DHCP server (mandatory if DHCP server is enabled).
|
||||
| `DHCP_LEASETIME` | 24 | `<hours>` | DHCP lease time in hours.
|
||||
| `PIHOLE_DOMAIN` | `lan` | `<domain>` | Domain name sent by the DHCP server.
|
||||
| `DHCP_IPv6` | `false` | `<"true"\|"false">` | Enable DHCP server IPv6 support (SLAAC + RA).
|
||||
| `DHCP_rapid_commit` | `false` | `<"true"\|"false">` | Enable DHCPv4 rapid commit (fast address assignment).
|
||||
| `VIRTUAL_HOST` | `$FTLCONF_REPLY_ADDR4` | `<Custom Hostname>` | 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
|
||||
| `IPv6` | `true` | `<"true"\|"false">` | For unraid compatibility, strips out all the IPv6 configuration from DNS/Web services when false.
|
||||
| `TEMPERATUREUNIT` | `c` | `<c\|k\|f>` | Set preferred temperature unit to `c`: Celsius, `k`: Kelvin, or `f` Fahrenheit units.
|
||||
| `WEBUIBOXEDLAYOUT` | `boxed` | `<boxed\|traditional>` | Use boxed layout (helpful when working on large screens)
|
||||
| `QUERY_LOGGING` | `true` | `<"true"\|"false">` | Enable query logging or not.
|
||||
| `WEBTHEME` | `default-light` | `<"default-dark"\|"default-darker"\|"default-light"\|"default-auto"\|"lcars">`| User interface theme to use.
|
||||
| `WEBPASSWORD_FILE`| unset | `<Docker secret path>` |Set an Admin password using [Docker secrets](https://docs.docker.com/engine/swarm/secrets/). If `WEBPASSWORD` is set, `WEBPASSWORD_FILE` is ignored. If `WEBPASSWORD` is empty, and `WEBPASSWORD_FILE` is set to a valid readable file path, then `WEBPASSWORD` will be set to the contents of `WEBPASSWORD_FILE`.
|
||||
|
||||
### Advanced Variables
|
||||
| Variable | Default | Value | Description |
|
||||
| -------- | ------- | ----- | ---------- |
|
||||
| `INTERFACE` | unset | `<NIC>` | The default works fine with our basic example docker run commands. If you're trying to use DHCP with `--net host` mode then you may have to customize this or DNSMASQ_LISTENING.
|
||||
| `DNSMASQ_LISTENING` | unset | `<local\|all\|single>` | `local` listens on all local subnets, `all` permits listening on internet origin subnets in addition to local, `single` listens only on the interface specified.
|
||||
| `WEB_PORT` | unset | `<PORT>` | **This will break the 'webpage blocked' functionality of Pi-hole** however it may help advanced setups like those running synology or `--net=host` docker argument. This guide explains how to restore webpage blocked functionality using a linux router DNAT rule: [Alternative Synology installation method](https://discourse.pi-hole.net/t/alternative-synology-installation-method/5454?u=diginc)
|
||||
| `SKIPGRAVITYONBOOT` | unset | `<unset\|1>` | Use this option to skip updating the Gravity Database when booting up the container. By default this environment variable is not set so the Gravity Database will be updated when the container starts up. Setting this environment variable to 1 (or anything) will cause the Gravity Database to not be updated when container starts up.
|
||||
| `CORS_HOSTS` | unset | `<FQDNs delimited by ,>` | List of domains/subdomains on which CORS is allowed. Wildcards are not supported. Eg: `CORS_HOSTS: domain.com,home.domain.com,www.domain.com`.
|
||||
| `CUSTOM_CACHE_SIZE` | `10000` | Number | Set the cache size for dnsmasq. Useful for increasing the default cache size or to set it to 0. Note that when `DNSSEC` is "true", then this setting is ignored.
|
||||
| `FTL_CMD` | `no-daemon` | `no-daemon -- <dnsmasq option>` | Customize the options with which dnsmasq gets started. e.g. `no-daemon -- --dns-forward-max 300` to increase max. number of concurrent dns queries on high load setups. |
|
||||
| `FTLCONF_[SETTING]` | unset | As per documentation | Customize pihole-FTL.conf with settings described in the [FTLDNS Configuration page](https://docs.pi-hole.net/ftldns/configfile/). For example, to customize REPLY_ADDR6, ensure you have the `FTLCONF_REPLY_ADDR6` environment variable set.
|
||||
|
||||
### Experimental Variables
|
||||
| Variable | Default | Value | Description |
|
||||
| -------- | ------- | ----- | ---------- |
|
||||
| `DNSMASQ_USER` | unset | `<pihole\|root>` | Allows changing the user that FTLDNS runs as. Default: `pihole`|
|
||||
| `PIHOLE_UID` | debian system value | Number | Overrides image's default pihole user id to match a host user id |
|
||||
| `PIHOLE_GID` | debian system value | Number | Overrides image's default pihole group id to match a host group id |
|
||||
| `WEB_UID` | debian system value | Number | Overrides image's default www-data user id to match a host user id |
|
||||
| `WEB_GID` | debian system value | Number | Overrides image's default www-data group id to match a host group id |
|
||||
| `WEBLOGS_STDOUT` | 0 | 0|1 | 0 logs to defined files, 1 redirect access and error logs to stdout |
|
||||
|
||||
## Deprecated environment variables:
|
||||
While these may still work, they are likely to be removed in a future version. Where applicable, alternative variable names are indicated. Please review the table above for usage of the alternative variables
|
||||
|
||||
| Docker Environment Var. | Description | Replaced By |
|
||||
| ----------------------- | ----------- | ----------- |
|
||||
| `CONDITIONAL_FORWARDING` | Enable DNS conditional forwarding for device name resolution | `REV_SERVER`|
|
||||
| `CONDITIONAL_FORWARDING_IP` | If conditional forwarding is enabled, set the IP of the local network router | `REV_SERVER_TARGET` |
|
||||
| `CONDITIONAL_FORWARDING_DOMAIN` | If conditional forwarding is enabled, set the domain of the local network router | `REV_SERVER_DOMAIN` |
|
||||
| `CONDITIONAL_FORWARDING_REVERSE` | If conditional forwarding is enabled, set the reverse DNS of the local network router (e.g. `0.168.192.in-addr.arpa`) | `REV_SERVER_CIDR` |
|
||||
| `DNS1` | Primary upstream DNS provider, default is google DNS | `PIHOLE_DNS_` |
|
||||
| `DNS2` | Secondary upstream DNS provider, default is google DNS, `no` if only one DNS should used | `PIHOLE_DNS_` |
|
||||
| `ServerIP` | Set to your server's LAN IP, used by web block modes and lighttpd bind address | `FTLCONF_REPLY_ADDR4` |
|
||||
| `ServerIPv6` | **If you have a v6 network** set to your server's LAN IPv6 to block IPv6 ads fully | `FTLCONF_REPLY_ADDR6` |
|
||||
|
||||
To use these env vars in docker run format style them like: `-e DNS1=1.1.1.1`
|
||||
|
||||
@@ -124,13 +172,13 @@ Here is a rundown of other arguments for your docker-compose / docker run.
|
||||
|
||||
| Docker Arguments | Description |
|
||||
| ---------------- | ----------- |
|
||||
| `-p <port>:<port>` **Recommended** | Ports to expose (53, 80, 67, 443), the bare minimum ports required for Pi-holes HTTP and DNS services
|
||||
| `-p <port>:<port>` **Recommended** | Ports to expose (53, 80, 67), the bare minimum ports required for Pi-holes HTTP and DNS services
|
||||
| `--restart=unless-stopped`<br/> **Recommended** | Automatically (re)start your Pi-hole on boot or in the event of a crash
|
||||
| `-v $(pwd)/etc-pihole:/etc/pihole`<br/> **Recommended** | Volumes for your Pi-hole configs help persist changes across docker image updates
|
||||
| `-v $(pwd)/etc-dnsmasq.d:/etc/dnsmasq.d`<br/> **Recommended** | Volumes for your dnsmasq configs help persist changes across docker image updates
|
||||
| `--net=host`<br/> *Optional* | Alternative to `-p <port>:<port>` arguments (Cannot be used at same time as -p) if you don't run any other web application. DHCP runs best with --net=host, otherwise your router must support dhcp-relay settings.
|
||||
| `--cap-add=NET_ADMIN`<br/> *Recommended* | Commonly added capability for DHCP, see [Note on Capabilities](#note-on-capabilities) below for other capabilities.
|
||||
| `--dns=127.0.0.1`<br/> *Recommended* | Sets your container's resolve settings to localhost so it can resolve DHCP hostnames from Pi-hole's DNSMasq, also fixes common resolution errors on container restart.
|
||||
| `--dns=127.0.0.1`<br/> *Optional* | Sets your container's resolve settings to localhost so it can resolve DHCP hostnames from Pi-hole's DNSMasq, may fix resolution errors on container restart.
|
||||
| `--dns=1.1.1.1`<br/> *Optional* | Sets a backup server of your choosing in case DNSMasq has problems starting
|
||||
| `--env-file .env` <br/> *Optional* | File to store environment variables for docker replacing `-e key=value` settings. Here for convenience
|
||||
|
||||
@@ -142,9 +190,9 @@ Here is a rundown of other arguments for your docker-compose / docker run.
|
||||
* Port conflicts? Stop your server's existing DNS / Web services.
|
||||
* Don't forget to stop your services from auto-starting again after you reboot
|
||||
* Ubuntu users see below for more detailed information
|
||||
* Port 80 is highly recommended because if you have another site/service using port 80 by default then the ads may not transform into blank ads correctly. To make sure docker-pi-hole plays nicely with an existing webserver you run you'll probably need a reverse proxy webserver config if you don't have one already. Pi-hole must be the default web app on the proxy e.g. if you go to your host by IP instead of domain then Pi-hole is served out instead of any other sites hosted by the proxy. This is the '[default_server](http://nginx.org/en/docs/http/ngx_http_core_module.html#listen)' in nginx or ['_default_' virtual host](https://httpd.apache.org/docs/2.4/vhosts/examples.html#default) in Apache and is taken advantage of so any undefined ad domain can be directed to your webserver and get a 'blocked' response instead of ads.
|
||||
* You can still map other ports to Pi-hole port 80 using docker's port forwarding like this `-p 8080:80`, but again the ads won't render properly. Changing the inner port 80 shouldn't be required unless you run docker host networking mode.
|
||||
* [Here is an example of running with jwilder/proxy](https://github.com/pi-hole/docker-pi-hole/blob/master/docker-compose-jwilder-proxy.yml) (an nginx auto-configuring docker reverse proxy for docker) on my port 80 with Pi-hole on another port. Pi-hole needs to be `DEFAULT_HOST` env in jwilder/proxy and you need to set the matching `VIRTUAL_HOST` for the Pi-hole's container. Please read jwilder/proxy readme for more info if you have trouble.
|
||||
* You can map other ports to Pi-hole port 80 using docker's port forwarding like this `-p 8080:80` if you are using the default blocking mode. If you are using the legacy IP blocking mode, you should not remap this port.
|
||||
* [Here is an example of running with nginxproxy/nginx-proxy](https://github.com/pi-hole/docker-pi-hole/blob/master/examples/docker-compose-nginx-proxy.yml) (an nginx auto-configuring docker reverse proxy for docker) on my port 80 with Pi-hole on another port. Pi-hole needs to be `DEFAULT_HOST` env in nginxproxy/nginx-proxy and you need to set the matching `VIRTUAL_HOST` for the Pi-hole's container. Please read nginxproxy/nginx-proxy readme for more info if you have trouble.
|
||||
* Docker's default network mode `bridge` isolates the container from the host's network. This is a more secure setting, but requires setting the Pi-hole DNS option for *Interface listening behavior* to "Listen on all interfaces, permit all origins".
|
||||
|
||||
### Installing on Ubuntu
|
||||
Modern releases of Ubuntu (17.10+) include [`systemd-resolved`](http://manpages.ubuntu.com/manpages/bionic/man8/systemd-resolved.service.8.html) which is configured by default to implement a caching DNS stub resolver. This will prevent pi-hole from listening on port 53.
|
||||
@@ -152,6 +200,7 @@ The stub resolver should be disabled with: `sudo sed -r -i.orig 's/#?DNSStubList
|
||||
|
||||
This will not change the nameserver settings, which point to the stub resolver thus preventing DNS resolution. Change the `/etc/resolv.conf` symlink to point to `/run/systemd/resolve/resolv.conf`, which is automatically updated to follow the system's [`netplan`](https://netplan.io/):
|
||||
`sudo sh -c 'rm /etc/resolv.conf && ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf'`
|
||||
After making these changes, you should restart systemd-resolved using `systemctl restart systemd-resolved`
|
||||
|
||||
Once pi-hole is installed, you'll want to configure your clients to use it ([see here](https://discourse.pi-hole.net/t/how-do-i-configure-my-devices-to-use-pi-hole-as-their-dns-server/245)). If you used the symlink above, your docker host will either use whatever is served by DHCP, or whatever static setting you've configured. If you want to explicitly set your docker host's nameservers you can edit the netplan(s) found at `/etc/netplan`, then run `sudo netplan apply`.
|
||||
Example netplan:
|
||||
@@ -173,24 +222,20 @@ Users of older Ubuntu releases (circa 17.04) will need to disable dnsmasq.
|
||||
|
||||
## Docker tags and versioning
|
||||
|
||||
The primary docker tags / versions are explained in the following table. [Click here to see the full list of tags](https://store.docker.com/community/images/pihole/pihole/tags) ([arm tags are here](https://store.docker.com/community/images/pihole/pihole/tags)), I also try to tag with the specific version of Pi-hole Core for version archival purposes, the web version that comes with the core releases should be in the [GitHub Release notes](https://github.com/pi-hole/docker-pi-hole/releases).
|
||||
The primary docker tags are explained in the following table. [Click here to see the full list of tags](https://store.docker.com/community/images/pihole/pihole/tags). See [GitHub Release notes](https://github.com/pi-hole/docker-pi-hole/releases) to see the specific version of Pi-hole Core, Web, and FTL included in the release.
|
||||
|
||||
| tag | architecture | description | Dockerfile |
|
||||
| --- | ------------ | ----------- | ---------- |
|
||||
| `latest` | auto detect | x86, arm, or arm64 container, docker auto detects your architecture. | [Dockerfile](https://github.com/pi-hole/docker-pi-hole/blob/master/Dockerfile_amd64) |
|
||||
| `v4.0.0-1` | auto detect | Versioned tags, if you want to pin against a specific version, use one of these | |
|
||||
| `v4.0.0-1_<arch>` | based on tag | Specific architectures tags | |
|
||||
| `dev` | auto detect | like latest tag, but for the development branch (pushed occasionally) | |
|
||||
|
||||
### `pihole/pihole:latest` [](https://microbadger.com/images/pihole/pihole "Get your own image badge on microbadger.com") [](https://microbadger.com/images/pihole/pihole "Get your own version badge on microbadger.com") [](https://microbadger.com/images/pihole/pihole "Get your own version badge on microbadger.com")
|
||||
|
||||
This version of the docker aims to be as close to a standard Pi-hole installation by using the recommended base OS and the exact configs and scripts (minimally modified to get them working). This enables fast updating when an update comes from Pi-hole.
|
||||
|
||||
https://hub.docker.com/r/pihole/pihole/tags/
|
||||
| tag | description
|
||||
|---------------------|--------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `latest` | Always latest release |
|
||||
| `2022.04` | Date-based release that can receive bugfix updates |
|
||||
| `2022.04.1` | A specific image that will not receive updates |
|
||||
| `dev` | Similar to `latest`, but for the development branch (pushed occasionally) |
|
||||
| `*beta` | Early beta releases of upcoming versions - here be dragons |
|
||||
| `nightly` | Like `dev` but pushed every night and pulls from the latest `development` branches of the core Pi-hole components (Pi-hole, AdminLTE, FTL) |
|
||||
|
||||
## Upgrading, Persistence, and Customizations
|
||||
|
||||
The standard Pi-hole customization abilities apply to this docker, but with docker twists such as using docker volume mounts to map host stored file configurations over the container defaults. Volumes are also important to persist the configuration in case you have removed the Pi-hole container which is a typical docker upgrade pattern.
|
||||
The standard Pi-hole customization abilities apply to this docker, but with docker twists such as using docker volume mounts to map host stored file configurations over the container defaults. However, mounting these configuration files as read-only should be avoided. Volumes are also important to persist the configuration in case you have removed the Pi-hole container which is a typical docker upgrade pattern.
|
||||
|
||||
### Upgrading / Reconfiguring
|
||||
|
||||
@@ -201,11 +246,11 @@ Do not attempt to upgrade (`pihole -up`) or reconfigure (`pihole -r`). New imag
|
||||
* We will try to put common break/fixes at the top of this readme too
|
||||
1. Download the latest version of the image: `docker pull pihole/pihole`
|
||||
2. Throw away your container: `docker rm -f pihole`
|
||||
* **Warning** When removing your pihole container you may be stuck without DNS until step 3; **docker pull** before **docker rm -f** to avoid DNS inturruption **OR** always have a fallback DNS server configured in DHCP to avoid this problem altogether.
|
||||
* **Warning** When removing your pihole container you may be stuck without DNS until step 3; **docker pull** before **docker rm -f** to avoid DNS interruption **OR** always have a fallback DNS server configured in DHCP to avoid this problem altogether.
|
||||
* If you care about your data (logs/customizations), make sure you have it volume-mapped or it will be deleted in this step.
|
||||
3. Start your container with the newer base image: `docker run <args> pihole/pihole` (`<args>` being your preferred run volumes and env vars)
|
||||
|
||||
Why is this style of upgrading good? A couple reasons: Everyone is starting from the same base image which has been tested to known it works. No worrying about upgrading from A to B, B to C, or A to C is required when rolling out updates, it reducing complexity, and simply allows a 'fresh start' every time while preserving customizations with volumes. Basically I'm encouraging [phoenix server](https://www.google.com/?q=phoenix+servers) principles for your containers.
|
||||
Why is this style of upgrading good? A couple reasons: Everyone is starting from the same base image which has been tested to known it works. No worrying about upgrading from A to B, B to C, or A to C is required when rolling out updates, it reduces complexity, and simply allows a 'fresh start' every time while preserving customizations with volumes. Basically I'm encouraging [phoenix server](https://www.google.com/?q=phoenix+servers) principles for your containers.
|
||||
|
||||
To reconfigure Pi-hole you'll either need to use an existing container environment variables or if there is no a variable for what you need, use the web UI or CLI commands.
|
||||
|
||||
@@ -227,7 +272,7 @@ Similarly for the webserver you can customize configs in /etc/lighttpd
|
||||
|
||||
### Systemd init script
|
||||
|
||||
As long as your docker system service auto starts on boot and you run your container with `--restart=unless-stopped` your container should always start on boot and restart on crashes. If you prefer to have your docker container run as a systemd service instead, add the file [pihole.service](https://raw.githubusercontent.com/pi-hole/docker-pi-hole/master/pihole.service) to "/etc/systemd/system"; customize whatever your container name is and remove `--restart=unless-stopped` from your docker run. Then after you have initially created the docker container using the docker run command above, you can control it with "systemctl start pihole" or "systemctl stop pihole" (instead of `docker start`/`docker stop`). You can also enable it to auto-start on boot with "systemctl enable pihole" (as opposed to `--restart=unless-stopped` and making sure docker service auto-starts on boot).
|
||||
As long as your docker system service auto starts on boot and you run your container with `--restart=unless-stopped` your container should always start on boot and restart on crashes. If you prefer to have your docker container run as a systemd service instead, add the file [pihole.service](https://raw.githubusercontent.com/pi-hole/docker-pi-hole/master/examples/pihole.service) to "/etc/systemd/system"; customize whatever your container name is and remove `--restart=unless-stopped` from your docker run. Then after you have initially created the docker container using the docker run command above, you can control it with "systemctl start pihole" or "systemctl stop pihole" (instead of `docker start`/`docker stop`). You can also enable it to auto-start on boot with "systemctl enable pihole" (as opposed to `--restart=unless-stopped` and making sure docker service auto-starts on boot).
|
||||
|
||||
NOTE: After initial run you may need to manually stop the docker container with "docker stop pihole" before the systemctl can start controlling the container.
|
||||
|
||||
@@ -237,11 +282,25 @@ DNSMasq / [FTLDNS](https://docs.pi-hole.net/ftldns/in-depth/#linux-capabilities)
|
||||
- `CAP_NET_BIND_SERVICE`: Allows FTLDNS binding to TCP/UDP sockets below 1024 (specifically DNS service on port 53)
|
||||
- `CAP_NET_RAW`: use raw and packet sockets (needed for handling DHCPv6 requests, and verifying that an IP is not in use before leasing it)
|
||||
- `CAP_NET_ADMIN`: modify routing tables and other network-related operations (in particular inserting an entry in the neighbor table to answer DHCP requests using unicast packets)
|
||||
- `CAP_SYS_NICE`: FTL sets itself as an important process to get some more processing time if the latter is running low
|
||||
- `CAP_CHOWN`: we need to be able to change ownership of log files and databases in case FTL is started as a different user than `pihole`
|
||||
|
||||
This image automatically grants those capabilities, if available, to the FTLDNS process, even when run as non-root.\
|
||||
By default, docker does not include the `NET_ADMIN` capability for non-privileged containers, and it is recommended to explicitly add it to the container using `--cap-add=NET_ADMIN`.\
|
||||
However, if DHCP and IPv6 Router Advertisements are not in use, it should be safe to skip it. For the most paranoid, it should even be possible to explicitly drop the `NET_RAW` capability to prevent FTLDNS from automatically gaining it.
|
||||
|
||||
|
||||
## Note on Watchtower
|
||||
|
||||
We have noticed that a lot of people use Watchtower to keep their Pi-hole containers up to date. For the same reason we don't provide an auto-update feature on a bare metal install, you _should not_ have a system automatically update your Pi-hole container. Especially unattended. As much as we try to ensure nothing will go wrong, sometimes things do go wrong - and you need to set aside time to _manually_ pull and update to the version of the container you wish to run. The upgrade process should be along the lines of:
|
||||
|
||||
- **Important**: Read the release notes. Sometimes you will need to make changes other than just updating the image
|
||||
- Pull the new image
|
||||
- Stop and _remove_ the running Pi-hole container
|
||||
- If you care about your data (logs/customizations), make sure you have it volume-mapped or it will be deleted in this step.
|
||||
- Recreate the container using the new image
|
||||
|
||||
Pi-hole is an integral part of your network, don't let it fall over because of an unattended update in the middle of the night.
|
||||
# User Feedback
|
||||
|
||||
Please report issues on the [GitHub project](https://github.com/pi-hole/docker-pi-hole) when you suspect something docker related. Pi-hole or general docker questions are best answered on our [user forums](https://github.com/pi-hole/pi-hole/blob/master/README.md#get-help-or-connect-with-us-on-the-web). Ping me (@diginc) on the forums if it's a docker container and you're not sure if it's docker related.
|
||||
Please report issues on the [GitHub project](https://github.com/pi-hole/docker-pi-hole) when you suspect something docker related. Pi-hole or general docker questions are best answered on our [user forums](https://discourse.pi-hole.net/c/bugs-problems-issues/docker/30).
|
||||
|
||||
21
TESTING.md
21
TESTING.md
@@ -1,21 +0,0 @@
|
||||
# Prerequisites
|
||||
|
||||
Make sure you have docker, python, and pip. I won't cover how to install those here, please search the internet for that info if you need it.
|
||||
|
||||
# Running tests locally
|
||||
|
||||
Travis-ci auto runs tests during pull requests (PR) but it only has 2 cores and if you have more/faster cpus your PC's local tests will be faster and you'll have quicker feedback loops than continually pushing to have your PR run travis-ci
|
||||
|
||||
After you have the prereqs, to get the required pip packages run: `pip install -r requirements.txt`
|
||||
|
||||
To run the Dockerfile templating, image build, and tests all in one command just run: `tox`
|
||||
|
||||
# Local image names
|
||||
|
||||
Docker images built by `tox` or `python Dockerfile.py` are named the same but stripped of the `pihole/` docker repository namespace.
|
||||
|
||||
e.g. `pi-hole:debian_amd64` or `pi-hole-multiarch:debian_arm64`
|
||||
|
||||
You can run the multiarch images on an amd64 development system if you [enable binfmt-support as described in the multiarch image docs](https://hub.docker.com/r/multiarch/multiarch/debian-debootstrap/)
|
||||
|
||||
`docker run --rm --privileged multiarch/qemu-user-static:register --reset`
|
||||
@@ -1,382 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Some of the bash_functions use variables these core pi-hole/web scripts
|
||||
. /opt/pihole/webpage.sh
|
||||
|
||||
docker_checks() {
|
||||
warn_msg='WARNING Misconfigured DNS in /etc/resolv.conf'
|
||||
ns_count="$(grep -c nameserver /etc/resolv.conf)"
|
||||
ns_primary="$(grep nameserver /etc/resolv.conf | head -1)"
|
||||
ns_primary="${ns_primary/nameserver /}"
|
||||
warned=false
|
||||
|
||||
if [ "$ns_count" -lt 2 ] ; then
|
||||
echo "$warn_msg: Two DNS servers are recommended, 127.0.0.1 and any backup server"
|
||||
warned=true
|
||||
fi
|
||||
|
||||
if [ "$ns_primary" != "127.0.0.1" ] ; then
|
||||
echo "$warn_msg: Primary DNS should be 127.0.0.1 (found ${ns_primary})"
|
||||
warned=true
|
||||
fi
|
||||
|
||||
if ! $warned ; then
|
||||
echo "OK: Checks passed for /etc/resolv.conf DNS servers"
|
||||
fi
|
||||
|
||||
echo
|
||||
cat /etc/resolv.conf
|
||||
}
|
||||
|
||||
fix_capabilities() {
|
||||
setcap CAP_NET_BIND_SERVICE,CAP_NET_RAW,CAP_NET_ADMIN+ei $(which pihole-FTL) || ret=$?
|
||||
|
||||
if [[ $ret -ne 0 && "${DNSMASQ_USER:-root}" != "root" ]]; then
|
||||
echo "ERROR: Failed to set capabilities for pihole-FTL. Cannot run as non-root."
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
prepare_configs() {
|
||||
# Done in /start.sh, don't do twice
|
||||
PH_TEST=true . $PIHOLE_INSTALL
|
||||
distro_check
|
||||
installConfigs
|
||||
touch "$setupVars"
|
||||
set +e
|
||||
mkdir -p /var/run/pihole /var/log/pihole
|
||||
# Re-apply perms from basic-install over any volume mounts that may be present (or not)
|
||||
# Also similar to preflights for FTL https://github.com/pi-hole/pi-hole/blob/master/advanced/Templates/pihole-FTL.service
|
||||
chown pihole:root /etc/lighttpd
|
||||
chown pihole:pihole "${PI_HOLE_CONFIG_DIR}/pihole-FTL.conf" "/var/log/pihole" "${regexFile}"
|
||||
chmod 644 "${PI_HOLE_CONFIG_DIR}/pihole-FTL.conf"
|
||||
# not sure why pihole:pihole user/group write perms are not enough for web to write...dirty fix:
|
||||
chmod 777 "${regexFile}"
|
||||
touch /var/log/pihole-FTL.log /run/pihole-FTL.pid /run/pihole-FTL.port /var/log/pihole.log
|
||||
chown pihole:pihole /var/run/pihole /var/log/pihole
|
||||
test -f /var/run/pihole/FTL.sock && rm /var/run/pihole/FTL.sock
|
||||
chown pihole:pihole /var/log/pihole-FTL.log /run/pihole-FTL.pid /run/pihole-FTL.port /etc/pihole /etc/pihole/dhcp.leases /var/log/pihole.log
|
||||
chmod 0644 /var/log/pihole-FTL.log /run/pihole-FTL.pid /run/pihole-FTL.port /var/log/pihole.log
|
||||
set -e
|
||||
# Update version numbers
|
||||
pihole updatechecker
|
||||
# Re-write all of the setupVars to ensure required ones are present (like QUERY_LOGGING)
|
||||
|
||||
# If the setup variable file exists,
|
||||
if [[ -e "${setupVars}" ]]; then
|
||||
# update the variables in the file
|
||||
local USERWEBPASSWORD="${WEBPASSWORD}"
|
||||
. "${setupVars}"
|
||||
# Stash and pop the user password to avoid setting the password to the hashed setupVar variable
|
||||
WEBPASSWORD="${USERWEBPASSWORD}"
|
||||
# Clean up old before re-writing the required setupVars
|
||||
sed -i.update.bak '/PIHOLE_INTERFACE/d;/IPV4_ADDRESS/d;/IPV6_ADDRESS/d;/QUERY_LOGGING/d;/INSTALL_WEB_SERVER/d;/INSTALL_WEB_INTERFACE/d;/LIGHTTPD_ENABLED/d;' "${setupVars}"
|
||||
fi
|
||||
# echo the information to the user
|
||||
{
|
||||
echo "PIHOLE_INTERFACE=${PIHOLE_INTERFACE}"
|
||||
echo "IPV4_ADDRESS=${IPV4_ADDRESS}"
|
||||
echo "IPV6_ADDRESS=${IPV6_ADDRESS}"
|
||||
echo "QUERY_LOGGING=${QUERY_LOGGING}"
|
||||
echo "INSTALL_WEB_SERVER=${INSTALL_WEB_SERVER}"
|
||||
echo "INSTALL_WEB_INTERFACE=${INSTALL_WEB_INTERFACE}"
|
||||
echo "LIGHTTPD_ENABLED=${LIGHTTPD_ENABLED}"
|
||||
}>> "${setupVars}"
|
||||
}
|
||||
|
||||
validate_env() {
|
||||
# Optional ServerIP is a valid IP
|
||||
# nc won't throw any text based errors when it times out connecting to a valid IP, otherwise it complains about the DNS name being garbage
|
||||
# if nc doesn't behave as we expect on a valid IP the routing table should be able to look it up and return a 0 retcode
|
||||
if [[ "$(nc -4 -w1 -z "$ServerIP" 53 2>&1)" != "" ]] || ! ip route get "$ServerIP" > /dev/null ; then
|
||||
echo "ERROR: ServerIP Environment variable ($ServerIP) doesn't appear to be a valid IPv4 address"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Optional IPv6 is a valid address
|
||||
if [[ -n "$ServerIPv6" ]] ; then
|
||||
if [[ "$ServerIPv6" == 'kernel' ]] ; then
|
||||
echo "ERROR: You passed in IPv6 with a value of 'kernel', this maybe beacuse you do not have IPv6 enabled on your network"
|
||||
unset ServerIPv6
|
||||
exit 1
|
||||
fi
|
||||
if [[ "$(nc -6 -w1 -z "$ServerIPv6" 53 2>&1)" != "" ]] || ! ip route get "$ServerIPv6" > /dev/null ; then
|
||||
echo "ERROR: ServerIPv6 Environment variable ($ServerIPv6) doesn't appear to be a valid IPv6 address"
|
||||
echo " TIP: If your server is not IPv6 enabled just remove '-e ServerIPv6' from your docker container"
|
||||
exit 1
|
||||
fi
|
||||
fi;
|
||||
}
|
||||
|
||||
setup_dnsmasq_dns() {
|
||||
. /opt/pihole/webpage.sh
|
||||
local DNS1="${1:-8.8.8.8}"
|
||||
local DNS2="${2:-8.8.4.4}"
|
||||
local dnsType='default'
|
||||
if [ "$DNS1" != '8.8.8.8' ] || [ "$DNS2" != '8.8.4.4' ] ; then
|
||||
dnsType='custom'
|
||||
fi;
|
||||
|
||||
# TODO With the addition of this to /start.sh this needs a refactor
|
||||
if [ ! -f /.piholeFirstBoot ] ; then
|
||||
local setupDNS1="$(grep 'PIHOLE_DNS_1' ${setupVars})"
|
||||
local setupDNS2="$(grep 'PIHOLE_DNS_2' ${setupVars})"
|
||||
setupDNS1="${setupDNS1/PIHOLE_DNS_1=/}"
|
||||
setupDNS2="${setupDNS2/PIHOLE_DNS_2=/}"
|
||||
if [[ -n "$DNS1" && -n "$setupDNS1" ]] || \
|
||||
[[ -n "$DNS2" && -n "$setupDNS2" ]] ; then
|
||||
echo "Docker DNS variables not used"
|
||||
fi
|
||||
echo "Existing DNS servers used (${setupDNS1:-unset} & ${setupDNS2:-unset})"
|
||||
return
|
||||
fi
|
||||
|
||||
echo "Using $dnsType DNS servers: $DNS1 & $DNS2"
|
||||
if [[ -n "$DNS1" && -z "$setupDNS1" ]] ; then
|
||||
change_setting "PIHOLE_DNS_1" "${DNS1}"
|
||||
fi
|
||||
if [[ -n "$DNS2" && -z "$setupDNS2" ]] ; then
|
||||
if [[ "$DNS2" == "no" ]] ; then
|
||||
delete_setting "PIHOLE_DNS_2"
|
||||
unset PIHOLE_DNS_2
|
||||
else
|
||||
change_setting "PIHOLE_DNS_2" "${DNS2}"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
setup_dnsmasq_interface() {
|
||||
local interface="${1:-eth0}"
|
||||
local interfaceType='default'
|
||||
if [ "$interface" != 'eth0' ] ; then
|
||||
interfaceType='custom'
|
||||
fi;
|
||||
echo "DNSMasq binding to $interfaceType interface: $interface"
|
||||
[ -n "$interface" ] && change_setting "PIHOLE_INTERFACE" "${interface}"
|
||||
}
|
||||
|
||||
setup_dnsmasq_listening_behaviour() {
|
||||
local dnsmasq_listening_behaviour="${1}"
|
||||
|
||||
if [ -n "$dnsmasq_listening_behaviour" ]; then
|
||||
change_setting "DNSMASQ_LISTENING" "${dnsmasq_listening_behaviour}"
|
||||
fi;
|
||||
}
|
||||
|
||||
setup_dnsmasq_config_if_missing() {
|
||||
# When fresh empty directory volumes are used we miss this file
|
||||
if [ ! -f /etc/dnsmasq.d/01-pihole.conf ] ; then
|
||||
cp /etc/.pihole/advanced/01-pihole.conf /etc/dnsmasq.d/
|
||||
fi;
|
||||
}
|
||||
|
||||
setup_dnsmasq() {
|
||||
local dns1="$1"
|
||||
local dns2="$2"
|
||||
local interface="$3"
|
||||
local dnsmasq_listening_behaviour="$4"
|
||||
# Coordinates
|
||||
setup_dnsmasq_config_if_missing
|
||||
setup_dnsmasq_dns "$dns1" "$dns2"
|
||||
setup_dnsmasq_interface "$interface"
|
||||
setup_dnsmasq_listening_behaviour "$dnsmasq_listening_behaviour"
|
||||
setup_dnsmasq_user "${DNSMASQ_USER}"
|
||||
ProcessDNSSettings
|
||||
}
|
||||
|
||||
setup_dnsmasq_user() {
|
||||
local DNSMASQ_USER="${1}"
|
||||
|
||||
# Run DNSMASQ as root user to avoid SHM permission issues
|
||||
if grep -r -q '^\s*user=' /etc/dnsmasq.* ; then
|
||||
# Change user that had been set previously to root
|
||||
for f in $(grep -r -l '^\s*user=' /etc/dnsmasq.*); do
|
||||
sed -i "/^\s*user=/ c\user=${DNSMASQ_USER}" "${f}"
|
||||
done
|
||||
else
|
||||
echo -e "\nuser=${DNSMASQ_USER}" >> /etc/dnsmasq.conf
|
||||
fi
|
||||
}
|
||||
|
||||
setup_dnsmasq_hostnames() {
|
||||
# largely borrowed from automated install/basic-install.sh
|
||||
local IPV4_ADDRESS="${1}"
|
||||
local IPV6_ADDRESS="${2}"
|
||||
local hostname="${3}"
|
||||
local dnsmasq_pihole_01_location="/etc/dnsmasq.d/01-pihole.conf"
|
||||
|
||||
if [ -z "$hostname" ]; then
|
||||
if [[ -f /etc/hostname ]]; then
|
||||
hostname=$(</etc/hostname)
|
||||
elif [ -x "$(command -v hostname)" ]; then
|
||||
hostname=$(hostname -f)
|
||||
fi
|
||||
fi;
|
||||
|
||||
if [[ "${IPV4_ADDRESS}" != "" ]]; then
|
||||
tmp=${IPV4_ADDRESS%/*}
|
||||
sed -i "s/@IPV4@/$tmp/" ${dnsmasq_pihole_01_location}
|
||||
else
|
||||
sed -i '/^address=\/pi.hole\/@IPV4@/d' ${dnsmasq_pihole_01_location}
|
||||
sed -i '/^address=\/@HOSTNAME@\/@IPV4@/d' ${dnsmasq_pihole_01_location}
|
||||
fi
|
||||
|
||||
if [[ "${IPV6_ADDRESS}" != "" ]]; then
|
||||
sed -i "s/@IPv6@/$IPV6_ADDRESS/" ${dnsmasq_pihole_01_location}
|
||||
else
|
||||
sed -i '/^address=\/pi.hole\/@IPv6@/d' ${dnsmasq_pihole_01_location}
|
||||
sed -i '/^address=\/@HOSTNAME@\/@IPv6@/d' ${dnsmasq_pihole_01_location}
|
||||
fi
|
||||
|
||||
if [[ "${hostname}" != "" ]]; then
|
||||
sed -i "s/@HOSTNAME@/$hostname/" ${dnsmasq_pihole_01_location}
|
||||
else
|
||||
sed -i '/^address=\/@HOSTNAME@*/d' ${dnsmasq_pihole_01_location}
|
||||
fi
|
||||
}
|
||||
|
||||
setup_lighttpd_bind() {
|
||||
local serverip="$1"
|
||||
# if using '--net=host' only bind lighttpd on $ServerIP and localhost
|
||||
if grep -q "docker" /proc/net/dev ; then #docker (docker0 by default) should only be present on the host system
|
||||
if ! grep -q "server.bind" /etc/lighttpd/lighttpd.conf ; then # if the declaration is already there, don't add it again
|
||||
sed -i -E "s/server\.port\s+\=\s+([0-9]+)/server.bind\t\t = \"${serverip}\"\nserver.port\t\t = \1\n"\$SERVER"\[\"socket\"\] == \"127\.0\.0\.1:\1\" \{\}/" /etc/lighttpd/lighttpd.conf
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
setup_php_env() {
|
||||
if [ -z "$VIRTUAL_HOST" ] ; then
|
||||
VIRTUAL_HOST="$ServerIP"
|
||||
fi;
|
||||
local vhost_line="\t\t\t\"VIRTUAL_HOST\" => \"${VIRTUAL_HOST}\","
|
||||
local serverip_line="\t\t\t\"ServerIP\" => \"${ServerIP}\","
|
||||
local php_error_line="\t\t\t\"PHP_ERROR_LOG\" => \"${PHP_ERROR_LOG}\","
|
||||
|
||||
# idempotent line additions
|
||||
grep -qP "$vhost_line" "$PHP_ENV_CONFIG" || \
|
||||
sed -i "/bin-environment/ a\\${vhost_line}" "$PHP_ENV_CONFIG"
|
||||
grep -qP "$serverip_line" "$PHP_ENV_CONFIG" || \
|
||||
sed -i "/bin-environment/ a\\${serverip_line}" "$PHP_ENV_CONFIG"
|
||||
grep -qP "$php_error_line" "$PHP_ENV_CONFIG" || \
|
||||
sed -i "/bin-environment/ a\\${php_error_line}" "$PHP_ENV_CONFIG"
|
||||
|
||||
echo "Added ENV to php:"
|
||||
grep -E '(VIRTUAL_HOST|ServerIP|PHP_ERROR_LOG)' "$PHP_ENV_CONFIG"
|
||||
}
|
||||
|
||||
setup_web_port() {
|
||||
local warning="WARNING: Custom WEB_PORT not used"
|
||||
# Quietly exit early for empty or default
|
||||
if [[ -z "${1}" || "${1}" == '80' ]] ; then return ; fi
|
||||
|
||||
if ! echo $1 | grep -q '^[0-9][0-9]*$' ; then
|
||||
echo "$warning - $1 is not an integer"
|
||||
return
|
||||
fi
|
||||
|
||||
local -i web_port="$1"
|
||||
if (( $web_port < 1 || $web_port > 65535 )); then
|
||||
echo "$warning - $web_port is not within valid port range of 1-65535"
|
||||
return
|
||||
fi
|
||||
echo "Custom WEB_PORT set to $web_port"
|
||||
echo "INFO: Without proper router DNAT forwarding to $ServerIP:$web_port, you may not get any blocked websites on ads"
|
||||
|
||||
# Update any default port 80 references in the HTML
|
||||
grep -Prl '://127\.0\.0\.1/' /var/www/html/ | xargs -r sed -i "s|/127\.0\.0\.1/|/127.0.0.1:${WEB_PORT}/|g"
|
||||
grep -Prl '://pi\.hole/' /var/www/html/ | xargs -r sed -i "s|/pi\.hole/|/pi\.hole:${WEB_PORT}/|g"
|
||||
# Update lighttpd's port
|
||||
sed -i '/server.port\s*=\s*80\s*$/ s/80/'$WEB_PORT'/g' /etc/lighttpd/lighttpd.conf
|
||||
|
||||
}
|
||||
|
||||
generate_password() {
|
||||
if [ -z "${WEBPASSWORD+x}" ] ; then
|
||||
# Not set at all, give the user a random pass
|
||||
WEBPASSWORD=$(tr -dc _A-Z-a-z-0-9 < /dev/urandom | head -c 8)
|
||||
echo "Assigning random password: $WEBPASSWORD"
|
||||
fi;
|
||||
}
|
||||
|
||||
setup_web_password() {
|
||||
setup_var_exists "WEBPASSWORD" && return
|
||||
|
||||
PASS="$1"
|
||||
# Turn bash debug on while setting up password (to print it)
|
||||
if [[ "$PASS" == "" ]] ; then
|
||||
echo "" | pihole -a -p
|
||||
else
|
||||
echo "Setting password: ${PASS}"
|
||||
set -x
|
||||
pihole -a -p "$PASS" "$PASS"
|
||||
fi
|
||||
# Turn bash debug back off after print password setup
|
||||
# (subshell to null hides printing output)
|
||||
{ set +x; } 2>/dev/null
|
||||
|
||||
# To avoid printing this if conditional in bash debug, turn off debug above..
|
||||
# then re-enable debug if necessary (more code but cleaner printed output)
|
||||
if [ "${PH_VERBOSE:-0}" -gt 0 ] ; then
|
||||
set -x
|
||||
fi
|
||||
}
|
||||
|
||||
setup_ipv4_ipv6() {
|
||||
local ip_versions="IPv4 and IPv6"
|
||||
if [ "$IPv6" != "True" ] ; then
|
||||
ip_versions="IPv4"
|
||||
sed -i '/use-ipv6.pl/ d' /etc/lighttpd/lighttpd.conf
|
||||
fi;
|
||||
echo "Using $ip_versions"
|
||||
}
|
||||
|
||||
test_configs() {
|
||||
set -e
|
||||
echo -n '::: Testing pihole-FTL DNS: '
|
||||
sudo -u ${DNSMASQ_USER:-root} pihole-FTL test || exit 1
|
||||
echo -n '::: Testing lighttpd config: '
|
||||
lighttpd -t -f /etc/lighttpd/lighttpd.conf || exit 1
|
||||
set +e
|
||||
echo "::: All config checks passed, cleared for startup ..."
|
||||
}
|
||||
|
||||
|
||||
setup_blocklists() {
|
||||
local blocklists="$1"
|
||||
# Exit/return early without setting up adlists with defaults for any of the following conditions:
|
||||
# 1. skip_setup_blocklists env is set
|
||||
exit_string="(exiting ${FUNCNAME[0]} early)"
|
||||
|
||||
if [ -n "${skip_setup_blocklists}" ]; then
|
||||
echo "::: skip_setup_blocklists requested ($exit_string)"
|
||||
return
|
||||
fi
|
||||
|
||||
# 2. The adlist file exists already (restarted container or volume mounted list)
|
||||
if [ -f "${adlistFile}" ]; then
|
||||
echo "::: Preexisting ad list ${adlistFile} detected ($exit_string)"
|
||||
cat "${adlistFile}"
|
||||
return
|
||||
fi
|
||||
|
||||
echo "::: ${FUNCNAME[0]} now setting default blocklists up: "
|
||||
echo "::: TIP: Use a docker volume for ${adlistFile} if you want to customize for first boot"
|
||||
installDefaultBlocklists
|
||||
|
||||
echo "::: Blocklists (${adlistFile}) now set to:"
|
||||
cat "${adlistFile}"
|
||||
}
|
||||
|
||||
setup_var_exists() {
|
||||
local KEY="$1"
|
||||
if [ -n "$2" ]; then
|
||||
local REQUIRED_VALUE="[^\n]+"
|
||||
fi
|
||||
if grep -Pq "^${KEY}=${REQUIRED_VALUE}" "$setupVars"; then
|
||||
echo "::: Pre existing ${KEY} found"
|
||||
true
|
||||
else
|
||||
false
|
||||
fi
|
||||
}
|
||||
|
||||
20
build-and-test.sh
Executable file
20
build-and-test.sh
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env bash
|
||||
set -ex
|
||||
|
||||
if [[ "$1" == "enter" ]]; then
|
||||
enter="-it --entrypoint=bash"
|
||||
fi
|
||||
|
||||
GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD | sed "s/\//-/g")
|
||||
GIT_TAG=$(git describe --tags --exact-match 2> /dev/null || true)
|
||||
GIT_TAG="${GIT_TAG:-$GIT_BRANCH}"
|
||||
|
||||
# generate and build dockerfile
|
||||
docker build --tag image_pipenv --file test/Dockerfile test/
|
||||
docker run --rm \
|
||||
--volume /var/run/docker.sock:/var/run/docker.sock \
|
||||
--volume "$(pwd):/$(pwd)" \
|
||||
--workdir "$(pwd)" \
|
||||
--env PIPENV_CACHE_DIR="$(pwd)/.pipenv" \
|
||||
--env GIT_TAG="${GIT_TAG}" \
|
||||
${enter} image_pipenv
|
||||
@@ -1,51 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -ex
|
||||
# Circle CI Job for merging/deploying all architectures (post-test passing)
|
||||
. circle-vars.sh
|
||||
|
||||
annotate() {
|
||||
local base=$1
|
||||
local image=$2
|
||||
local arch=$3
|
||||
local annotate_flags="${annotate_map[$arch]}"
|
||||
|
||||
$dry docker manifest annotate ${base} ${image} --os linux ${annotate_flags}
|
||||
}
|
||||
|
||||
# Keep in sync with circle-ci job names
|
||||
declare -A annotate_map=(
|
||||
["amd64"]="--arch amd64"
|
||||
["armel"]="--arch arm --variant v6"
|
||||
["armhf"]="--arch arm --variant v7"
|
||||
["arm64"]="--arch arm64 --variant v8"
|
||||
)
|
||||
|
||||
# push image when not running a PR
|
||||
mkdir -p ~/.docker
|
||||
export DOCKER_CLI_EXPERIMENTAL='enabled'
|
||||
echo "{}" | jq '.experimental="enabled"' | tee ~/.docker/config.json
|
||||
docker info
|
||||
if [[ "$CIRCLE_PR_NUMBER" == "" ]]; then
|
||||
images=()
|
||||
echo $DOCKERHUB_PASS | docker login --username=$DOCKERHUB_USER --password-stdin
|
||||
ls -lat ./ci-workspace/
|
||||
cd ci-workspace
|
||||
|
||||
for arch in *; do
|
||||
arch_image=$(cat $arch)
|
||||
docker pull $arch_image
|
||||
images+=($arch_image)
|
||||
done
|
||||
|
||||
for docker_tag in $MULTIARCH_IMAGE $LATEST_IMAGE; do
|
||||
docker manifest create $docker_tag ${images[*]}
|
||||
for arch in *; do
|
||||
arch_image=$(cat $arch)
|
||||
docker pull $arch_image
|
||||
annotate "$docker_tag" "$arch_image" "$arch"
|
||||
done
|
||||
|
||||
docker manifest inspect "$docker_tag"
|
||||
docker manifest push "$docker_tag"
|
||||
done;
|
||||
fi
|
||||
@@ -1,30 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -ex
|
||||
|
||||
# Circle CI Job for single architecture
|
||||
|
||||
# setup qemu/variables
|
||||
docker run --rm --privileged multiarch/qemu-user-static:register --reset > /dev/null
|
||||
. circle-vars.sh
|
||||
|
||||
if [[ "$1" == "enter" ]]; then
|
||||
enter="-it --entrypoint=sh"
|
||||
fi
|
||||
|
||||
# generate and build dockerfile
|
||||
docker build -t image_pipenv -f Dockerfile_build .
|
||||
env > /tmp/env
|
||||
docker run --rm \
|
||||
-v /var/run/docker.sock:/var/run/docker.sock \
|
||||
-v "$(pwd):/$(pwd)" \
|
||||
-w "$(pwd)" \
|
||||
-e PIPENV_CACHE_DIR="$(pwd)/.pipenv" \
|
||||
--env-file /tmp/env \
|
||||
$enter image_pipenv
|
||||
# docker run --rm -v /var/run/docker.sock:/var/run/docker.sock -v "$(pwd):/$(pwd)" -w "$(pwd)" --env-file /tmp/env image_pipenv /ws/Dockerfile.sh
|
||||
|
||||
docker images
|
||||
echo $DOCKERHUB_PASS | docker login --username=$DOCKERHUB_USER --password-stdin
|
||||
docker push $ARCH_IMAGE
|
||||
mkdir -p ci-workspace
|
||||
echo "$ARCH_IMAGE" | tee ./ci-workspace/$ARCH
|
||||
@@ -1,49 +0,0 @@
|
||||
set -a
|
||||
|
||||
CIRCLE_JOB="${CIRCLE_JOB:-}"
|
||||
ARCH="${ARCH:-$CIRCLE_JOB}"
|
||||
if [[ -z "$ARCH" ]] ; then
|
||||
echo "Defaulting arch to amd64"
|
||||
ARCH="amd64"
|
||||
fi
|
||||
BASE_IMAGE="${BASE_IMAGE:-${CIRCLE_PROJECT_REPONAME}}"
|
||||
if [[ -z "$BASE_IMAGE" ]] ; then
|
||||
echo "Defaulting image name to pihole"
|
||||
BASE_IMAGE="pihole"
|
||||
fi
|
||||
|
||||
# The docker image will match the github repo path by default but is overrideable with CircleCI environment
|
||||
# BASE_IMAGE Overridable by Circle environment, including namespace (e.g. BASE_IMAGE=bobsmith/test-img:latest)
|
||||
CIRCLE_PROJECT_USERNAME="${CIRCLE_PROJECT_USERNAME:-unset}"
|
||||
HUB_NAMESPACE="${HUB_NAMESPACE:-$CIRCLE_PROJECT_USERNAME}"
|
||||
[[ $CIRCLE_PROJECT_USERNAME == "pi-hole" ]] && HUB_NAMESPACE="pihole" # Custom mapping for namespace
|
||||
[[ $BASE_IMAGE != *"/"* ]] && BASE_IMAGE="${HUB_NAMESPACE}/${BASE_IMAGE}" # If missing namespace, add one
|
||||
|
||||
# Secondary docker tag info (origin github branch/tag) will get prepended also
|
||||
ARCH_IMAGE="$BASE_IMAGE"
|
||||
[[ $ARCH_IMAGE != *":"* ]] && ARCH_IMAGE="${BASE_IMAGE}:$ARCH" # If tag missing, add circle job name as a tag (architecture here)
|
||||
|
||||
DOCKER_TAG="${CIRCLE_TAG:-$CIRCLE_BRANCH}"
|
||||
if [[ -n "$DOCKER_TAG" ]]; then
|
||||
# remove latest tag if used (as part of a user provided image variable)
|
||||
ARCH_IMAGE="${ARCH_IMAGE/:latest/:}"
|
||||
# Prepend the github tag(version) or branch. image:arch = image:v1.0-arch
|
||||
ARCH_IMAGE="${ARCH_IMAGE/:/:${DOCKER_TAG}-}"
|
||||
# latest- sometimes has a trailing slash, remove it
|
||||
ARCH_IMAGE="${ARCH_IMAGE/%-/}"
|
||||
fi
|
||||
|
||||
# To get latest released, cut a release on https://github.com/pi-hole/docker-pi-hole/releases (manually gated for quality control)
|
||||
latest_tag=''
|
||||
if ! latest_tag=$(curl -sI https://github.com/pi-hole/docker-pi-hole/releases/latest | grep --color=never -i Location | awk -F / '{print $NF}' | tr -d '[:cntrl:]'); then
|
||||
print "Failed to retrieve latest docker-pi-hole release metadata"
|
||||
else
|
||||
if [[ "$DOCKER_TAG" == "$latest_tag" ]] ; then
|
||||
#LATEST_IMAGE="$BASE_IMAGE:latest"
|
||||
LATEST_IMAGE="$BASE_IMAGE:testing_latest_deleteme"
|
||||
fi
|
||||
fi
|
||||
|
||||
MULTIARCH_IMAGE="$BASE_IMAGE:$DOCKER_TAG"
|
||||
|
||||
set +a
|
||||
@@ -1,108 +0,0 @@
|
||||
Please note the following about this [traefik](https://traefik.io/) example for Docker Pi-hole
|
||||
|
||||
- Still requires standard Pi-hole setup steps, make sure you've gone through the [README](https://github.com/pihole/docker-pi-hole/blob/master/README.md) and understand how to setup Pi-hole without traefik first
|
||||
- Update these things before using:
|
||||
- set instances of `homedomain.lan` below to your home domain (typically set in your router)
|
||||
- set your Pi-hole ENV WEBPASSWORD if you don't want a random admin pass
|
||||
- This works for me, Your mileage may vary!
|
||||
- For support, do your best to figure out traefik issues on your own:
|
||||
- by looking at logs and traefik web interface on port 8080
|
||||
- also by searching the web and searching their forums/docker issues for similar question/problems
|
||||
- Port 8053 is mapped directly to Pi-hole to serve as a back door without going through traefik
|
||||
- There is some delay after starting your container before traefik forwards the HTTP traffic correctly, give it a minute
|
||||
|
||||
```
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
#
|
||||
traefik:
|
||||
container_name: traefik
|
||||
domainname: homedomain.lan
|
||||
|
||||
image: traefik
|
||||
restart: unless-stopped
|
||||
# Note I opt to whitelist certain apps for exposure to traefik instead of auto discovery
|
||||
# use `--docker.exposedbydefault=true` if you don't want to have to do this
|
||||
command: "--web --docker --docker.domain=homedomain.lan --docker.exposedbydefault=false --logLevel=DEBUG"
|
||||
ports:
|
||||
- "80:80"
|
||||
- "443:443"
|
||||
- "8080:8080"
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
- /dev/null:/traefik.toml
|
||||
networks:
|
||||
- default
|
||||
- discovery
|
||||
dns:
|
||||
- 192.168.1.50
|
||||
- 192.168.1.1
|
||||
|
||||
pihole:
|
||||
container_name: pihole
|
||||
domainname: homedomain.lan
|
||||
|
||||
image: pihole/pihole:latest
|
||||
dns:
|
||||
- 127.0.0.1
|
||||
- 1.1.1.1
|
||||
ports:
|
||||
- '0.0.0.0:53:53/tcp'
|
||||
- '0.0.0.0:53:53/udp'
|
||||
- '0.0.0.0:67:67/udp'
|
||||
- '0.0.0.0:8053:80/tcp'
|
||||
volumes:
|
||||
- ./etc-pihole/:/etc/pihole/
|
||||
- ./etc-dnsmasqd/:/etc/dnsmasq.d/
|
||||
# run `touch ./pihole.log` first unless you like errors
|
||||
# - ./pihole.log:/var/log/pihole.log
|
||||
environment:
|
||||
ServerIP: 192.168.1.50
|
||||
PROXY_LOCATION: pihole
|
||||
VIRTUAL_HOST: pihole.homedomain.lan
|
||||
VIRTUAL_PORT: 80
|
||||
TZ: 'America/Chicago'
|
||||
# WEBPASSWORD:
|
||||
restart: unless-stopped
|
||||
labels:
|
||||
# required when using --docker.exposedbydefault=false
|
||||
- "traefik.enable=true"
|
||||
# https://www.techjunktrunk.com/docker/2017/11/03/traefik-default-server-catch-all/
|
||||
- "traefik.frontend.rule=HostRegexp:pihole.homedomain.lan,{catchall:.*}"
|
||||
- "traefik.frontend.priority=1"
|
||||
- "traefik.backend=pihole"
|
||||
- "traefik.port=80"
|
||||
|
||||
networks:
|
||||
# Discovery is manually created to avoid forcing any order of docker-compose stack creation (`docker network create discovery`)
|
||||
# allows other compose files to be seen by proxy
|
||||
# Not required if you aren't using multiple docker-compose files...
|
||||
discovery:
|
||||
external: true
|
||||
```
|
||||
|
||||
After running `docker-compose up -d` you should see this if you look at logs on traefik `docker-compose logs -f traefik`
|
||||
|
||||
```
|
||||
traefik | time="2018-03-07T18:57:41Z" level=debug msg="Provider event received {Status:health_status: healthy ID:33567e94e02c5adba3d47fa44c391e94fdea359fb05eecb196c95de288ffb861 From:pihole/pihole:latest Type:container Action:health_status: healthy Actor:{ID:33567e94
|
||||
e02c5adba3d47fa44c391e94fdea359fb05eecb196c95de288ffb861 Attributes:map[com.docker.compose.project:traefik image:pihole/pihole:latest traefik.frontend.priority:1 com.docker.compose.container-number:1 com.docker.compose.service:pihole com.docker.compose.version:1.19.0 name:pihole traefik.enable:true url:https://www.github.com/pihole/docker-pi-hole com.docker.compose.oneoff:False maintainer:adam@diginc.us traefik.backend:pihole traefik.frontend.rule:HostRegexp:pihole.homedomain.lan,{catchall:.*} traefik.port:80 com.docker.compose.config-
|
||||
hash:7551c3f4bd11766292c7dad81473ef21da91cae8666d1b04a42d1daab53fba0f]} Scope:local Time:1520449061 TimeNano:1520449061934970670}"
|
||||
traefik | time="2018-03-07T18:57:42Z" level=debug msg="Filtering disabled container /traefik"
|
||||
traefik | time="2018-03-07T18:57:42Z" level=debug msg="Could not load traefik.frontend.whitelistSourceRange labels"
|
||||
traefik | time="2018-03-07T18:57:42Z" level=debug msg="Could not load traefik.frontend.entryPoints labels"
|
||||
traefik | time="2018-03-07T18:57:42Z" level=debug msg="Could not load traefik.frontend.auth.basic labels"
|
||||
traefik | time="2018-03-07T18:57:42Z" level=debug msg="Validation of load balancer method for backend backend-pihole failed: invalid load-balancing method ''. Using default method wrr."
|
||||
traefik | time="2018-03-07T18:57:42Z" level=debug msg="Configuration received from provider docker: {"backends":{"backend-pihole":{"servers":{"server-pihole":{"url":"http://172.18.0.2:80","weight":0}},"loadBalancer":{"method":"wrr"}}},"frontends":{"frontend-HostRegexp
|
||||
-pihole-homedomain-lan-catchall-0":{"entryPoints":["http"],"backend":"backend-pihole","routes":{"route-frontend-HostRegexp-pihole-homedomain-lan-catchall-0":{"rule":"HostRegexp:pihole.homedomain.lan,{catchall:.*}"}},"passHostHeader":true,"priority":1,"basicAuth":[]}}}"
|
||||
traefik | time="2018-03-07T18:57:42Z" level=debug msg="Creating frontend frontend-HostRegexp-pihole-homedomain-lan-catchall-0"
|
||||
traefik | time="2018-03-07T18:57:42Z" level=debug msg="Wiring frontend frontend-HostRegexp-pihole-homedomain-lan-catchall-0 to entryPoint http"
|
||||
traefik | time="2018-03-07T18:57:42Z" level=debug msg="Creating route route-frontend-HostRegexp-pihole-homedomain-lan-catchall-0 HostRegexp:pihole.homedomain.lan,{catchall:.*}"
|
||||
traefik | time="2018-03-07T18:57:42Z" level=debug msg="Creating backend backend-pihole"
|
||||
traefik | time="2018-03-07T18:57:42Z" level=debug msg="Creating load-balancer wrr"
|
||||
traefik | time="2018-03-07T18:57:42Z" level=debug msg="Creating server server-pihole at http://172.18.0.2:80 with weight 0"
|
||||
traefik | time="2018-03-07T18:57:42Z" level=info msg="Server configuration reloaded on :80"
|
||||
traefik | time="2018-03-07T18:57:42Z" level=info msg="Server configuration reloaded on :8080"
|
||||
```
|
||||
|
||||
Also your port 8080 should list the Route/Rule for pihole and backend-pihole container.
|
||||
@@ -1 +0,0 @@
|
||||
docker-compose.yml
|
||||
@@ -3,8 +3,8 @@ version: "3"
|
||||
# https://github.com/pi-hole/docker-pi-hole/blob/master/README.md
|
||||
|
||||
services:
|
||||
jwilder-proxy:
|
||||
image: jwilder/nginx-proxy
|
||||
nginx-proxy:
|
||||
image: nginxproxy/nginx-proxy
|
||||
ports:
|
||||
- '80:80'
|
||||
environment:
|
||||
@@ -15,20 +15,16 @@ services:
|
||||
|
||||
pihole:
|
||||
image: pihole/pihole:latest
|
||||
dns:
|
||||
- 127.0.0.1
|
||||
- 1.1.1.1
|
||||
ports:
|
||||
- '53:53/tcp'
|
||||
- '53:53/udp'
|
||||
- "67:67/udp"
|
||||
- '8053:80/tcp'
|
||||
- "443:443/tcp"
|
||||
volumes:
|
||||
- './etc-pihole/:/etc/pihole/'
|
||||
- './etc-dnsmasq.d/:/etc/dnsmasq.d/'
|
||||
- './etc-pihole:/etc/pihole'
|
||||
- './etc-dnsmasq.d:/etc/dnsmasq.d'
|
||||
# run `touch ./var-log/pihole.log` first unless you like errors
|
||||
# - './var-log/pihole.log:/var/log/pihole.log'
|
||||
# - './var-log/pihole.log:/var/log/pihole/pihole.log'
|
||||
# Recommended but not required (DHCP needs NET_ADMIN)
|
||||
# https://github.com/pi-hole/docker-pi-hole#note-on-capabilities
|
||||
cap_add:
|
||||
@@ -41,7 +37,7 @@ services:
|
||||
extra_hosts:
|
||||
# Resolve to nothing domains (terminate connection)
|
||||
- 'nw2master.bioware.com nwn2.master.gamespy.com:0.0.0.0'
|
||||
# LAN hostnames for other docker containers using jwilder
|
||||
# LAN hostnames for other docker containers using nginx-proxy
|
||||
- 'yourDomain.lan:192.168.41.55'
|
||||
- 'pihole pihole.yourDomain.lan:192.168.41.55'
|
||||
- 'ghost ghost.yourDomain.lan:192.168.41.55'
|
||||
@@ -55,9 +51,9 @@ services:
|
||||
# ports:
|
||||
# - '2368:2368/tcp'
|
||||
# volumes:
|
||||
# - '/etc/ghost/:/ghost-override'
|
||||
# - '/etc/ghost:/ghost-override'
|
||||
# environment:
|
||||
# PROXY_LOCATION: ghost
|
||||
# VIRTUAL_HOST: ghost.yourDomain.lan
|
||||
# VIRTUAL_PORT: 2368
|
||||
# restart: always
|
||||
# restart: always
|
||||
@@ -12,21 +12,14 @@ services:
|
||||
- "53:53/udp"
|
||||
- "67:67/udp"
|
||||
- "80:80/tcp"
|
||||
- "443:443/tcp"
|
||||
environment:
|
||||
TZ: 'America/Chicago'
|
||||
# WEBPASSWORD: 'set a secure password here or it will be random'
|
||||
# Volumes store your data between container upgrades
|
||||
volumes:
|
||||
- './etc-pihole/:/etc/pihole/'
|
||||
- './etc-dnsmasq.d/:/etc/dnsmasq.d/'
|
||||
# run `touch ./var-log/pihole.log` first unless you like errors
|
||||
# - './var-log/pihole.log:/var/log/pihole.log'
|
||||
dns:
|
||||
- 127.0.0.1
|
||||
- 1.1.1.1
|
||||
# Recommended but not required (DHCP needs NET_ADMIN)
|
||||
- './etc-pihole:/etc/pihole'
|
||||
- './etc-dnsmasq.d:/etc/dnsmasq.d'
|
||||
# https://github.com/pi-hole/docker-pi-hole#note-on-capabilities
|
||||
cap_add:
|
||||
- NET_ADMIN
|
||||
restart: unless-stopped
|
||||
restart: unless-stopped # Recommended but not required (DHCP needs NET_ADMIN)
|
||||
@@ -22,7 +22,7 @@ PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
|
||||
# Download any updates from the adlists
|
||||
59 1 * * 7 root PATH="$PATH:/usr/local/bin/" docker exec $DOCKER_NAME pihole updateGravity > /dev/null
|
||||
|
||||
# Update docker-pi-hole by pulling the latest docker image ane re-creating your container.
|
||||
# Update docker-pi-hole by pulling the latest docker image and re-creating your container.
|
||||
# pihole software update commands are unsupported in docker!
|
||||
#30 2 * * 7 root PATH="$PATH:/usr/local/bin/" docker exec $DOCKER_NAME pihole updatePihole > /dev/null
|
||||
|
||||
@@ -2,23 +2,30 @@
|
||||
|
||||
# https://github.com/pi-hole/docker-pi-hole/blob/master/README.md
|
||||
|
||||
PIHOLE_BASE="${PIHOLE_BASE:-$(pwd)}"
|
||||
[[ -d "$PIHOLE_BASE" ]] || mkdir -p "$PIHOLE_BASE" || { echo "Couldn't create storage directory: $PIHOLE_BASE"; exit 1; }
|
||||
|
||||
# Note: FTLCONF_REPLY_ADDR4 should be replaced with your external ip.
|
||||
docker run -d \
|
||||
--name pihole \
|
||||
-p 53:53/tcp -p 53:53/udp \
|
||||
-p 80:80 \
|
||||
-p 443:443 \
|
||||
-e TZ="America/Chicago" \
|
||||
-v "$(pwd)/etc-pihole/:/etc/pihole/" \
|
||||
-v "$(pwd)/etc-dnsmasq.d/:/etc/dnsmasq.d/" \
|
||||
-v "${PIHOLE_BASE}/etc-pihole:/etc/pihole" \
|
||||
-v "${PIHOLE_BASE}/etc-dnsmasq.d:/etc/dnsmasq.d" \
|
||||
--dns=127.0.0.1 --dns=1.1.1.1 \
|
||||
--restart=unless-stopped \
|
||||
--hostname pi.hole \
|
||||
-e VIRTUAL_HOST="pi.hole" \
|
||||
-e PROXY_LOCATION="pi.hole" \
|
||||
-e FTLCONF_REPLY_ADDR4="127.0.0.1" \
|
||||
pihole/pihole:latest
|
||||
|
||||
printf 'Starting up pihole container '
|
||||
for i in $(seq 1 20); do
|
||||
if [ "$(docker inspect -f "{{.State.Health.Status}}" pihole)" == "healthy" ] ; then
|
||||
printf ' OK'
|
||||
echo -e "\n$(docker logs pihole 2> /dev/null | grep 'password:') for your pi-hole: https://${IP}/admin/"
|
||||
echo -e "\n$(docker logs pihole 2> /dev/null | grep 'password:') for your pi-hole: http://${IP}/admin/"
|
||||
exit 0
|
||||
else
|
||||
sleep 3
|
||||
@@ -26,7 +33,7 @@ for i in $(seq 1 20); do
|
||||
fi
|
||||
|
||||
if [ $i -eq 20 ] ; then
|
||||
echo -e "\nTimed out waiting for Pi-hole start, consult check your container logs for more info (\`docker logs pihole\`)"
|
||||
echo -e "\nTimed out waiting for Pi-hole start, consult your container logs for more info (\`docker logs pihole\`)"
|
||||
exit 1
|
||||
fi
|
||||
done;
|
||||
113
install.sh
113
install.sh
@@ -1,113 +0,0 @@
|
||||
#!/bin/bash -ex
|
||||
|
||||
mkdir -p /etc/pihole/
|
||||
mkdir -p /var/run/pihole
|
||||
# Production tags with valid web footers
|
||||
export CORE_VERSION="$(cat /etc/docker-pi-hole-version)"
|
||||
export WEB_VERSION="v4.3.3"
|
||||
|
||||
# Only use for pre-production / testing
|
||||
export CHECKOUT_BRANCHES=false
|
||||
# Search for release/* branch naming convention for custom checkouts
|
||||
if [[ "$CORE_VERSION" == *"release/"* ]] ; then
|
||||
CHECKOUT_BRANCHES=true
|
||||
fi
|
||||
|
||||
apt-get update
|
||||
apt-get install --no-install-recommends -y curl procps ca-certificates
|
||||
curl -L -s $S6OVERLAY_RELEASE | tar xvzf - -C /
|
||||
mv /init /s6-init
|
||||
|
||||
# debconf-apt-progress seems to hang so get rid of it too
|
||||
which debconf-apt-progress
|
||||
mv "$(which debconf-apt-progress)" /bin/no_debconf-apt-progress
|
||||
|
||||
# Get the install functions
|
||||
curl https://raw.githubusercontent.com/pi-hole/pi-hole/${CORE_VERSION}/automated%20install/basic-install.sh > "$PIHOLE_INSTALL"
|
||||
PH_TEST=true . "${PIHOLE_INSTALL}"
|
||||
|
||||
# Preseed variables to assist with using --unattended install
|
||||
{
|
||||
echo "PIHOLE_INTERFACE=eth0"
|
||||
echo "IPV4_ADDRESS=0.0.0.0"
|
||||
echo "IPV6_ADDRESS=0:0:0:0:0:0"
|
||||
echo "PIHOLE_DNS_1=8.8.8.8"
|
||||
echo "PIHOLE_DNS_2=8.8.4.4"
|
||||
echo "QUERY_LOGGING=true"
|
||||
echo "INSTALL_WEB_SERVER=true"
|
||||
echo "INSTALL_WEB_INTERFACE=true"
|
||||
echo "LIGHTTPD_ENABLED=true"
|
||||
}>> "${setupVars}"
|
||||
source $setupVars
|
||||
|
||||
export USER=pihole
|
||||
distro_check
|
||||
|
||||
# fix permission denied to resolvconf post-inst /etc/resolv.conf moby/moby issue #1297
|
||||
apt-get -y install debconf-utils
|
||||
echo resolvconf resolvconf/linkify-resolvconf boolean false | debconf-set-selections
|
||||
|
||||
ln -s /bin/true /usr/local/bin/service
|
||||
bash -ex "./${PIHOLE_INSTALL}" --unattended
|
||||
rm /usr/local/bin/service
|
||||
# Old way of setting up
|
||||
#install_dependent_packages INSTALLER_DEPS[@]
|
||||
#install_dependent_packages PIHOLE_DEPS[@]
|
||||
#install_dependent_packages PIHOLE_WEB_DEPS[@]
|
||||
# IPv6 support for nc openbsd better than traditional
|
||||
apt-get install -y --force-yes netcat-openbsd
|
||||
|
||||
piholeGitUrl="${piholeGitUrl}"
|
||||
webInterfaceGitUrl="${webInterfaceGitUrl}"
|
||||
webInterfaceDir="${webInterfaceDir}"
|
||||
#git clone --branch "${CORE_VERSION}" --depth 1 "${piholeGitUrl}" "${PI_HOLE_LOCAL_REPO}"
|
||||
#git clone --branch "${WEB_VERSION}" --depth 1 "${webInterfaceGitUrl}" "${webInterfaceDir}"
|
||||
|
||||
tmpLog="/tmp/pihole-install.log"
|
||||
installLogLoc="${installLogLoc}"
|
||||
FTLdetect 2>&1 | tee "${tmpLog}"
|
||||
installPihole 2>&1 | tee "${tmpLog}"
|
||||
mv "${tmpLog}" /
|
||||
|
||||
fetch_release_metadata() {
|
||||
local directory="$1"
|
||||
local version="$2"
|
||||
pushd "$directory"
|
||||
git fetch -t
|
||||
git remote set-branches origin '*'
|
||||
git fetch --depth 10
|
||||
git checkout master
|
||||
git reset --hard "$version"
|
||||
popd
|
||||
}
|
||||
|
||||
if [[ $CHECKOUT_BRANCHES == true ]] ; then
|
||||
ln -s /bin/true /usr/local/bin/service
|
||||
ln -s /bin/true /usr/local/bin/update-rc.d
|
||||
echo y | bash -x pihole checkout core ${CORE_VERSION}
|
||||
echo y | bash -x pihole checkout web ${WEB_VERSION}
|
||||
echo y | bash -x pihole checkout ftl tweak/overhaul_overTime
|
||||
# If the v is forgotten: ${CORE_VERSION/v/}
|
||||
unlink /usr/local/bin/service
|
||||
unlink /usr/local/bin/update-rc.d
|
||||
else
|
||||
# Reset to our tags so version numbers get detected correctly
|
||||
fetch_release_metadata "${PI_HOLE_LOCAL_REPO}" "${CORE_VERSION}"
|
||||
fetch_release_metadata "${webInterfaceDir}" "${WEB_VERSION}"
|
||||
fi
|
||||
# FTL Armel fix not in prod yet
|
||||
# Remove once https://github.com/pi-hole/pi-hole/commit/3fbb0ac8dde14b8edc1982ae3a2a021f3cf68477 is in master
|
||||
if [[ "$ARCH" == 'armel' ]]; then
|
||||
curl -o /usr/bin/pihole-FTL https://ftl.pi-hole.net/development/pihole-FTL-armel-native
|
||||
fi
|
||||
|
||||
sed -i 's/readonly //g' /opt/pihole/webpage.sh
|
||||
sed -i '/^WEBPASSWORD/d' /etc/pihole/setupVars.conf
|
||||
|
||||
# Replace the call to `updatePiholeFunc` in arg parse with new `unsupportedFunc`
|
||||
sed -i $'s/helpFunc() {/unsupportedFunc() {\\\n echo "Function not supported in Docker images"\\\n exit 0\\\n}\\\n\\\nhelpFunc() {/g' /usr/local/bin/pihole
|
||||
sed -i $'s/)\s*updatePiholeFunc/) unsupportedFunc/g' /usr/local/bin/pihole
|
||||
|
||||
touch /.piholeFirstBoot
|
||||
|
||||
echo 'Docker install successful'
|
||||
@@ -1,20 +0,0 @@
|
||||
#!/usr/bin/with-contenv bash
|
||||
set -e
|
||||
|
||||
bashCmd='bash -e'
|
||||
if [ "${PH_VERBOSE:-0}" -gt 0 ] ; then
|
||||
set -x ;
|
||||
bashCmd='bash -e -x'
|
||||
fi
|
||||
|
||||
# used to start dnsmasq here for gravity to use...now that conflicts port 53
|
||||
|
||||
$bashCmd /start.sh
|
||||
# Gotta go fast, no time for gravity
|
||||
if [ -n "$PYTEST" ]; then
|
||||
sed -i 's/^gravity_spinup$/#gravity_spinup # DISABLED FOR PYTEST/g' "$(which gravity.sh)"
|
||||
fi
|
||||
gravity.sh
|
||||
|
||||
# Kill dnsmasq because s6 won't like it if it's running when s6 services start
|
||||
kill -9 $(pgrep pihole-FTL) || true
|
||||
@@ -1,4 +0,0 @@
|
||||
#!/usr/bin/with-contenv bash
|
||||
|
||||
s6-echo "Stopping lighttpd"
|
||||
killall -9 lighttpd
|
||||
@@ -1,4 +0,0 @@
|
||||
#!/usr/bin/with-contenv bash
|
||||
|
||||
s6-echo "Starting lighttpd"
|
||||
lighttpd -D -f /etc/lighttpd/lighttpd.conf
|
||||
@@ -1,4 +0,0 @@
|
||||
#!/usr/bin/with-contenv bash
|
||||
|
||||
s6-echo "Stopping pihole-FTL"
|
||||
kill -9 $(pgrep pihole-FTL)
|
||||
@@ -1,9 +0,0 @@
|
||||
#!/usr/bin/with-contenv bash
|
||||
|
||||
s6-echo "Starting pihole-FTL ($FTL_CMD) as ${DNSMASQ_USER}"
|
||||
s6-setuidgid ${DNSMASQ_USER} pihole-FTL $FTL_CMD >/dev/null 2>&1
|
||||
|
||||
# Notes on above:
|
||||
# - DNSMASQ_USER default of root is in Dockerfile & can be overwritten by runtime container env
|
||||
# - /var/log/pihole*.log has FTL's output that no-daemon would normally print in FG too
|
||||
# prevent duplicating it in docker logs by sending to dev null
|
||||
30
s6/service
30
s6/service
@@ -1,30 +0,0 @@
|
||||
#!/bin/bash
|
||||
# This script patches all service commands into the appropriate s6- commands
|
||||
# pi-hole upstream scripts need a 'service' interface. why not systemd? docker said so.
|
||||
start() {
|
||||
s6-svc -wU -u -T2500 /var/run/s6/services/$service
|
||||
}
|
||||
|
||||
stop() {
|
||||
s6-svc -wD -d -T2500 /var/run/s6/services/$service
|
||||
}
|
||||
|
||||
restart() {
|
||||
stop
|
||||
start
|
||||
#s6-svc -t -wR -T5000 /var/run/s6/services/$service
|
||||
}
|
||||
|
||||
status() {
|
||||
s6-svstat /var/run/s6/services/$service
|
||||
}
|
||||
|
||||
service="$1"
|
||||
command="$2"
|
||||
|
||||
if [[ ! -d "/var/run/s6/services/$service" ]] ; then
|
||||
echo "s6 service not found for $service, exiting..."
|
||||
exit
|
||||
fi;
|
||||
|
||||
${command} "${service}"
|
||||
6
setup.py
6
setup.py
@@ -1,6 +0,0 @@
|
||||
from setuptools import setup
|
||||
|
||||
setup(
|
||||
setup_requires=['pytest-runner'],
|
||||
tests_require=['pytest'],
|
||||
)
|
||||
48
src/Dockerfile
Normal file
48
src/Dockerfile
Normal file
@@ -0,0 +1,48 @@
|
||||
ARG PIHOLE_BASE
|
||||
FROM "${PIHOLE_BASE:-ghcr.io/pi-hole/docker-pi-hole-base:bullseye-slim}"
|
||||
|
||||
ARG PIHOLE_DOCKER_TAG
|
||||
ENV PIHOLE_DOCKER_TAG "${PIHOLE_DOCKER_TAG}"
|
||||
|
||||
ENV S6_OVERLAY_VERSION v3.1.1.2
|
||||
|
||||
COPY ./scripts/install.sh /usr/local/bin/install.sh
|
||||
ENV PIHOLE_INSTALL /etc/.pihole/automated\ install/basic-install.sh
|
||||
|
||||
ENTRYPOINT [ "/init" ]
|
||||
|
||||
COPY s6/debian-root /
|
||||
COPY s6/service /usr/local/bin/service
|
||||
|
||||
RUN bash -ex install.sh 2>&1 && \
|
||||
rm -rf /var/cache/apt/archives /var/lib/apt/lists/*
|
||||
|
||||
# php config start passes special ENVs into
|
||||
ARG PHP_ENV_CONFIG
|
||||
ENV PHP_ENV_CONFIG /etc/lighttpd/conf-enabled/15-fastcgi-php.conf
|
||||
ARG PHP_ERROR_LOG
|
||||
ENV PHP_ERROR_LOG /var/log/lighttpd/error-pihole.log
|
||||
COPY ./scripts/start.sh /
|
||||
COPY ./scripts/bash_functions.sh /
|
||||
COPY ./scripts/gravityonboot.sh /
|
||||
|
||||
# IPv6 disable flag for networks/devices that do not support it
|
||||
ENV IPv6 True
|
||||
|
||||
EXPOSE 53 53/udp
|
||||
EXPOSE 67/udp
|
||||
EXPOSE 80
|
||||
|
||||
ENV S6_LOGGING 0
|
||||
ENV S6_KEEP_ENV 1
|
||||
ENV S6_BEHAVIOUR_IF_STAGE2_FAILS 2
|
||||
|
||||
ENV FTLCONF_REPLY_ADDR4 0.0.0.0
|
||||
ENV FTL_CMD no-daemon
|
||||
ENV DNSMASQ_USER pihole
|
||||
|
||||
ENV PATH /opt/pihole:${PATH}
|
||||
|
||||
HEALTHCHECK CMD dig +short +norecurse +retry=0 @127.0.0.1 pi.hole || exit 1
|
||||
|
||||
SHELL ["/bin/bash", "-c"]
|
||||
35
src/s6/debian-root/etc/cont-init.d/05-changer-uid-gid.sh
Executable file
35
src/s6/debian-root/etc/cont-init.d/05-changer-uid-gid.sh
Executable file
@@ -0,0 +1,35 @@
|
||||
#!/command/with-contenv bash
|
||||
set -e
|
||||
|
||||
if [ "${PH_VERBOSE:-0}" -gt 0 ] ; then
|
||||
set -x ;
|
||||
fi
|
||||
|
||||
modifyUser()
|
||||
{
|
||||
declare username=${1:-} newId=${2:-}
|
||||
[[ -z ${username} || -z ${newId} ]] && return
|
||||
|
||||
local currentId=$(id -u ${username})
|
||||
[[ ${currentId} -eq ${newId} ]] && return
|
||||
|
||||
echo "Changing ID for user: ${username} (${currentId} => ${newId})"
|
||||
usermod -o -u ${newId} ${username}
|
||||
}
|
||||
|
||||
modifyGroup()
|
||||
{
|
||||
declare groupname=${1:-} newId=${2:-}
|
||||
[[ -z ${groupname} || -z ${newId} ]] && return
|
||||
|
||||
local currentId=$(id -g ${groupname})
|
||||
[[ ${currentId} -eq ${newId} ]] && return
|
||||
|
||||
echo "Changing ID for group: ${groupname} (${currentId} => ${newId})"
|
||||
groupmod -o -g ${newId} ${groupname}
|
||||
}
|
||||
|
||||
modifyUser www-data ${WEB_UID}
|
||||
modifyGroup www-data ${WEB_GID}
|
||||
modifyUser pihole ${PIHOLE_UID}
|
||||
modifyGroup pihole ${PIHOLE_GID}
|
||||
0
s6/debian-root/etc/fix-attrs.d/01-resolver-resolv → src/s6/debian-root/etc/fix-attrs.d/01-resolver-resolv
Normal file → Executable file
0
s6/debian-root/etc/fix-attrs.d/01-resolver-resolv → src/s6/debian-root/etc/fix-attrs.d/01-resolver-resolv
Normal file → Executable file
1
src/s6/debian-root/etc/s6-overlay/s6-rc.d/_gravityonboot/dependencies
Executable file
1
src/s6/debian-root/etc/s6-overlay/s6-rc.d/_gravityonboot/dependencies
Executable file
@@ -0,0 +1 @@
|
||||
pihole-FTL
|
||||
1
src/s6/debian-root/etc/s6-overlay/s6-rc.d/_gravityonboot/type
Executable file
1
src/s6/debian-root/etc/s6-overlay/s6-rc.d/_gravityonboot/type
Executable file
@@ -0,0 +1 @@
|
||||
oneshot
|
||||
2
src/s6/debian-root/etc/s6-overlay/s6-rc.d/_gravityonboot/up
Executable file
2
src/s6/debian-root/etc/s6-overlay/s6-rc.d/_gravityonboot/up
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/command/execlineb
|
||||
background { bash -e /gravityonboot.sh }
|
||||
1
src/s6/debian-root/etc/s6-overlay/s6-rc.d/_startup/type
Executable file
1
src/s6/debian-root/etc/s6-overlay/s6-rc.d/_startup/type
Executable file
@@ -0,0 +1 @@
|
||||
oneshot
|
||||
2
src/s6/debian-root/etc/s6-overlay/s6-rc.d/_startup/up
Executable file
2
src/s6/debian-root/etc/s6-overlay/s6-rc.d/_startup/up
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/command/execlineb
|
||||
foreground { bash -e /start.sh }
|
||||
2
s6/debian-root/etc/services.d/cron/finish → src/s6/debian-root/etc/s6-overlay/s6-rc.d/cron/finish
Normal file → Executable file
2
s6/debian-root/etc/services.d/cron/finish → src/s6/debian-root/etc/s6-overlay/s6-rc.d/cron/finish
Normal file → Executable file
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/with-contenv bash
|
||||
#!/command/with-contenv bash
|
||||
|
||||
s6-echo "Stopping cron"
|
||||
killall -9 cron
|
||||
2
s6/debian-root/etc/services.d/cron/run → src/s6/debian-root/etc/s6-overlay/s6-rc.d/cron/run
Normal file → Executable file
2
s6/debian-root/etc/services.d/cron/run → src/s6/debian-root/etc/s6-overlay/s6-rc.d/cron/run
Normal file → Executable file
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/with-contenv bash
|
||||
#!/command/with-contenv bash
|
||||
s6-echo "Starting crond"
|
||||
|
||||
exec -c
|
||||
1
src/s6/debian-root/etc/s6-overlay/s6-rc.d/cron/type
Executable file
1
src/s6/debian-root/etc/s6-overlay/s6-rc.d/cron/type
Executable file
@@ -0,0 +1 @@
|
||||
longrun
|
||||
0
src/s6/debian-root/etc/s6-overlay/s6-rc.d/lighttpd-access-log/down
Executable file
0
src/s6/debian-root/etc/s6-overlay/s6-rc.d/lighttpd-access-log/down
Executable file
8
src/s6/debian-root/etc/s6-overlay/s6-rc.d/lighttpd-access-log/finish
Executable file
8
src/s6/debian-root/etc/s6-overlay/s6-rc.d/lighttpd-access-log/finish
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/command/with-contenv bash
|
||||
|
||||
s6-echo "Stopping lighttpd-access-log"
|
||||
pid=$(ps -C cat -o pid=,args= |grep -oP "([0-9]+).+access\.log" |cut -f1 -d" ")
|
||||
if [[ -n ${pid} ]]; then
|
||||
kill -9 ${pid}
|
||||
fi
|
||||
s6-echo "Stopped lighttpd-access-log"
|
||||
5
src/s6/debian-root/etc/s6-overlay/s6-rc.d/lighttpd-access-log/run
Executable file
5
src/s6/debian-root/etc/s6-overlay/s6-rc.d/lighttpd-access-log/run
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/command/with-contenv bash
|
||||
|
||||
s6-echo "Starting lighttpd-access-log"
|
||||
|
||||
s6-setuidgid www-data cat /var/log/lighttpd/access-pihole.log 2>&1
|
||||
1
src/s6/debian-root/etc/s6-overlay/s6-rc.d/lighttpd-access-log/type
Executable file
1
src/s6/debian-root/etc/s6-overlay/s6-rc.d/lighttpd-access-log/type
Executable file
@@ -0,0 +1 @@
|
||||
longrun
|
||||
0
src/s6/debian-root/etc/s6-overlay/s6-rc.d/lighttpd-error-log/down
Executable file
0
src/s6/debian-root/etc/s6-overlay/s6-rc.d/lighttpd-error-log/down
Executable file
8
src/s6/debian-root/etc/s6-overlay/s6-rc.d/lighttpd-error-log/finish
Executable file
8
src/s6/debian-root/etc/s6-overlay/s6-rc.d/lighttpd-error-log/finish
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/command/with-contenv bash
|
||||
|
||||
s6-echo "Stopping lighttpd-error-log"
|
||||
pid=$(ps -C cat -o pid=,args= |grep -oP "([0-9]+).+error\.log" |cut -f1 -d" ")
|
||||
if [[ -n ${pid} ]]; then
|
||||
kill -9 ${pid}
|
||||
fi
|
||||
s6-echo "Stopped lighttpd-error-log"
|
||||
5
src/s6/debian-root/etc/s6-overlay/s6-rc.d/lighttpd-error-log/run
Executable file
5
src/s6/debian-root/etc/s6-overlay/s6-rc.d/lighttpd-error-log/run
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/command/with-contenv bash
|
||||
|
||||
s6-echo "Starting lighttpd-error-log"
|
||||
|
||||
s6-setuidgid www-data cat /var/log/lighttpd/error-pihole.log 2>&1
|
||||
1
src/s6/debian-root/etc/s6-overlay/s6-rc.d/lighttpd-error-log/type
Executable file
1
src/s6/debian-root/etc/s6-overlay/s6-rc.d/lighttpd-error-log/type
Executable file
@@ -0,0 +1 @@
|
||||
longrun
|
||||
@@ -0,0 +1 @@
|
||||
pihole-FTL
|
||||
6
src/s6/debian-root/etc/s6-overlay/s6-rc.d/lighttpd/finish
Executable file
6
src/s6/debian-root/etc/s6-overlay/s6-rc.d/lighttpd/finish
Executable file
@@ -0,0 +1,6 @@
|
||||
#!/command/with-contenv bash
|
||||
|
||||
s6-echo "Stopping lighttpd"
|
||||
service lighttpd-access-log stop
|
||||
service lighttpd-error-log stop
|
||||
killall -9 lighttpd
|
||||
32
src/s6/debian-root/etc/s6-overlay/s6-rc.d/lighttpd/run
Executable file
32
src/s6/debian-root/etc/s6-overlay/s6-rc.d/lighttpd/run
Executable file
@@ -0,0 +1,32 @@
|
||||
#!/command/with-contenv bash
|
||||
|
||||
s6-echo "Starting lighttpd"
|
||||
|
||||
if [[ 1 -eq ${WEBLOGS_STDOUT:-0} ]]; then
|
||||
#lighthttpd cannot use /dev/stdout https://redmine.lighttpd.net/issues/2731
|
||||
for fi in /var/log/lighttpd/access-pihole.log /var/log/lighttpd/error-pihole.log
|
||||
do
|
||||
if [[ ! -p ${fi} ]]; then
|
||||
rm -f ${fi}
|
||||
mkfifo -m 600 ${fi}
|
||||
fi
|
||||
done
|
||||
chown -R www-data:www-data /var/log/lighttpd
|
||||
service lighttpd-access-log start
|
||||
service lighttpd-error-log start
|
||||
sleep 2
|
||||
else
|
||||
#remove fifo if exists
|
||||
[[ -p /var/log/lighttpd/access-pihole.log ]] && rm -Rf /var/log/lighttpd/access-pihole.log
|
||||
[[ -p /var/log/lighttpd/error-pihole.log ]] && rm -Rf /var/log/lighttpd/error-pihole.log
|
||||
|
||||
# install /dev/null log files to ensure they exist (create if non-existing, preserve if existing)
|
||||
[[ ! -f /var/log/lighttpd/access-pihole.log ]] && install /dev/null /var/log/lighttpd/access-pihole.log
|
||||
[[ ! -f /var/log/lighttpd/error-pihole.log ]] && install /dev/null /var/log/lighttpd/error-pihole.log
|
||||
|
||||
# Ensure that permissions are set so that lighttpd can write to the logs
|
||||
chown -R www-data:www-data /var/log/lighttpd
|
||||
chmod 0644 /var/log/lighttpd/access-pihole.log /var/log/lighttpd/error-pihole.log
|
||||
fi
|
||||
|
||||
lighttpd -D -f /etc/lighttpd/lighttpd.conf
|
||||
1
src/s6/debian-root/etc/s6-overlay/s6-rc.d/lighttpd/type
Executable file
1
src/s6/debian-root/etc/s6-overlay/s6-rc.d/lighttpd/type
Executable file
@@ -0,0 +1 @@
|
||||
longrun
|
||||
@@ -0,0 +1 @@
|
||||
_startup
|
||||
4
src/s6/debian-root/etc/s6-overlay/s6-rc.d/pihole-FTL/finish
Executable file
4
src/s6/debian-root/etc/s6-overlay/s6-rc.d/pihole-FTL/finish
Executable file
@@ -0,0 +1,4 @@
|
||||
#!/command/with-contenv bash
|
||||
|
||||
s6-echo "Stopping pihole-FTL"
|
||||
killall -15 pihole-FTL
|
||||
78
src/s6/debian-root/etc/s6-overlay/s6-rc.d/pihole-FTL/run
Executable file
78
src/s6/debian-root/etc/s6-overlay/s6-rc.d/pihole-FTL/run
Executable file
@@ -0,0 +1,78 @@
|
||||
#!/command/with-contenv bash
|
||||
|
||||
# Testing on Docker 20.10.14 with no caps set shows the following caps available to the container:
|
||||
# Current: cap_chown,cap_dac_override,cap_fowner,cap_fsetid,cap_kill,cap_setgid,cap_setuid,cap_setpcap,cap_net_bind_service,cap_net_raw,cap_sys_chroot,cap_mknod,cap_audit_write,cap_setfcap=ep
|
||||
# FTL can also use CAP_NET_ADMIN and CAP_SYS_NICE. If we try to set them when they haven't been explicitly enabled, FTL will not start. Test for them first:
|
||||
|
||||
/sbin/capsh --has-p=cap_chown 2>/dev/null && CAP_STR+=',CAP_CHOWN'
|
||||
/sbin/capsh --has-p=cap_net_bind_service 2>/dev/null && CAP_STR+=',CAP_NET_BIND_SERVICE'
|
||||
/sbin/capsh --has-p=cap_net_raw 2>/dev/null && CAP_STR+=',CAP_NET_RAW'
|
||||
/sbin/capsh --has-p=cap_net_admin 2>/dev/null && CAP_STR+=',CAP_NET_ADMIN' || DHCP_READY='false'
|
||||
/sbin/capsh --has-p=cap_sys_nice 2>/dev/null && CAP_STR+=',CAP_SYS_NICE'
|
||||
|
||||
if [[ ${CAP_STR} ]]; then
|
||||
# We have the (some of) the above caps available to us - apply them to pihole-FTL
|
||||
setcap ${CAP_STR:1}+ep "$(which pihole-FTL)" || ret=$?
|
||||
|
||||
if [[ $DHCP_READY == false ]] && [[ $DHCP_ACTIVE == true ]]; then
|
||||
# DHCP is requested but NET_ADMIN is not available.
|
||||
echo "ERROR: DHCP requested but NET_ADMIN is not available. DHCP will not be started."
|
||||
echo " Please add cap_net_admin to the container's capabilities or disable DHCP."
|
||||
DHCP_ACTIVE='false'
|
||||
change_setting "DHCP_ACTIVE" "false"
|
||||
fi
|
||||
|
||||
if [[ $ret -ne 0 && "${DNSMASQ_USER:-pihole}" != "root" ]]; then
|
||||
echo "ERROR: Unable to set capabilities for pihole-FTL. Cannot run as non-root."
|
||||
echo " If you are seeing this error, please set the environment variable 'DNSMASQ_USER' to the value 'root'"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "WARNING: Unable to set capabilities for pihole-FTL."
|
||||
echo " Please ensure that the container has the required capabilities."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
s6-echo "Starting pihole-FTL ($FTL_CMD) as ${DNSMASQ_USER}"
|
||||
# Remove possible leftovers from previous pihole-FTL processes
|
||||
rm -f /dev/shm/FTL-* 2> /dev/null
|
||||
rm /run/pihole/FTL.sock 2> /dev/null
|
||||
|
||||
# install /dev/null files to ensure they exist (create if non-existing, preserve if existing)
|
||||
mkdir -pm 0755 /run/pihole /var/log/pihole
|
||||
[[ ! -f /run/pihole-FTL.pid ]] && install /dev/null /run/pihole-FTL.pid
|
||||
[[ ! -f /run/pihole-FTL.port ]] && install /dev/null /run/pihole-FTL.port
|
||||
[[ ! -f /var/log/pihole/FTL.log ]] && install /dev/null /var/log/pihole/FTL.log
|
||||
[[ ! -f /var/log/pihole/pihole.log ]] && install /dev/null /var/log/pihole/pihole.log
|
||||
[[ ! -f /etc/pihole/dhcp.leases ]] && install /dev/null /etc/pihole/dhcp.leases
|
||||
|
||||
# Ensure that permissions are set so that pihole-FTL can edit all necessary files
|
||||
chown pihole:pihole /run/pihole-FTL.pid /run/pihole-FTL.port /var/log/pihole/FTL.log /var/log/pihole/pihole.log /etc/pihole/dhcp.leases /run/pihole /etc/pihole
|
||||
chmod 0644 /run/pihole-FTL.pid /run/pihole-FTL.port /var/log/pihole/FTL.log /var/log/pihole/pihole.log /etc/pihole/dhcp.leases
|
||||
|
||||
# Ensure that permissions are set so that pihole-FTL can edit the files. We ignore errors as the file may not (yet) exist
|
||||
chmod -f 0644 /etc/pihole/macvendor.db
|
||||
# Chown database files to the user FTL runs as. We ignore errors as the files may not (yet) exist
|
||||
chown -f pihole:pihole /etc/pihole/pihole-FTL.db /etc/pihole/gravity.db /etc/pihole/macvendor.db
|
||||
# Chown database file permissions so that the pihole group (web interface) can edit the file. We ignore errors as the files may not (yet) exist
|
||||
chmod -f 0664 /etc/pihole/pihole-FTL.db
|
||||
|
||||
# Backward compatibility for user-scripts that still expect log files in /var/log instead of /var/log/pihole/
|
||||
# Should be removed with Pi-hole v6.0
|
||||
if [ ! -f /var/log/pihole.log ]; then
|
||||
ln -s /var/log/pihole/pihole.log /var/log/pihole.log
|
||||
chown -h pihole:pihole /var/log/pihole.log
|
||||
|
||||
fi
|
||||
if [ ! -f /var/log/pihole-FTL.log ]; then
|
||||
ln -s /var/log/pihole/FTL.log /var/log/pihole-FTL.log
|
||||
chown -h pihole:pihole /var/log/pihole-FTL.log
|
||||
fi
|
||||
|
||||
# Call capsh with the detected capabilities
|
||||
capsh --inh=${CAP_STR:1} --addamb=${CAP_STR:1} --user=$DNSMASQ_USER --keep=1 -- -c "/usr/bin/pihole-FTL $FTL_CMD >/dev/null 2>&1"
|
||||
|
||||
# Notes on above:
|
||||
# - DNSMASQ_USER default of pihole is in Dockerfile & can be overwritten by runtime container env
|
||||
# - /var/log/pihole/pihole*.log has FTL's output that no-daemon would normally print in FG too
|
||||
# prevent duplicating it in docker logs by sending to dev null
|
||||
1
src/s6/debian-root/etc/s6-overlay/s6-rc.d/pihole-FTL/type
Executable file
1
src/s6/debian-root/etc/s6-overlay/s6-rc.d/pihole-FTL/type
Executable file
@@ -0,0 +1 @@
|
||||
longrun
|
||||
53
src/s6/service
Executable file
53
src/s6/service
Executable file
@@ -0,0 +1,53 @@
|
||||
#!/bin/bash
|
||||
# This script patches all service commands into the appropriate s6- commands
|
||||
# pi-hole upstream scripts need a 'service' interface. why not systemd? docker said so.
|
||||
|
||||
start() {
|
||||
restart
|
||||
}
|
||||
|
||||
stop() {
|
||||
/command/s6-svc -wD -d -T2500 /run/service/"$service"
|
||||
}
|
||||
|
||||
restart() {
|
||||
local pid
|
||||
|
||||
# Get the PID(s) of the service we are asking to restart
|
||||
mapfile -t pids < <(pgrep "$service")
|
||||
|
||||
# Only attempt to stop the service if it is already running
|
||||
if [ "${#pids[@]}" -gt 0 ]; then
|
||||
stop
|
||||
|
||||
for pid in "${pids[@]}"; do
|
||||
# Loop until we are certain that the process has been stopped
|
||||
while test -d /proc/"$pid"; do
|
||||
sleep 0.2
|
||||
done
|
||||
done
|
||||
fi
|
||||
|
||||
# Check it hasn't been started by something else in the meantime
|
||||
pid=$(pgrep "$service")
|
||||
|
||||
# Only attempt to start the service if it is not already running
|
||||
if [ -z "$pid" ]; then
|
||||
/command/s6-svc -wu -u -T2500 /run/service/"$service"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
status() {
|
||||
/command/s6-svstat /run/service/"$service"
|
||||
}
|
||||
|
||||
service="$1"
|
||||
command="$2"
|
||||
|
||||
if [[ ! -d "/run/service/$service" ]] ; then
|
||||
echo "s6 service not found for $service, exiting..."
|
||||
exit
|
||||
fi;
|
||||
|
||||
${command} "${service}"
|
||||
480
src/scripts/bash_functions.sh
Normal file
480
src/scripts/bash_functions.sh
Normal file
@@ -0,0 +1,480 @@
|
||||
#!/bin/bash
|
||||
|
||||
# If user has set QUERY_LOGGING Env Var, copy it out to _OVERRIDE,
|
||||
# else it will get overridden itself when we source basic-install.sh
|
||||
[ -n "${QUERY_LOGGING}" ] && export QUERY_LOGGING_OVERRIDE="${QUERY_LOGGING}"
|
||||
|
||||
# Legacy Env Vars preserved for backwards compatibility - convert them to FTLCONF_ equivalents
|
||||
[ -n "${ServerIP}" ] && echo "ServerIP is deprecated. Converting to FTLCONF_REPLY_ADDR4" && export "FTLCONF_REPLY_ADDR4"="$ServerIP"
|
||||
[ -n "${ServerIPv6}" ] && echo "ServerIPv6 is deprecated. Converting to FTLCONF_REPLY_ADDR6" && export "FTLCONF_REPLY_ADDR6"="$ServerIPv6"
|
||||
|
||||
# Some of the bash_functions use utilities from Pi-hole's utils.sh
|
||||
# shellcheck disable=SC2154
|
||||
# shellcheck source=/dev/null
|
||||
. /opt/pihole/utils.sh
|
||||
|
||||
export setupVars="/etc/pihole/setupVars.conf"
|
||||
export FTLconf="/etc/pihole/pihole-FTL.conf"
|
||||
export dnsmasqconfig="/etc/dnsmasq.d/01-pihole.conf"
|
||||
export adlistFile="/etc/pihole/adlists.list"
|
||||
|
||||
change_setting() {
|
||||
addOrEditKeyValPair "${setupVars}" "${1}" "${2}"
|
||||
}
|
||||
|
||||
changeFTLsetting() {
|
||||
addOrEditKeyValPair "${FTLconf}" "${1}" "${2}"
|
||||
}
|
||||
|
||||
# shellcheck disable=SC2034
|
||||
ensure_basic_configuration() {
|
||||
|
||||
# Set Debian webserver variables for installConfigs
|
||||
LIGHTTPD_USER="www-data"
|
||||
LIGHTTPD_GROUP="www-data"
|
||||
LIGHTTPD_CFG="lighttpd.conf.debian"
|
||||
installConfigs
|
||||
installLogrotate || true #installLogRotate can return 2 or 3, but we are still OK to continue in that case
|
||||
|
||||
if [ ! -f "${setupVars}" ]; then
|
||||
install -m 644 /dev/null "${setupVars}"
|
||||
echo "Creating empty ${setupVars} file."
|
||||
# The following setting needs to exist else the web interface version won't show in pihole -v
|
||||
change_setting "INSTALL_WEB_INTERFACE" "true"
|
||||
fi
|
||||
|
||||
set +e
|
||||
mkdir -p /var/run/pihole /var/log/pihole
|
||||
touch /var/log/pihole/FTL.log /var/log/pihole/pihole.log
|
||||
|
||||
chown pihole:root /etc/lighttpd
|
||||
|
||||
# In case of `pihole` UID being changed, re-chown the pihole scripts and pihole command
|
||||
chown -R pihole:root "${PI_HOLE_INSTALL_DIR}"
|
||||
chown pihole:root "${PI_HOLE_BIN_DIR}/pihole"
|
||||
|
||||
set -e
|
||||
# Update version numbers
|
||||
pihole updatechecker
|
||||
# Re-write all of the setupVars to ensure required ones are present (like QUERY_LOGGING)
|
||||
|
||||
# If the setup variable file exists,
|
||||
if [[ -e "${setupVars}" ]]; then
|
||||
cp -f "${setupVars}" "${setupVars}.update.bak"
|
||||
fi
|
||||
|
||||
# Remove any existing macvendor.db and replace it with a symblink to the one moved to the root directory (see install.sh)
|
||||
if [[ -f "/etc/pihole/macvendor.db" ]]; then
|
||||
rm /etc/pihole/macvendor.db
|
||||
fi
|
||||
ln -s /macvendor.db /etc/pihole/macvendor.db
|
||||
|
||||
# When fresh empty directory volumes are used then we need to create this file
|
||||
if [ ! -f /etc/dnsmasq.d/01-pihole.conf ] ; then
|
||||
cp /etc/.pihole/advanced/01-pihole.conf /etc/dnsmasq.d/
|
||||
fi;
|
||||
|
||||
# setup_or_skip_gravity
|
||||
}
|
||||
|
||||
validate_env() {
|
||||
# Optional FTLCONF_REPLY_ADDR4 is a valid IP
|
||||
# nc won't throw any text based errors when it times out connecting to a valid IP, otherwise it complains about the DNS name being garbage
|
||||
# if nc doesn't behave as we expect on a valid IP the routing table should be able to look it up and return a 0 retcode
|
||||
if [[ "$(nc -4 -w1 -z "$FTLCONF_REPLY_ADDR4" 53 2>&1)" != "" ]] && ! ip route get "$FTLCONF_REPLY_ADDR4" > /dev/null ; then
|
||||
echo "ERROR: FTLCONF_REPLY_ADDR4 Environment variable ($FTLCONF_REPLY_ADDR4) doesn't appear to be a valid IPv4 address"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Optional IPv6 is a valid address
|
||||
if [[ -n "$FTLCONF_REPLY_ADDR6" ]] ; then
|
||||
if [[ "$FTLCONF_REPLY_ADDR6" == 'kernel' ]] ; then
|
||||
echo "ERROR: You passed in IPv6 with a value of 'kernel', this maybe because you do not have IPv6 enabled on your network"
|
||||
unset FTLCONF_REPLY_ADDR6
|
||||
exit 1
|
||||
fi
|
||||
if [[ "$(nc -6 -w1 -z "$FTLCONF_REPLY_ADDR6" 53 2>&1)" != "" ]] && ! ip route get "$FTLCONF_REPLY_ADDR6" > /dev/null ; then
|
||||
echo "ERROR: FTLCONF_REPLY_ADDR6 Environment variable ($FTLCONF_REPLY_ADDR6) doesn't appear to be a valid IPv6 address"
|
||||
echo " TIP: If your server is not IPv6 enabled just remove '-e FTLCONF_REPLY_ADDR6' from your docker container"
|
||||
exit 1
|
||||
fi
|
||||
fi;
|
||||
}
|
||||
|
||||
setup_FTL_User(){
|
||||
# Run DNSMASQ as root user to avoid SHM permission issues
|
||||
if grep -r -q '^\s*user=' /etc/dnsmasq.* ; then
|
||||
# Change user that had been set previously to root
|
||||
for f in $(grep -r -l '^\s*user=' /etc/dnsmasq.*); do
|
||||
sed -i "/^\s*user=/ c\user=${DNSMASQ_USER}" "${f}"
|
||||
done
|
||||
else
|
||||
echo -e "\nuser=${DNSMASQ_USER}" >> /etc/dnsmasq.conf
|
||||
fi
|
||||
}
|
||||
|
||||
setup_FTL_Interface(){
|
||||
local interface="${INTERFACE:-eth0}"
|
||||
|
||||
# Set the interface for FTL to listen on
|
||||
local interfaceType='default'
|
||||
if [ "$interface" != 'eth0' ] ; then
|
||||
interfaceType='custom'
|
||||
fi;
|
||||
echo "FTL binding to $interfaceType interface: $interface"
|
||||
change_setting "PIHOLE_INTERFACE" "${interface}"
|
||||
}
|
||||
|
||||
setup_FTL_CacheSize() {
|
||||
local warning="WARNING: CUSTOM_CACHE_SIZE not used"
|
||||
local dnsmasq_pihole_01_location="/etc/dnsmasq.d/01-pihole.conf"
|
||||
# Quietly exit early for empty or default
|
||||
if [[ -z "${CUSTOM_CACHE_SIZE}" || "${CUSTOM_CACHE_SIZE}" == '10000' ]] ; then return ; fi
|
||||
|
||||
if [[ "${DNSSEC}" == "true" ]] ; then
|
||||
echo "$warning - Cannot change cache size if DNSSEC is enabled"
|
||||
return
|
||||
fi
|
||||
|
||||
if ! echo "$CUSTOM_CACHE_SIZE" | grep -q '^[0-9]*$' ; then
|
||||
echo "$warning - $CUSTOM_CACHE_SIZE is not an integer"
|
||||
return
|
||||
fi
|
||||
|
||||
local -i custom_cache_size="$CUSTOM_CACHE_SIZE"
|
||||
if (( custom_cache_size < 0 )); then
|
||||
echo "$warning - $custom_cache_size is not a positive integer or zero"
|
||||
return
|
||||
fi
|
||||
echo "Custom CUSTOM_CACHE_SIZE set to $custom_cache_size"
|
||||
|
||||
change_setting "CACHE_SIZE" "$custom_cache_size"
|
||||
sed -i "s/^cache-size=\s*[0-9]*/cache-size=$custom_cache_size/" ${dnsmasq_pihole_01_location}
|
||||
}
|
||||
|
||||
apply_FTL_Configs_From_Env(){
|
||||
# Get all exported environment variables starting with FTLCONF_ as a prefix and call the changeFTLsetting
|
||||
# function with the environment variable's suffix as the key. This allows applying any pihole-FTL.conf
|
||||
# setting defined here: https://docs.pi-hole.net/ftldns/configfile/
|
||||
declare -px | grep FTLCONF_ | sed -E 's/declare -x FTLCONF_([^=]+)=\"(.+)\"/\1 \2/' | while read -r name value
|
||||
do
|
||||
echo "Applying pihole-FTL.conf setting $name=$value"
|
||||
changeFTLsetting "$name" "$value"
|
||||
done
|
||||
}
|
||||
|
||||
setup_FTL_dhcp() {
|
||||
if [ -z "${DHCP_START}" ] || [ -z "${DHCP_END}" ] || [ -z "${DHCP_ROUTER}" ]; then
|
||||
echo "ERROR: Won't enable DHCP server because mandatory Environment variables are missing: DHCP_START, DHCP_END and/or DHCP_ROUTER"
|
||||
change_setting "DHCP_ACTIVE" "false"
|
||||
else
|
||||
change_setting "DHCP_ACTIVE" "${DHCP_ACTIVE}"
|
||||
change_setting "DHCP_START" "${DHCP_START}"
|
||||
change_setting "DHCP_END" "${DHCP_END}"
|
||||
change_setting "DHCP_ROUTER" "${DHCP_ROUTER}"
|
||||
change_setting "DHCP_LEASETIME" "${DHCP_LEASETIME}"
|
||||
change_setting "PIHOLE_DOMAIN" "${PIHOLE_DOMAIN}"
|
||||
change_setting "DHCP_IPv6" "${DHCP_IPv6}"
|
||||
change_setting "DHCP_rapid_commit" "${DHCP_rapid_commit}"
|
||||
fi
|
||||
}
|
||||
|
||||
setup_FTL_query_logging(){
|
||||
if [ "${QUERY_LOGGING_OVERRIDE}" == "false" ]; then
|
||||
echo "::: Disabling Query Logging"
|
||||
change_setting "QUERY_LOGGING" "$QUERY_LOGGING_OVERRIDE"
|
||||
removeKey "${dnsmasqconfig}" log-queries
|
||||
else
|
||||
# If it is anything other than false, set it to true
|
||||
change_setting "QUERY_LOGGING" "true"
|
||||
# Set pihole logging on for good measure
|
||||
echo "::: Enabling Query Logging"
|
||||
addKey "${dnsmasqconfig}" log-queries
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
setup_FTL_server(){
|
||||
[ -n "${REV_SERVER}" ] && change_setting "REV_SERVER" "$REV_SERVER"
|
||||
[ -n "${REV_SERVER_DOMAIN}" ] && change_setting "REV_SERVER_DOMAIN" "$REV_SERVER_DOMAIN"
|
||||
[ -n "${REV_SERVER_TARGET}" ] && change_setting "REV_SERVER_TARGET" "$REV_SERVER_TARGET"
|
||||
[ -n "${REV_SERVER_CIDR}" ] && change_setting "REV_SERVER_CIDR" "$REV_SERVER_CIDR"
|
||||
|
||||
if [ -z "$REV_SERVER" ];then
|
||||
# If the REV_SERVER* variables are set, then there is no need to add these.
|
||||
# If it is not set, then adding these variables is fine, and they will be converted by the Pi-hole install script
|
||||
[ -n "${CONDITIONAL_FORWARDING}" ] && change_setting "CONDITIONAL_FORWARDING" "$CONDITIONAL_FORWARDING"
|
||||
[ -n "${CONDITIONAL_FORWARDING_IP}" ] && change_setting "CONDITIONAL_FORWARDING_IP" "$CONDITIONAL_FORWARDING_IP"
|
||||
[ -n "${CONDITIONAL_FORWARDING_DOMAIN}" ] && change_setting "CONDITIONAL_FORWARDING_DOMAIN" "$CONDITIONAL_FORWARDING_DOMAIN"
|
||||
[ -n "${CONDITIONAL_FORWARDING_REVERSE}" ] && change_setting "CONDITIONAL_FORWARDING_REVERSE" "$CONDITIONAL_FORWARDING_REVERSE"
|
||||
fi
|
||||
}
|
||||
|
||||
setup_FTL_upstream_DNS(){
|
||||
if [ -z "${PIHOLE_DNS_}" ]; then
|
||||
# For backward compatibility, if DNS1 and/or DNS2 are set, but PIHOLE_DNS_ is not, convert them to
|
||||
# a semi-colon delimited string and store in PIHOLE_DNS_
|
||||
# They are not used anywhere if PIHOLE_DNS_ is set already
|
||||
[ -n "${DNS1}" ] && echo "Converting DNS1 to PIHOLE_DNS_" && PIHOLE_DNS_="$DNS1"
|
||||
[[ -n "${DNS2}" && "${DNS2}" != "no" ]] && echo "Converting DNS2 to PIHOLE_DNS_" && PIHOLE_DNS_="$PIHOLE_DNS_;$DNS2"
|
||||
fi
|
||||
|
||||
# Parse the PIHOLE_DNS variable, if it exists, and apply upstream servers to Pi-hole config
|
||||
if [ -n "${PIHOLE_DNS_}" ]; then
|
||||
echo "Setting DNS servers based on PIHOLE_DNS_ variable"
|
||||
# Remove any PIHOLE_DNS_ entries from setupVars.conf, if they exist
|
||||
sed -i '/PIHOLE_DNS_/d' /etc/pihole/setupVars.conf
|
||||
# Split into an array (delimited by ;)
|
||||
# Loop through and add them one by one to setupVars.conf
|
||||
IFS=";" read -r -a PIHOLE_DNS_ARR <<< "${PIHOLE_DNS_}"
|
||||
# PIHOLE_DNS_ARR=(${PIHOLE_DNS_//;/ })
|
||||
count=1
|
||||
valid_entries=0
|
||||
for i in "${PIHOLE_DNS_ARR[@]}"; do
|
||||
if valid_ip "$i" || valid_ip6 "$i" ; then
|
||||
change_setting "PIHOLE_DNS_$count" "$i"
|
||||
((count=count+1))
|
||||
((valid_entries=valid_entries+1))
|
||||
continue
|
||||
fi
|
||||
# shellcheck disable=SC2086
|
||||
if [ -n "$(dig +short ${i//#*/})" ]; then
|
||||
# If the "address" is a domain (for example a docker link) then try to resolve it and add
|
||||
# the result as a DNS server in setupVars.conf.
|
||||
resolved_ip="$(dig +short ${i//#*/} | head -n 1)"
|
||||
if [ -n "${i//*#/}" ] && [ "${i//*#/}" != "${i//#*/}" ]; then
|
||||
resolved_ip="${resolved_ip}#${i//*#/}"
|
||||
fi
|
||||
echo "Resolved ${i} from PIHOLE_DNS_ as: ${resolved_ip}"
|
||||
if valid_ip "$resolved_ip" || valid_ip6 "$resolved_ip" ; then
|
||||
change_setting "PIHOLE_DNS_$count" "$resolved_ip"
|
||||
((count=count+1))
|
||||
((valid_entries=valid_entries+1))
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
# If the above tests fail then this is an invalid DNS server
|
||||
echo "Invalid entry detected in PIHOLE_DNS_: ${i}"
|
||||
done
|
||||
|
||||
if [ $valid_entries -eq 0 ]; then
|
||||
echo "No Valid entries detected in PIHOLE_DNS_. Aborting"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
# Environment variable has not been set, but there may be existing values in an existing setupVars.conf
|
||||
# if this is the case, we do not want to overwrite these with the defaults of 8.8.8.8 and 8.8.4.4
|
||||
# Pi-hole can run with only one upstream configured, so we will just check for one.
|
||||
setupVarsDNS="$(grep 'PIHOLE_DNS_' /etc/pihole/setupVars.conf || true)"
|
||||
|
||||
if [ -z "${setupVarsDNS}" ]; then
|
||||
echo "Configuring default DNS servers: 8.8.8.8, 8.8.4.4"
|
||||
change_setting "PIHOLE_DNS_1" "8.8.8.8"
|
||||
change_setting "PIHOLE_DNS_2" "8.8.4.4"
|
||||
else
|
||||
echo "Existing DNS servers detected in setupVars.conf. Leaving them alone"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
setup_FTL_ProcessDNSSettings(){
|
||||
# Commit settings to 01-pihole.conf
|
||||
|
||||
# shellcheck source=/dev/null
|
||||
. /opt/pihole/webpage.sh
|
||||
ProcessDNSSettings
|
||||
}
|
||||
|
||||
setup_lighttpd_bind() {
|
||||
local serverip="${FTLCONF_REPLY_ADDR4}"
|
||||
# if using '--net=host' only bind lighttpd on $FTLCONF_REPLY_ADDR6 and localhost
|
||||
if grep -q "docker" /proc/net/dev && [[ $serverip != 0.0.0.0 ]]; then #docker (docker0 by default) should only be present on the host system
|
||||
if ! grep -q "server.bind" /etc/lighttpd/lighttpd.conf ; then # if the declaration is already there, don't add it again
|
||||
sed -i -E "s/server\.port\s+\=\s+([0-9]+)/server.bind\t\t = \"${serverip}\"\nserver.port\t\t = \1\n"\$SERVER"\[\"socket\"\] == \"127\.0\.0\.1:\1\" \{\}/" /etc/lighttpd/lighttpd.conf
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
setup_web_php_env() {
|
||||
if [ -z "$VIRTUAL_HOST" ] ; then
|
||||
VIRTUAL_HOST="$FTLCONF_REPLY_ADDR4"
|
||||
fi;
|
||||
|
||||
for config_var in "VIRTUAL_HOST" "CORS_HOSTS" "PHP_ERROR_LOG" "PIHOLE_DOCKER_TAG" "TZ"; do
|
||||
local beginning_of_line="\t\t\t\"${config_var}\" => "
|
||||
if grep -qP "$beginning_of_line" "$PHP_ENV_CONFIG" ; then
|
||||
# replace line if already present
|
||||
sed -i "/${beginning_of_line}/c\\${beginning_of_line}\"${!config_var}\"," "$PHP_ENV_CONFIG"
|
||||
else
|
||||
# add line otherwise
|
||||
sed -i "/bin-environment/ a\\${beginning_of_line}\"${!config_var}\"," "$PHP_ENV_CONFIG"
|
||||
fi
|
||||
done
|
||||
|
||||
echo "Added ENV to php:"
|
||||
grep -E '(VIRTUAL_HOST|CORS_HOSTS|PHP_ERROR_LOG|PIHOLE_DOCKER_TAG|TZ)' "$PHP_ENV_CONFIG"
|
||||
}
|
||||
|
||||
setup_web_port() {
|
||||
local warning="WARNING: Custom WEB_PORT not used"
|
||||
# Quietly exit early for empty or default
|
||||
if [[ -z "${WEB_PORT}" || "${WEB_PORT}" == '80' ]] ; then return ; fi
|
||||
|
||||
if ! echo "$WEB_PORT" | grep -q '^[0-9][0-9]*$' ; then
|
||||
echo "$warning - $WEB_PORT is not an integer"
|
||||
return
|
||||
fi
|
||||
|
||||
local -i web_port="$WEB_PORT"
|
||||
if (( web_port < 1 || web_port > 65535 )); then
|
||||
echo "$warning - $web_port is not within valid port range of 1-65535"
|
||||
return
|
||||
fi
|
||||
echo "Custom WEB_PORT set to $web_port"
|
||||
echo "INFO: Without proper router DNAT forwarding to $FTLCONF_REPLY_ADDR4:$web_port, you may not get any blocked websites on ads"
|
||||
|
||||
# Update lighttpd's port
|
||||
sed -i '/server.port\s*=\s*80\s*$/ s/80/'"${WEB_PORT}"'/g' /etc/lighttpd/lighttpd.conf
|
||||
|
||||
}
|
||||
|
||||
setup_web_theme(){
|
||||
# Parse the WEBTHEME variable, if it exists, and set the selected theme if it is one of the supported values.
|
||||
# If an invalid theme name was supplied, setup WEBTHEME to use the default-light theme.
|
||||
if [ -n "${WEBTHEME}" ]; then
|
||||
case "${WEBTHEME}" in
|
||||
"default-dark" | "default-darker" | "default-light" | "default-auto" | "lcars")
|
||||
echo "Setting Web Theme based on WEBTHEME variable, using value ${WEBTHEME}"
|
||||
change_setting "WEBTHEME" "${WEBTHEME}"
|
||||
;;
|
||||
*)
|
||||
echo "Invalid theme name supplied: ${WEBTHEME}, falling back to default-light."
|
||||
change_setting "WEBTHEME" "default-light"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
}
|
||||
|
||||
load_web_password_secret() {
|
||||
# If WEBPASSWORD is not set at all, attempt to read password from WEBPASSWORD_FILE,
|
||||
# allowing secrets to be passed via docker secrets
|
||||
if [ -z "${WEBPASSWORD+x}" ] && [ -n "${WEBPASSWORD_FILE}" ] && [ -r "${WEBPASSWORD_FILE}" ]; then
|
||||
WEBPASSWORD=$(<"${WEBPASSWORD_FILE}")
|
||||
fi;
|
||||
}
|
||||
|
||||
setup_web_password() {
|
||||
if [ -z "${WEBPASSWORD+x}" ] ; then
|
||||
# ENV WEBPASSWORD_OVERRIDE is not set
|
||||
|
||||
# Exit if setupvars already has a password
|
||||
setup_var_exists "WEBPASSWORD" && return
|
||||
# Generate new random password
|
||||
WEBPASSWORD=$(tr -dc _A-Z-a-z-0-9 < /dev/urandom | head -c 8)
|
||||
echo "Assigning random password: $WEBPASSWORD"
|
||||
else
|
||||
# ENV WEBPASSWORD_OVERRIDE is set and will be used
|
||||
echo "::: Assigning password defined by Environment Variable"
|
||||
# WEBPASSWORD="$WEBPASSWORD"
|
||||
fi
|
||||
|
||||
# Explicitly turn off bash printing when working with secrets
|
||||
{ set +x; } 2>/dev/null
|
||||
|
||||
if [[ "$WEBPASSWORD" == "" ]] ; then
|
||||
echo "" | pihole -a -p
|
||||
else
|
||||
pihole -a -p "$WEBPASSWORD" "$WEBPASSWORD"
|
||||
fi
|
||||
|
||||
# To avoid printing this if conditional in bash debug, turn off debug above..
|
||||
# then re-enable debug if necessary (more code but cleaner printed output)
|
||||
if [ "${PH_VERBOSE:-0}" -gt 0 ] ; then
|
||||
set -x
|
||||
fi
|
||||
}
|
||||
|
||||
setup_ipv4_ipv6() {
|
||||
local ip_versions="IPv4 and IPv6"
|
||||
if [ "${IPv6,,}" != "true" ] ; then
|
||||
ip_versions="IPv4"
|
||||
sed -i '/use-ipv6.pl/ d' /etc/lighttpd/lighttpd.conf
|
||||
fi;
|
||||
echo "Using $ip_versions"
|
||||
}
|
||||
|
||||
test_configs() {
|
||||
set -e
|
||||
echo -n '::: Testing lighttpd config: '
|
||||
lighttpd -t -f /etc/lighttpd/lighttpd.conf || exit 1
|
||||
set +e
|
||||
echo "::: All config checks passed, cleared for startup ..."
|
||||
}
|
||||
|
||||
setup_blocklists() {
|
||||
# Exit/return early without setting up adlists with defaults for any of the following conditions:
|
||||
# 1. skip_setup_blocklists env is set
|
||||
exit_string="(exiting ${FUNCNAME[0]} early)"
|
||||
|
||||
if [ -n "${skip_setup_blocklists}" ]; then
|
||||
echo "::: skip_setup_blocklists requested ($exit_string)"
|
||||
return
|
||||
fi
|
||||
|
||||
# 2. The adlist file exists already (restarted container or volume mounted list)
|
||||
if [ -f "${adlistFile}" ]; then
|
||||
echo "::: Preexisting ad list ${adlistFile} detected ($exit_string)"
|
||||
cat "${adlistFile}"
|
||||
return
|
||||
fi
|
||||
|
||||
echo "::: ${FUNCNAME[0]} now setting default blocklists up: "
|
||||
echo "::: TIP: Use a docker volume for ${adlistFile} if you want to customize for first boot"
|
||||
installDefaultBlocklists
|
||||
|
||||
echo "::: Blocklists (${adlistFile}) now set to:"
|
||||
cat "${adlistFile}"
|
||||
}
|
||||
|
||||
setup_var_exists() {
|
||||
local KEY="$1"
|
||||
if [ -n "$2" ]; then
|
||||
local REQUIRED_VALUE="[^\n]+"
|
||||
fi
|
||||
if grep -Pq "^${KEY}=${REQUIRED_VALUE}" "$setupVars"; then
|
||||
echo "::: Pre existing ${KEY} found"
|
||||
true
|
||||
else
|
||||
false
|
||||
fi
|
||||
}
|
||||
|
||||
setup_web_temp_unit() {
|
||||
local UNIT="${TEMPERATUREUNIT}"
|
||||
# check if var is empty
|
||||
if [[ "$UNIT" != "" ]] ; then
|
||||
# check if we have valid units
|
||||
if [[ "$UNIT" == "c" || "$UNIT" == "k" || $UNIT == "f" ]] ; then
|
||||
pihole -a -"${UNIT}"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
setup_web_layout() {
|
||||
local LO="${WEBUIBOXEDLAYOUT}"
|
||||
# check if var is empty
|
||||
if [[ "$LO" != "" ]] ; then
|
||||
# check if we have valid types boxed | traditional
|
||||
if [[ "$LO" == "traditional" || "$LO" == "boxed" ]] ; then
|
||||
change_setting "WEBUIBOXEDLAYOUT" "$WEBUIBOXEDLAYOUT"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
setup_admin_email() {
|
||||
local EMAIL="${ADMIN_EMAIL}"
|
||||
# check if var is empty
|
||||
if [[ "$EMAIL" != "" ]] ; then
|
||||
pihole -a -e "$EMAIL"
|
||||
fi
|
||||
}
|
||||
18
src/scripts/gravityonboot.sh
Executable file
18
src/scripts/gravityonboot.sh
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
gravityDBfile="/etc/pihole/gravity.db"
|
||||
config_file="/etc/pihole/pihole-FTL.conf"
|
||||
# make a point to mention which config file we're checking, as breadcrumb to revisit if/when pihole-FTL.conf is succeeded by TOML
|
||||
echo " Checking if custom gravity.db is set in ${config_file}"
|
||||
if [[ -f "${config_file}" ]]; then
|
||||
gravityDBfile="$(grep --color=never -Po "^GRAVITYDB=\K.*" "${config_file}" 2> /dev/null || echo "/etc/pihole/gravity.db")"
|
||||
fi
|
||||
|
||||
if [ -z "$SKIPGRAVITYONBOOT" ] || [ ! -f "${gravityDBfile}" ]; then
|
||||
if [ -n "$SKIPGRAVITYONBOOT" ];then
|
||||
echo " SKIPGRAVITYONBOOT is set, however ${gravityDBfile} does not exist (Likely due to a fresh volume). This is a required file for Pi-hole to operate."
|
||||
echo " Ignoring SKIPGRAVITYONBOOT on this occaision."
|
||||
fi
|
||||
pihole -g
|
||||
else
|
||||
echo " Skipping Gravity Database Update."
|
||||
fi
|
||||
89
src/scripts/install.sh
Normal file
89
src/scripts/install.sh
Normal file
@@ -0,0 +1,89 @@
|
||||
#!/bin/bash -ex
|
||||
# shellcheck disable=SC2034
|
||||
|
||||
mkdir -p /etc/pihole/
|
||||
mkdir -p /var/run/pihole
|
||||
|
||||
CORE_LOCAL_REPO=/etc/.pihole
|
||||
WEB_LOCAL_REPO=/var/www/html/admin
|
||||
|
||||
setupVars=/etc/pihole/setupVars.conf
|
||||
|
||||
detect_arch() {
|
||||
DETECTED_ARCH=$(dpkg --print-architecture)
|
||||
S6_ARCH=$DETECTED_ARCH
|
||||
case $DETECTED_ARCH in
|
||||
amd64)
|
||||
S6_ARCH="x86_64";;
|
||||
armel)
|
||||
S6_ARCH="arm";;
|
||||
armhf)
|
||||
S6_ARCH="armhf";;
|
||||
arm64)
|
||||
S6_ARCH="aarch64";;
|
||||
i386)
|
||||
S6_ARCH="i686";;
|
||||
esac
|
||||
}
|
||||
|
||||
|
||||
# Helps to have some additional tools in the dev image when debugging
|
||||
if [[ "${PIHOLE_DOCKER_TAG}" = 'nightly' || "${PIHOLE_DOCKER_TAG}" = 'dev' ]]; then
|
||||
apt-get update
|
||||
apt-get install --no-install-recommends -y nano less
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
fi
|
||||
|
||||
detect_arch
|
||||
|
||||
curl -L -s "https://github.com/just-containers/s6-overlay/releases/download/${S6_OVERLAY_VERSION}/s6-overlay-noarch.tar.xz" | tar Jxpf - -C /
|
||||
curl -L -s "https://github.com/just-containers/s6-overlay/releases/download/${S6_OVERLAY_VERSION}/s6-overlay-${S6_ARCH}.tar.xz" | tar Jxpf - -C /
|
||||
|
||||
# Preseed variables to assist with using --unattended install
|
||||
{
|
||||
echo "PIHOLE_INTERFACE=eth0"
|
||||
echo "IPV4_ADDRESS=0.0.0.0"
|
||||
echo "IPV6_ADDRESS=0:0:0:0:0:0"
|
||||
echo "PIHOLE_DNS_1=8.8.8.8"
|
||||
echo "QUERY_LOGGING=true"
|
||||
echo "INSTALL_WEB_SERVER=true"
|
||||
echo "INSTALL_WEB_INTERFACE=true"
|
||||
echo "LIGHTTPD_ENABLED=true"
|
||||
}>> "${setupVars}"
|
||||
source $setupVars
|
||||
|
||||
export USER=pihole
|
||||
|
||||
export PIHOLE_SKIP_OS_CHECK=true
|
||||
|
||||
# Run the installer in unattended mode using the preseeded variables above and --reconfigure so that local repos are not updated
|
||||
curl -sSL https://install.pi-hole.net | bash -sex -- --unattended
|
||||
|
||||
# At this stage, if we are building a :nightly tag, then switch the Pi-hole install to dev versions
|
||||
if [[ "${PIHOLE_DOCKER_TAG}" = 'nightly' ]]; then
|
||||
yes | pihole checkout dev
|
||||
fi
|
||||
|
||||
sed -i '/^WEBPASSWORD/d' /etc/pihole/setupVars.conf
|
||||
|
||||
# sed a new function into the `pihole` script just above the `helpFunc()` function for later use.
|
||||
sed -i $'s/helpFunc() {/unsupportedFunc() {\\\n echo "Function not supported in Docker images"\\\n exit 0\\\n}\\\n\\\nhelpFunc() {/g' /usr/local/bin/pihole
|
||||
|
||||
# Replace a few of the `pihole` options with calls to `unsupportedFunc`:
|
||||
# pihole -up / pihole updatePihole
|
||||
sed -i $'s/)\s*updatePiholeFunc/) unsupportedFunc/g' /usr/local/bin/pihole
|
||||
# pihole uninstall
|
||||
sed -i $'s/)\s*uninstallFunc/) unsupportedFunc/g' /usr/local/bin/pihole
|
||||
# pihole -r / pihole reconfigure
|
||||
sed -i $'s/)\s*reconfigurePiholeFunc/) unsupportedFunc/g' /usr/local/bin/pihole
|
||||
|
||||
# Move macvendor.db to root dir and symlink it back into /etc/pihole. See https://github.com/pi-hole/docker-pi-hole/issues/1137
|
||||
# If user goes on to bind monunt this directory to their host, then we can easily ensure macvendor.db is the latest
|
||||
# (it is otherwise only updated when FTL is updated, which doesn't happen as part of the normal course of running this image)
|
||||
mv /etc/pihole/macvendor.db /macvendor.db
|
||||
ln -s /macvendor.db /etc/pihole/macvendor.db
|
||||
|
||||
if [ ! -f /.piholeFirstBoot ]; then
|
||||
touch /.piholeFirstBoot
|
||||
fi
|
||||
echo 'Docker install successful'
|
||||
68
src/scripts/start.sh
Executable file
68
src/scripts/start.sh
Executable file
@@ -0,0 +1,68 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
# The below functions are all contained in bash_functions.sh
|
||||
# shellcheck source=/dev/null
|
||||
. /bash_functions.sh
|
||||
|
||||
# shellcheck source=/dev/null
|
||||
SKIP_INSTALL=true . "${PIHOLE_INSTALL}"
|
||||
|
||||
echo " ::: Starting docker specific checks & setup for docker pihole/pihole"
|
||||
|
||||
# TODO:
|
||||
#if [ ! -f /.piholeFirstBoot ] ; then
|
||||
# echo " ::: Not first container startup so not running docker's setup, re-create container to run setup again"
|
||||
#else
|
||||
# regular_setup_functions
|
||||
#fi
|
||||
|
||||
# Initial checks
|
||||
# ===========================
|
||||
validate_env || exit 1
|
||||
ensure_basic_configuration
|
||||
|
||||
# Web interface setup
|
||||
# ===========================
|
||||
setup_web_port
|
||||
load_web_password_secret
|
||||
setup_web_password
|
||||
setup_web_theme
|
||||
setup_web_temp_unit
|
||||
setup_web_layout
|
||||
setup_web_php_env
|
||||
|
||||
# lighttpd setup
|
||||
# ===========================
|
||||
setup_ipv4_ipv6
|
||||
setup_lighttpd_bind
|
||||
|
||||
# Misc Setup
|
||||
# ===========================
|
||||
setup_admin_email
|
||||
setup_blocklists
|
||||
|
||||
# FTL setup
|
||||
# ===========================
|
||||
setup_FTL_upstream_DNS
|
||||
[[ -n "${DHCP_ACTIVE}" && ${DHCP_ACTIVE} == "true" ]] && echo "Setting DHCP server" && setup_FTL_dhcp
|
||||
apply_FTL_Configs_From_Env
|
||||
setup_FTL_User
|
||||
setup_FTL_Interface
|
||||
setup_FTL_CacheSize
|
||||
setup_FTL_query_logging
|
||||
setup_FTL_server || true
|
||||
[ -n "${DNS_FQDN_REQUIRED}" ] && change_setting "DNS_FQDN_REQUIRED" "$DNS_FQDN_REQUIRED"
|
||||
[ -n "${DNSSEC}" ] && change_setting "DNSSEC" "$DNSSEC"
|
||||
[ -n "${DNS_BOGUS_PRIV}" ] && change_setting "DNS_BOGUS_PRIV" "$DNS_BOGUS_PRIV"
|
||||
# The following must be called last! It will source setupVars.conf and override any env vars users pass in before they have been applied
|
||||
setup_FTL_ProcessDNSSettings
|
||||
|
||||
test_configs
|
||||
|
||||
[ -f /.piholeFirstBoot ] && rm /.piholeFirstBoot
|
||||
|
||||
echo "::: Docker start setup complete"
|
||||
|
||||
pihole -v
|
||||
|
||||
echo " Container tag is: ${PIHOLE_DOCKER_TAG}"
|
||||
69
start.sh
69
start.sh
@@ -1,69 +0,0 @@
|
||||
#!/bin/bash -e
|
||||
# Dockerfile variables
|
||||
export TAG
|
||||
export ServerIP
|
||||
export ServerIPv6
|
||||
export PYTEST
|
||||
export PHP_ENV_CONFIG
|
||||
export PHP_ERROR_LOG
|
||||
export HOSTNAME
|
||||
export WEBLOGDIR
|
||||
export DNS1
|
||||
export DNS2
|
||||
export DNSSEC
|
||||
export DNS_BOGUS_PRIV
|
||||
export DNS_FQDN_REQUIRED
|
||||
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'
|
||||
|
||||
# The below functions are all contained in bash_functions.sh
|
||||
. /bash_functions.sh
|
||||
|
||||
# PH_TEST prevents the install from actually running (someone should rename that)
|
||||
PH_TEST=true . $PIHOLE_INSTALL
|
||||
|
||||
echo " ::: Starting docker specific checks & setup for docker pihole/pihole"
|
||||
|
||||
docker_checks
|
||||
|
||||
# TODO:
|
||||
#if [ ! -f /.piholeFirstBoot ] ; then
|
||||
# echo " ::: Not first container startup so not running docker's setup, re-create container to run setup again"
|
||||
#else
|
||||
# regular_setup_functions
|
||||
#fi
|
||||
|
||||
fix_capabilities
|
||||
generate_password
|
||||
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 "DNS_FQDN_REQUIRED" "$DNS_FQDN_REQUIRED"
|
||||
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"
|
||||
setup_php_env
|
||||
setup_dnsmasq_hostnames "$ServerIP" "$ServerIPv6" "$HOSTNAME"
|
||||
setup_ipv4_ipv6
|
||||
setup_lighttpd_bind "$ServerIP"
|
||||
setup_blocklists
|
||||
test_configs
|
||||
|
||||
[ -f /.piholeFirstBoot ] && rm /.piholeFirstBoot
|
||||
|
||||
echo " ::: Docker start setup complete"
|
||||
26
test/Dockerfile
Normal file
26
test/Dockerfile
Normal file
@@ -0,0 +1,26 @@
|
||||
FROM python:3.8-slim-bullseye
|
||||
|
||||
# Only works for docker CLIENT (bind mounted socket)
|
||||
COPY --from=docker:20.10.17 /usr/local/bin/docker /usr/local/bin/
|
||||
|
||||
ARG packages
|
||||
RUN apt-get update && \
|
||||
apt-get install -y python3-dev curl gcc make \
|
||||
libffi-dev libssl-dev ${packages} \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& pip3 install --no-cache-dir -U pip pipenv
|
||||
|
||||
RUN curl -L https://github.com/docker/compose/releases/download/1.25.5/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose && \
|
||||
chmod +x /usr/local/bin/docker-compose
|
||||
|
||||
COPY ./cmd.sh /usr/local/bin/
|
||||
COPY Pipfile* /root/
|
||||
WORKDIR /root
|
||||
|
||||
RUN pipenv install --system \
|
||||
&& sed -i 's|/bin/sh|/bin/bash|g' /usr/local/lib/python3.8/site-packages/testinfra/backend/docker.py
|
||||
|
||||
RUN echo "set -ex && cmd.sh && \$@" > /usr/local/bin/entrypoint.sh
|
||||
RUN chmod +x /usr/local/bin/entrypoint.sh
|
||||
ENTRYPOINT entrypoint.sh
|
||||
CMD cmd.sh
|
||||
@@ -7,7 +7,7 @@ verify_ssl = true
|
||||
|
||||
[packages]
|
||||
apipkg = "==1.5"
|
||||
atomicwrites = "==1.3.0"
|
||||
atomicwrites = "==1.4.1"
|
||||
attrs = "==19.3.0"
|
||||
bcrypt = "==3.1.7"
|
||||
cached-property = "==1.5.1"
|
||||
@@ -17,7 +17,7 @@ chardet = "==3.0.4"
|
||||
configparser = "==4.0.2"
|
||||
contextlib2 = "==0.6.0.post1"
|
||||
coverage = "==5.0.1"
|
||||
cryptography = "==2.8"
|
||||
cryptography = "==3.3.2"
|
||||
docker = "==4.1.0"
|
||||
dockerpty = "==0.4.1"
|
||||
docopt = "==0.6.2"
|
||||
@@ -32,7 +32,7 @@ jsonschema = "==3.2.0"
|
||||
more-itertools = "==5.0.0"
|
||||
pathlib2 = "==2.3.5"
|
||||
pluggy = "==0.13.1"
|
||||
py = "==1.8.1"
|
||||
py = "==1.10.0"
|
||||
pycparser = "==2.19"
|
||||
pyparsing = "==2.4.6"
|
||||
pyrsistent = "==0.15.6"
|
||||
@@ -40,7 +40,7 @@ pytest = "==4.6.8"
|
||||
pytest-cov = "==2.8.1"
|
||||
pytest-forked = "==1.1.3"
|
||||
pytest-xdist = "==1.31.0"
|
||||
requests = "==2.22.0"
|
||||
requests = "==2.28.1"
|
||||
scandir = "==1.10.0"
|
||||
six = "==1.13.0"
|
||||
subprocess32 = "==3.5.4"
|
||||
@@ -48,16 +48,17 @@ testinfra = "==3.3.0"
|
||||
texttable = "==1.6.2"
|
||||
toml = "==0.10.0"
|
||||
tox = "==3.14.3"
|
||||
urllib3 = "==1.25.7"
|
||||
urllib3 = "==1.26.5"
|
||||
virtualenv = "==16.7.9"
|
||||
wcwidth = "==0.1.7"
|
||||
zipp = "==0.6.0"
|
||||
"backports.shutil_get_terminal_size" = "==1.0.0"
|
||||
"backports.ssl_match_hostname" = "==3.7.0.1"
|
||||
Jinja2 = "==2.10.3"
|
||||
Jinja2 = "==2.11.3"
|
||||
MarkupSafe = "==1.1.1"
|
||||
PyYAML = "==5.2"
|
||||
PyYAML = "==5.4"
|
||||
websocket_client = "==0.57.0"
|
||||
python-dotenv = "==0.17.1"
|
||||
|
||||
[requires]
|
||||
python_version = "3.8"
|
||||
166
Pipfile.lock → test/Pipfile.lock
generated
166
Pipfile.lock → test/Pipfile.lock
generated
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"_meta": {
|
||||
"hash": {
|
||||
"sha256": "ee7705112b315cad899e08bd6eac8f47e9a200a0d47a1920cc192995b79f8673"
|
||||
"sha256": "c679c3eaa7a38959fa47159a01b66d7f7dd1e1667c188c9437a52302ee5a9290"
|
||||
},
|
||||
"pipfile-spec": 6,
|
||||
"requires": {
|
||||
@@ -26,11 +26,10 @@
|
||||
},
|
||||
"atomicwrites": {
|
||||
"hashes": [
|
||||
"sha256:03472c30eb2c5d1ba9227e4c2ca66ab8287fbfbbda3888aa93dc2e28fc6811b4",
|
||||
"sha256:75a9445bac02d8d058d5e1fe689654ba5a6556a1dfd8ce6ec55a0ed79866cfa6"
|
||||
"sha256:81b2c9071a49367a7f770170e5eec8cb66567cfbbc8c73d20ce5ca4a8d71cf11"
|
||||
],
|
||||
"index": "pypi",
|
||||
"version": "==1.3.0"
|
||||
"version": "==1.4.1"
|
||||
},
|
||||
"attrs": {
|
||||
"hashes": [
|
||||
@@ -60,6 +59,7 @@
|
||||
"sha256:0258f143f3de96b7c14f762c770f5fc56ccd72f8a1857a451c1cd9a655d9ac89",
|
||||
"sha256:0b0069c752ec14172c5f78208f1863d7ad6755a6fae6fe76ec2c80d13be41e42",
|
||||
"sha256:19a4b72a6ae5bb467fea018b825f0a7d917789bcfe893e53f15c92805d187294",
|
||||
"sha256:436a487dec749bca7e6e72498a75a5fa2433bda13bac91d023e18df9089ae0b8",
|
||||
"sha256:5432dd7b34107ae8ed6c10a71b4397f1c853bd39a4d6ffa7e35f40584cffd161",
|
||||
"sha256:6305557019906466fc42dbc53b46da004e72fd7a551c044a827e572c82191752",
|
||||
"sha256:69361315039878c0680be456640f8705d76cb4a3a3fe1e057e0f261b74be4b31",
|
||||
@@ -142,6 +142,14 @@
|
||||
"index": "pypi",
|
||||
"version": "==3.0.4"
|
||||
},
|
||||
"charset-normalizer": {
|
||||
"hashes": [
|
||||
"sha256:5189b6f22b01957427f35b6a08d9a0bc45b46d3788ef5a92e978433c7a35f8a5",
|
||||
"sha256:575e708016ff3a5e3681541cb9d79312c416835686d054a23accb873b254f413"
|
||||
],
|
||||
"markers": "python_full_version >= '3.6.0'",
|
||||
"version": "==2.1.0"
|
||||
},
|
||||
"configparser": {
|
||||
"hashes": [
|
||||
"sha256:254c1d9c79f60c45dfde850850883d5aaa7f19a23f13561243a050d5a7c3fe4c",
|
||||
@@ -197,30 +205,23 @@
|
||||
},
|
||||
"cryptography": {
|
||||
"hashes": [
|
||||
"sha256:02079a6addc7b5140ba0825f542c0869ff4df9a69c360e339ecead5baefa843c",
|
||||
"sha256:1df22371fbf2004c6f64e927668734070a8953362cd8370ddd336774d6743595",
|
||||
"sha256:369d2346db5934345787451504853ad9d342d7f721ae82d098083e1f49a582ad",
|
||||
"sha256:3cda1f0ed8747339bbdf71b9f38ca74c7b592f24f65cdb3ab3765e4b02871651",
|
||||
"sha256:44ff04138935882fef7c686878e1c8fd80a723161ad6a98da31e14b7553170c2",
|
||||
"sha256:4b1030728872c59687badcca1e225a9103440e467c17d6d1730ab3d2d64bfeff",
|
||||
"sha256:58363dbd966afb4f89b3b11dfb8ff200058fbc3b947507675c19ceb46104b48d",
|
||||
"sha256:6ec280fb24d27e3d97aa731e16207d58bd8ae94ef6eab97249a2afe4ba643d42",
|
||||
"sha256:7270a6c29199adc1297776937a05b59720e8a782531f1f122f2eb8467f9aab4d",
|
||||
"sha256:73fd30c57fa2d0a1d7a49c561c40c2f79c7d6c374cc7750e9ac7c99176f6428e",
|
||||
"sha256:7f09806ed4fbea8f51585231ba742b58cbcfbfe823ea197d8c89a5e433c7e912",
|
||||
"sha256:90df0cc93e1f8d2fba8365fb59a858f51a11a394d64dbf3ef844f783844cc793",
|
||||
"sha256:971221ed40f058f5662a604bd1ae6e4521d84e6cad0b7b170564cc34169c8f13",
|
||||
"sha256:a518c153a2b5ed6b8cc03f7ae79d5ffad7315ad4569b2d5333a13c38d64bd8d7",
|
||||
"sha256:b0de590a8b0979649ebeef8bb9f54394d3a41f66c5584fff4220901739b6b2f0",
|
||||
"sha256:b43f53f29816ba1db8525f006fa6f49292e9b029554b3eb56a189a70f2a40879",
|
||||
"sha256:d31402aad60ed889c7e57934a03477b572a03af7794fa8fb1780f21ea8f6551f",
|
||||
"sha256:de96157ec73458a7f14e3d26f17f8128c959084931e8997b9e655a39c8fde9f9",
|
||||
"sha256:df6b4dca2e11865e6cfbfb708e800efb18370f5a46fd601d3755bc7f85b3a8a2",
|
||||
"sha256:ecadccc7ba52193963c0475ac9f6fa28ac01e01349a2ca48509667ef41ffd2cf",
|
||||
"sha256:fb81c17e0ebe3358486cd8cc3ad78adbae58af12fc2bf2bc0bb84e8090fa5ce8"
|
||||
"sha256:0d7b69674b738068fa6ffade5c962ecd14969690585aaca0a1b1fc9058938a72",
|
||||
"sha256:1bd0ccb0a1ed775cd7e2144fe46df9dc03eefd722bbcf587b3e0616ea4a81eff",
|
||||
"sha256:3c284fc1e504e88e51c428db9c9274f2da9f73fdf5d7e13a36b8ecb039af6e6c",
|
||||
"sha256:49570438e60f19243e7e0d504527dd5fe9b4b967b5a1ff21cc12b57602dd85d3",
|
||||
"sha256:541dd758ad49b45920dda3b5b48c968f8b2533d8981bcdb43002798d8f7a89ed",
|
||||
"sha256:5a60d3780149e13b7a6ff7ad6526b38846354d11a15e21068e57073e29e19bed",
|
||||
"sha256:7951a966613c4211b6612b0352f5bf29989955ee592c4a885d8c7d0f830d0433",
|
||||
"sha256:922f9602d67c15ade470c11d616f2b2364950602e370c76f0c94c94ae672742e",
|
||||
"sha256:a0f0b96c572fc9f25c3f4ddbf4688b9b38c69836713fb255f4a2715d93cbaf44",
|
||||
"sha256:a777c096a49d80f9d2979695b835b0f9c9edab73b59e4ceb51f19724dda887ed",
|
||||
"sha256:a9a4ac9648d39ce71c2f63fe7dc6db144b9fa567ddfc48b9fde1b54483d26042",
|
||||
"sha256:aa4969f24d536ae2268c902b2c3d62ab464b5a66bcb247630d208a79a8098e9b",
|
||||
"sha256:c7390f9b2119b2b43160abb34f63277a638504ef8df99f11cb52c1fda66a2e6f",
|
||||
"sha256:e18e6ab84dfb0ab997faf8cca25a86ff15dfea4027b986322026cc99e0a892da"
|
||||
],
|
||||
"index": "pypi",
|
||||
"version": "==2.8"
|
||||
"version": "==3.3.2"
|
||||
},
|
||||
"docker": {
|
||||
"hashes": [
|
||||
@@ -304,11 +305,11 @@
|
||||
},
|
||||
"jinja2": {
|
||||
"hashes": [
|
||||
"sha256:74320bb91f31270f9551d46522e33af46a80c3d619f4a4bf42b3164d30b5911f",
|
||||
"sha256:9fe95f19286cfefaa917656583d020be14e7859c6b0252588391e47db34527de"
|
||||
"sha256:03e47ad063331dd6a3f04a43eddca8a966a26ba0c5b7207a9a9e4e08f1b29419",
|
||||
"sha256:a6d58433de0ae800347cab1fa3043cebbabe8baa9d29e668f1c768cb87a333c6"
|
||||
],
|
||||
"index": "pypi",
|
||||
"version": "==2.10.3"
|
||||
"version": "==2.11.3"
|
||||
},
|
||||
"jsonschema": {
|
||||
"hashes": [
|
||||
@@ -324,30 +325,54 @@
|
||||
"sha256:09027a7803a62ca78792ad89403b1b7a73a01c8cb65909cd876f7fcebd79b161",
|
||||
"sha256:09c4b7f37d6c648cb13f9230d847adf22f8171b1ccc4d5682398e77f40309235",
|
||||
"sha256:1027c282dad077d0bae18be6794e6b6b8c91d58ed8a8d89a89d59693b9131db5",
|
||||
"sha256:13d3144e1e340870b25e7b10b98d779608c02016d5184cfb9927a9f10c689f42",
|
||||
"sha256:195d7d2c4fbb0ee8139a6cf67194f3973a6b3042d742ebe0a9ed36d8b6f0c07f",
|
||||
"sha256:22c178a091fc6630d0d045bdb5992d2dfe14e3259760e713c490da5323866c39",
|
||||
"sha256:24982cc2533820871eba85ba648cd53d8623687ff11cbb805be4ff7b4c971aff",
|
||||
"sha256:29872e92839765e546828bb7754a68c418d927cd064fd4708fab9fe9c8bb116b",
|
||||
"sha256:2beec1e0de6924ea551859edb9e7679da6e4870d32cb766240ce17e0a0ba2014",
|
||||
"sha256:3b8a6499709d29c2e2399569d96719a1b21dcd94410a586a18526b143ec8470f",
|
||||
"sha256:43a55c2930bbc139570ac2452adf3d70cdbb3cfe5912c71cdce1c2c6bbd9c5d1",
|
||||
"sha256:46c99d2de99945ec5cb54f23c8cd5689f6d7177305ebff350a58ce5f8de1669e",
|
||||
"sha256:500d4957e52ddc3351cabf489e79c91c17f6e0899158447047588650b5e69183",
|
||||
"sha256:535f6fc4d397c1563d08b88e485c3496cf5784e927af890fb3c3aac7f933ec66",
|
||||
"sha256:596510de112c685489095da617b5bcbbac7dd6384aeebeda4df6025d0256a81b",
|
||||
"sha256:62fe6c95e3ec8a7fad637b7f3d372c15ec1caa01ab47926cfdf7a75b40e0eac1",
|
||||
"sha256:6788b695d50a51edb699cb55e35487e430fa21f1ed838122d722e0ff0ac5ba15",
|
||||
"sha256:6dd73240d2af64df90aa7c4e7481e23825ea70af4b4922f8ede5b9e35f78a3b1",
|
||||
"sha256:6f1e273a344928347c1290119b493a1f0303c52f5a5eae5f16d74f48c15d4a85",
|
||||
"sha256:6fffc775d90dcc9aed1b89219549b329a9250d918fd0b8fa8d93d154918422e1",
|
||||
"sha256:717ba8fe3ae9cc0006d7c451f0bb265ee07739daf76355d06366154ee68d221e",
|
||||
"sha256:79855e1c5b8da654cf486b830bd42c06e8780cea587384cf6545b7d9ac013a0b",
|
||||
"sha256:7c1699dfe0cf8ff607dbdcc1e9b9af1755371f92a68f706051cc8c37d447c905",
|
||||
"sha256:7fed13866cf14bba33e7176717346713881f56d9d2bcebab207f7a036f41b850",
|
||||
"sha256:84dee80c15f1b560d55bcfe6d47b27d070b4681c699c572af2e3c7cc90a3b8e0",
|
||||
"sha256:88e5fcfb52ee7b911e8bb6d6aa2fd21fbecc674eadd44118a9cc3863f938e735",
|
||||
"sha256:8defac2f2ccd6805ebf65f5eeb132adcf2ab57aa11fdf4c0dd5169a004710e7d",
|
||||
"sha256:98bae9582248d6cf62321dcb52aaf5d9adf0bad3b40582925ef7c7f0ed85fceb",
|
||||
"sha256:98c7086708b163d425c67c7a91bad6e466bb99d797aa64f965e9d25c12111a5e",
|
||||
"sha256:9add70b36c5666a2ed02b43b335fe19002ee5235efd4b8a89bfcf9005bebac0d",
|
||||
"sha256:9bf40443012702a1d2070043cb6291650a0841ece432556f784f004937f0f32c",
|
||||
"sha256:a6a744282b7718a2a62d2ed9d993cad6f5f585605ad352c11de459f4108df0a1",
|
||||
"sha256:acf08ac40292838b3cbbb06cfe9b2cb9ec78fce8baca31ddb87aaac2e2dc3bc2",
|
||||
"sha256:ade5e387d2ad0d7ebf59146cc00c8044acbd863725f887353a10df825fc8ae21",
|
||||
"sha256:b00c1de48212e4cc9603895652c5c410df699856a2853135b3967591e4beebc2",
|
||||
"sha256:b1282f8c00509d99fef04d8ba936b156d419be841854fe901d8ae224c59f0be5",
|
||||
"sha256:b1dba4527182c95a0db8b6060cc98ac49b9e2f5e64320e2b56e47cb2831978c7",
|
||||
"sha256:b2051432115498d3562c084a49bba65d97cf251f5a331c64a12ee7e04dacc51b",
|
||||
"sha256:b7d644ddb4dbd407d31ffb699f1d140bc35478da613b441c582aeb7c43838dd8",
|
||||
"sha256:ba59edeaa2fc6114428f1637ffff42da1e311e29382d81b339c1817d37ec93c6",
|
||||
"sha256:bf5aa3cbcfdf57fa2ee9cd1822c862ef23037f5c832ad09cfea57fa846dec193",
|
||||
"sha256:c8716a48d94b06bb3b2524c2b77e055fb313aeb4ea620c8dd03a105574ba704f",
|
||||
"sha256:caabedc8323f1e93231b52fc32bdcde6db817623d33e100708d9a68e1f53b26b",
|
||||
"sha256:cd5df75523866410809ca100dc9681e301e3c27567cf498077e8551b6d20e42f",
|
||||
"sha256:e249096428b3ae81b08327a63a485ad0878de3fb939049038579ac0ef61e17e7"
|
||||
"sha256:cdb132fc825c38e1aeec2c8aa9338310d29d337bebbd7baa06889d09a60a1fa2",
|
||||
"sha256:d53bc011414228441014aa71dbec320c66468c1030aae3a6e29778a3382d96e5",
|
||||
"sha256:d73a845f227b0bfe8a7455ee623525ee656a9e2e749e4742706d80a6065d5e2c",
|
||||
"sha256:d9be0ba6c527163cbed5e0857c451fcd092ce83947944d6c14bc95441203f032",
|
||||
"sha256:e249096428b3ae81b08327a63a485ad0878de3fb939049038579ac0ef61e17e7",
|
||||
"sha256:e8313f01ba26fbbe36c7be1966a7b7424942f670f38e666995b88d012765b9be",
|
||||
"sha256:feb7b34d6325451ef96bc0e36e1a6c0c1c64bc1fbec4b854f4529e51887b1621"
|
||||
],
|
||||
"index": "pypi",
|
||||
"version": "==1.1.1"
|
||||
@@ -363,10 +388,11 @@
|
||||
},
|
||||
"packaging": {
|
||||
"hashes": [
|
||||
"sha256:aec3fdbb8bc9e4bb65f0634b9f551ced63983a529d6a8931817d52fdd0816ddb",
|
||||
"sha256:fe1d8331dfa7cc0a883b49d75fc76380b2ab2734b220fbb87d774e4fd4b851f8"
|
||||
"sha256:dd47c42927d89ab911e606518907cc2d3a1f38bbd026385970643f9c5b8ecfeb",
|
||||
"sha256:ef103e05f519cdc783ae24ea4e2e0f508a9c99b2d4969652eed6a2e1ea5bd522"
|
||||
],
|
||||
"version": "==20.0"
|
||||
"markers": "python_full_version >= '3.6.0'",
|
||||
"version": "==21.3"
|
||||
},
|
||||
"pathlib2": {
|
||||
"hashes": [
|
||||
@@ -386,11 +412,11 @@
|
||||
},
|
||||
"py": {
|
||||
"hashes": [
|
||||
"sha256:5e27081401262157467ad6e7f851b7aa402c5852dbcb3dae06768434de5752aa",
|
||||
"sha256:c20fdd83a5dbc0af9efd622bee9a5564e278f6380fffcacc43ba6f43db2813b0"
|
||||
"sha256:21b81bda15b66ef5e1a777a21c4dcd9c20ad3efd0b3f817e7a809035269e1bd3",
|
||||
"sha256:3b80836aa6d1feeaa108e046da6423ab8f6ceda6468545ae8d02d9d58d18818a"
|
||||
],
|
||||
"index": "pypi",
|
||||
"version": "==1.8.1"
|
||||
"version": "==1.10.0"
|
||||
},
|
||||
"pycparser": {
|
||||
"hashes": [
|
||||
@@ -446,30 +472,48 @@
|
||||
"index": "pypi",
|
||||
"version": "==1.31.0"
|
||||
},
|
||||
"pyyaml": {
|
||||
"python-dotenv": {
|
||||
"hashes": [
|
||||
"sha256:0e7f69397d53155e55d10ff68fdfb2cf630a35e6daf65cf0bdeaf04f127c09dc",
|
||||
"sha256:2e9f0b7c5914367b0916c3c104a024bb68f269a486b9d04a2e8ac6f6597b7803",
|
||||
"sha256:35ace9b4147848cafac3db142795ee42deebe9d0dad885ce643928e88daebdcc",
|
||||
"sha256:38a4f0d114101c58c0f3a88aeaa44d63efd588845c5a2df5290b73db8f246d15",
|
||||
"sha256:483eb6a33b671408c8529106df3707270bfacb2447bf8ad856a4b4f57f6e3075",
|
||||
"sha256:4b6be5edb9f6bb73680f5bf4ee08ff25416d1400fbd4535fe0069b2994da07cd",
|
||||
"sha256:7f38e35c00e160db592091751d385cd7b3046d6d51f578b29943225178257b31",
|
||||
"sha256:8100c896ecb361794d8bfdb9c11fce618c7cf83d624d73d5ab38aef3bc82d43f",
|
||||
"sha256:c0ee8eca2c582d29c3c2ec6e2c4f703d1b7f1fb10bc72317355a746057e7346c",
|
||||
"sha256:e4c015484ff0ff197564917b4b4246ca03f411b9bd7f16e02a2f586eb48b6d04",
|
||||
"sha256:ebc4ed52dcc93eeebeae5cf5deb2ae4347b3a81c3fa12b0b8c976544829396a4"
|
||||
"sha256:00aa34e92d992e9f8383730816359647f358f4a3be1ba45e5a5cefd27ee91544",
|
||||
"sha256:b1ae5e9643d5ed987fc57cc2583021e38db531946518130777734f9589b3141f"
|
||||
],
|
||||
"index": "pypi",
|
||||
"version": "==5.2"
|
||||
"version": "==0.17.1"
|
||||
},
|
||||
"pyyaml": {
|
||||
"hashes": [
|
||||
"sha256:02c78d77281d8f8d07a255e57abdbf43b02257f59f50cc6b636937d68efa5dd0",
|
||||
"sha256:0dc9f2eb2e3c97640928dec63fd8dc1dd91e6b6ed236bd5ac00332b99b5c2ff9",
|
||||
"sha256:124fd7c7bc1e95b1eafc60825f2daf67c73ce7b33f1194731240d24b0d1bf628",
|
||||
"sha256:26fcb33776857f4072601502d93e1a619f166c9c00befb52826e7b774efaa9db",
|
||||
"sha256:31ba07c54ef4a897758563e3a0fcc60077698df10180abe4b8165d9895c00ebf",
|
||||
"sha256:3c49e39ac034fd64fd576d63bb4db53cda89b362768a67f07749d55f128ac18a",
|
||||
"sha256:52bf0930903818e600ae6c2901f748bc4869c0c406056f679ab9614e5d21a166",
|
||||
"sha256:5a3f345acff76cad4aa9cb171ee76c590f37394186325d53d1aa25318b0d4a09",
|
||||
"sha256:5e7ac4e0e79a53451dc2814f6876c2fa6f71452de1498bbe29c0b54b69a986f4",
|
||||
"sha256:7242790ab6c20316b8e7bb545be48d7ed36e26bbe279fd56f2c4a12510e60b4b",
|
||||
"sha256:737bd70e454a284d456aa1fa71a0b429dd527bcbf52c5c33f7c8eee81ac16b89",
|
||||
"sha256:8635d53223b1f561b081ff4adecb828fd484b8efffe542edcfdff471997f7c39",
|
||||
"sha256:8b818b6c5a920cbe4203b5a6b14256f0e5244338244560da89b7b0f1313ea4b6",
|
||||
"sha256:8bf38641b4713d77da19e91f8b5296b832e4db87338d6aeffe422d42f1ca896d",
|
||||
"sha256:a36a48a51e5471513a5aea920cdad84cbd56d70a5057cca3499a637496ea379c",
|
||||
"sha256:b2243dd033fd02c01212ad5c601dafb44fbb293065f430b0d3dbf03f3254d615",
|
||||
"sha256:cc547d3ead3754712223abb7b403f0a184e4c3eae18c9bb7fd15adef1597cc4b",
|
||||
"sha256:cc552b6434b90d9dbed6a4f13339625dc466fd82597119897e9489c953acbc22",
|
||||
"sha256:f3790156c606299ff499ec44db422f66f05a7363b39eb9d5b064f17bd7d7c47b",
|
||||
"sha256:f7a21e3d99aa3095ef0553e7ceba36fb693998fbb1226f1392ce33681047465f",
|
||||
"sha256:fdc6b2cb4b19e431994f25a9160695cc59a4e861710cc6fc97161c5e845fc579"
|
||||
],
|
||||
"index": "pypi",
|
||||
"version": "==5.4"
|
||||
},
|
||||
"requests": {
|
||||
"hashes": [
|
||||
"sha256:11e007a8a2aa0323f5a921e9e6a2d7e4e67d9877e85773fba9ba6419025cbeb4",
|
||||
"sha256:9cf5292fcd0f598c671cfc1e0d7d1a7f13bb8085e9a590f48c010551dc6c4b31"
|
||||
"sha256:7c5599b102feddaa661c826c56ab4fee28bfd17f5abca1ebbe3e7f19d7c97983",
|
||||
"sha256:8fefa2a1a1365bf5520aac41836fbee479da67864514bdb821f31ce07ce65349"
|
||||
],
|
||||
"index": "pypi",
|
||||
"version": "==2.22.0"
|
||||
"version": "==2.28.1"
|
||||
},
|
||||
"scandir": {
|
||||
"hashes": [
|
||||
@@ -488,6 +532,14 @@
|
||||
"index": "pypi",
|
||||
"version": "==1.10.0"
|
||||
},
|
||||
"setuptools": {
|
||||
"hashes": [
|
||||
"sha256:16923d366ced322712c71ccb97164d07472abeecd13f3a6c283f6d5d26722793",
|
||||
"sha256:db3b8e2f922b2a910a29804776c643ea609badb6a32c4bcc226fd4fd902cce65"
|
||||
],
|
||||
"markers": "python_version >= '3.7'",
|
||||
"version": "==63.1.0"
|
||||
},
|
||||
"six": {
|
||||
"hashes": [
|
||||
"sha256:1f1b7d42e254082a9db6279deae68afb421ceba6158efa6131de7b3003ee93fd",
|
||||
@@ -499,6 +551,7 @@
|
||||
"subprocess32": {
|
||||
"hashes": [
|
||||
"sha256:88e37c1aac5388df41cc8a8456bb49ebffd321a3ad4d70358e3518176de3a56b",
|
||||
"sha256:e45d985aef903c5b7444d34350b05da91a9e0ea015415ab45a21212786c649d0",
|
||||
"sha256:eb2937c80497978d181efa1b839ec2d9622cf9600a039a79d0e108d1f9aec79d"
|
||||
],
|
||||
"index": "pypi",
|
||||
@@ -523,7 +576,8 @@
|
||||
"toml": {
|
||||
"hashes": [
|
||||
"sha256:229f81c57791a41d65e399fc06bf0848bab550a9dfd5ed66df18ce5f05e73d5c",
|
||||
"sha256:235682dd292d5899d361a811df37e04a8828a5b1da3115886b73cf81ebc9100e"
|
||||
"sha256:235682dd292d5899d361a811df37e04a8828a5b1da3115886b73cf81ebc9100e",
|
||||
"sha256:f1db651f9657708513243e61e6cc67d101a39bad662eaa9b5546f789338e07a3"
|
||||
],
|
||||
"index": "pypi",
|
||||
"version": "==0.10.0"
|
||||
@@ -538,11 +592,11 @@
|
||||
},
|
||||
"urllib3": {
|
||||
"hashes": [
|
||||
"sha256:a8a318824cc77d1fd4b2bec2ded92646630d7fe8619497b142c84a9e6f5a7293",
|
||||
"sha256:f3c5fd51747d450d4dcf6f923c81f78f811aab8205fda64b0aba34a4e48b0745"
|
||||
"sha256:753a0374df26658f99d826cfe40394a686d05985786d946fbe4165b5148f5a7c",
|
||||
"sha256:a7acd0977125325f516bda9735fa7142b909a8d01e8b2e4c8108d0984e6e0098"
|
||||
],
|
||||
"index": "pypi",
|
||||
"version": "==1.25.7"
|
||||
"version": "==1.26.5"
|
||||
},
|
||||
"virtualenv": {
|
||||
"hashes": [
|
||||
14
test/TESTING.md
Normal file
14
test/TESTING.md
Normal file
@@ -0,0 +1,14 @@
|
||||
# Prerequisites
|
||||
|
||||
Make sure you have bash & docker installed.
|
||||
Python and some test hacks are crammed into the `Dockerfile_build` file for now.
|
||||
Revisions in the future may re-enable running python on your host (not just in docker).
|
||||
|
||||
# Running tests locally
|
||||
|
||||
`./build-and-test.sh`
|
||||
|
||||
Should result in:
|
||||
|
||||
- An image named `pihole:[branch-name]` being built
|
||||
- Tests being ran to confirm the image doesn't have any regressions
|
||||
9
test/cmd.sh
Executable file
9
test/cmd.sh
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eux
|
||||
|
||||
docker build ./src --tag pihole:${GIT_TAG} --no-cache
|
||||
docker images
|
||||
|
||||
# TODO: Add junitxml output and have something consume it
|
||||
# 2 parallel max b/c race condition with docker fixture (I think?)
|
||||
py.test -vv -n 2 ./test/tests/
|
||||
@@ -1,3 +1,4 @@
|
||||
-i https://pypi.org/simple/
|
||||
apipkg==1.5
|
||||
atomicwrites==1.3.0
|
||||
attrs==19.3.0
|
||||
@@ -11,7 +12,7 @@ chardet==3.0.4
|
||||
configparser==4.0.2
|
||||
contextlib2==0.6.0.post1
|
||||
coverage==5.0.1
|
||||
cryptography==2.8
|
||||
cryptography==3.3.2
|
||||
docker==4.1.0
|
||||
dockerpty==0.4.1
|
||||
docopt==0.6.2
|
||||
@@ -22,22 +23,22 @@ funcsigs==1.0.2
|
||||
idna==2.8
|
||||
importlib-metadata==1.3.0
|
||||
ipaddress==1.0.23
|
||||
Jinja2==2.10.3
|
||||
jinja2==2.11.3
|
||||
jsonschema==3.2.0
|
||||
MarkupSafe==1.1.1
|
||||
markupsafe==1.1.1
|
||||
more-itertools==5.0.0
|
||||
packaging==19.2
|
||||
packaging==20.9
|
||||
pathlib2==2.3.5
|
||||
pluggy==0.13.1
|
||||
py==1.8.1
|
||||
py==1.10.0
|
||||
pycparser==2.19
|
||||
pyparsing==2.4.6
|
||||
pyrsistent==0.15.6
|
||||
pytest==4.6.8
|
||||
pytest-cov==2.8.1
|
||||
pytest-forked==1.1.3
|
||||
pytest-xdist==1.31.0
|
||||
PyYAML==5.2
|
||||
pytest==4.6.8
|
||||
pyyaml==5.4
|
||||
requests==2.22.0
|
||||
scandir==1.10.0
|
||||
six==1.13.0
|
||||
@@ -46,8 +47,9 @@ testinfra==3.3.0
|
||||
texttable==1.6.2
|
||||
toml==0.10.0
|
||||
tox==3.14.3
|
||||
urllib3==1.25.7
|
||||
urllib3==1.25.9
|
||||
virtualenv==16.7.9
|
||||
wcwidth==0.1.7
|
||||
websocket-client==0.57.0
|
||||
zipp==0.6.0
|
||||
python-dotenv==0.17.1
|
||||
@@ -1,203 +0,0 @@
|
||||
|
||||
import os
|
||||
import pytest
|
||||
import re
|
||||
|
||||
|
||||
@pytest.mark.parametrize('test_args,expected_ipv6,expected_stdout', [
|
||||
('', True, 'IPv4 and IPv6'),
|
||||
('-e "IPv6=True"', True, 'IPv4 and IPv6'),
|
||||
('-e "IPv6=False"', False, 'IPv4'),
|
||||
('-e "IPv6=foobar"', False, 'IPv4'),
|
||||
])
|
||||
def test_IPv6_not_True_removes_ipv6(Docker, Slow, test_args, expected_ipv6, expected_stdout):
|
||||
''' When a user overrides IPv6=True they only get IPv4 listening webservers '''
|
||||
IPV6_LINE = 'use-ipv6.pl'
|
||||
WEB_CONFIG = '/etc/lighttpd/lighttpd.conf'
|
||||
|
||||
function = Docker.run('. /bash_functions.sh ; setup_ipv4_ipv6')
|
||||
assert "Using {}".format(expected_stdout) in function.stdout
|
||||
if expected_stdout == 'IPv4':
|
||||
assert 'IPv6' not in function.stdout
|
||||
# On overlay2(?) docker sometimes writes to disk are slow enough to break some tests...
|
||||
expected_ipv6_check = lambda: (\
|
||||
IPV6_LINE in Docker.run('grep \'use-ipv6.pl\' {}'.format(WEB_CONFIG)).stdout
|
||||
) == expected_ipv6
|
||||
Slow(expected_ipv6_check)
|
||||
|
||||
|
||||
@pytest.mark.parametrize('test_args', ['-e "WEB_PORT=999"'])
|
||||
def test_overrides_default_WEB_PORT(Docker, Slow, test_args):
|
||||
''' When a --net=host user sets WEB_PORT to avoid synology's 80 default IPv4 and or IPv6 ports are updated'''
|
||||
CONFIG_LINE = 'server.port\s*=\s*999'
|
||||
WEB_CONFIG = '/etc/lighttpd/lighttpd.conf'
|
||||
|
||||
function = Docker.run('. /bash_functions.sh ; eval `grep setup_web_port /start.sh`')
|
||||
assert "Custom WEB_PORT set to 999" in function.stdout
|
||||
assert "INFO: Without proper router DNAT forwarding to 127.0.0.1:999, you may not get any blocked websites on ads" in function.stdout
|
||||
Slow(lambda: re.search(CONFIG_LINE, Docker.run('cat {}'.format(WEB_CONFIG)).stdout) != None)
|
||||
Slow(lambda: re.search('://127.0.0.1:999/', Docker.run('cat /var/www/html/pihole/index.php').stdout) != None)
|
||||
# grep fails to find any of the old address w/o port
|
||||
#assert Docker.run('grep -r "://127.0.0.1/" /var/www/html/').stdout == ''
|
||||
#assert Docker.run('grep -r "://pi.hole/" /var/www/html/').stdout == ''
|
||||
## Find at least one instance of our changes
|
||||
## upstream repos determines how many and I don't want to keep updating this test
|
||||
#assert int(Docker.run('grep -rl "://127.0.0.1:999/" /var/www/html/ | wc -l').stdout) >= 1
|
||||
#assert int(Docker.run('grep -rl "://pi.hole:999/" /var/www/html/ | wc -l').stdout) >= 1
|
||||
|
||||
|
||||
@pytest.mark.parametrize('test_args,expected_error', [
|
||||
('-e WEB_PORT="LXXX"', 'WARNING: Custom WEB_PORT not used - LXXX is not an integer'),
|
||||
('-e WEB_PORT="1,000"', 'WARNING: Custom WEB_PORT not used - 1,000 is not an integer'),
|
||||
('-e WEB_PORT="99999"', 'WARNING: Custom WEB_PORT not used - 99999 is not within valid port range of 1-65535'),
|
||||
])
|
||||
def test_bad_input_to_WEB_PORT(Docker, test_args, expected_error):
|
||||
function = Docker.run('. /bash_functions.sh ; eval `grep setup_web_port /start.sh`')
|
||||
assert expected_error in function.stdout
|
||||
|
||||
|
||||
# DNS Environment Variable behavior in combinations of modified pihole LTE settings
|
||||
@pytest.mark.parametrize('args_env, expected_stdout, dns1, dns2', [
|
||||
('', 'default DNS', '8.8.8.8', '8.8.4.4' ),
|
||||
('-e DNS1="1.2.3.4"', 'custom DNS', '1.2.3.4', '8.8.4.4' ),
|
||||
('-e DNS2="1.2.3.4"', 'custom DNS', '8.8.8.8', '1.2.3.4' ),
|
||||
('-e DNS1="1.2.3.4" -e DNS2="2.2.3.4"', 'custom DNS', '1.2.3.4', '2.2.3.4' ),
|
||||
('-e DNS1="1.2.3.4" -e DNS2="no"', 'custom DNS', '1.2.3.4', None ),
|
||||
('-e DNS2="no"', 'custom DNS', '8.8.8.8', None ),
|
||||
])
|
||||
def test_override_default_servers_with_DNS_EnvVars(Docker, Slow, args_env, expected_stdout, dns1, dns2):
|
||||
''' on first boot when DNS vars are NOT set explain default google DNS settings are used
|
||||
or when DNS vars are set override the pihole DNS settings '''
|
||||
assert Docker.run('test -f /.piholeFirstBoot').rc == 0
|
||||
function = Docker.run('. /bash_functions.sh ; eval `grep "^setup_dnsmasq " /start.sh`')
|
||||
assert expected_stdout in function.stdout
|
||||
expected_servers = 'server={}\n'.format(dns1) if dns2 == None else 'server={}\nserver={}\n'.format(dns1, dns2)
|
||||
Slow(lambda: expected_servers == Docker.run('grep "^server=[^/]" /etc/dnsmasq.d/01-pihole.conf').stdout)
|
||||
|
||||
|
||||
@pytest.mark.skipif(os.environ.get('TRAVIS') == 'true',
|
||||
reason="Can't get setupVar setup to work on travis")
|
||||
@pytest.mark.parametrize('args_env, dns1, dns2, expected_stdout', [
|
||||
|
||||
('', '9.9.9.1', '9.9.9.2',
|
||||
'Existing DNS servers used'),
|
||||
('-e DNS1="1.2.3.4"', '9.9.9.1', '9.9.9.2',
|
||||
'Docker DNS variables not used\nExisting DNS servers used (9.9.9.1 & 9.9.9.2)'),
|
||||
('-e DNS2="1.2.3.4"', '8.8.8.8', None,
|
||||
'Docker DNS variables not used\nExisting DNS servers used (8.8.8.8 & unset)'),
|
||||
('-e DNS1="1.2.3.4" -e DNS2="2.2.3.4"', '1.2.3.4', '2.2.3.4',
|
||||
'Docker DNS variables not used\nExisting DNS servers used (1.2.3.4 & 2.2.3.4'),
|
||||
])
|
||||
def test_DNS_Envs_are_secondary_to_setupvars(Docker, Slow, args_env, expected_stdout, dns1, dns2):
|
||||
''' on second boot when DNS vars are set just use pihole DNS settings
|
||||
or when DNS vars and FORCE_DNS var are set override the pihole DNS settings '''
|
||||
# Given we are not booting for the first time
|
||||
assert Docker.run('rm /.piholeFirstBoot').rc == 0
|
||||
|
||||
# and a user already has custom pihole dns variables in setup vars
|
||||
dns_count = 1
|
||||
setupVars = '/etc/pihole/setupVars.conf'
|
||||
Docker.run('sed -i "/^PIHOLE_DNS/ d" {}'.format(setupVars))
|
||||
Docker.run('echo "PIHOLE_DNS_1={}" | tee -a {}'.format(dns1, setupVars))
|
||||
if dns2:
|
||||
Docker.run('echo "PIHOLE_DNS_2={}" | tee -a {}'.format(dns2, setupVars))
|
||||
Docker.run('sync {}'.format(setupVars))
|
||||
Slow(lambda: 'PIHOLE_DNS' in Docker.run('cat {}'.format(setupVars)).stdout)
|
||||
|
||||
# When we run setup dnsmasq during startup of the container
|
||||
function = Docker.run('. /bash_functions.sh ; eval `grep "^setup_dnsmasq " /start.sh`')
|
||||
assert expected_stdout in function.stdout
|
||||
|
||||
# Then the servers are still what the user had customized if forced dnsmasq is not set
|
||||
expected_servers = ['server={}'.format(dns1)]
|
||||
if dns2:
|
||||
expected_servers.append('server={}'.format(dns2))
|
||||
Slow(lambda: Docker.run('grep "^server=[^/]" /etc/dnsmasq.d/01-pihole.conf').stdout.strip().split('\n') == \
|
||||
expected_servers)
|
||||
|
||||
|
||||
@pytest.mark.parametrize('args_env, expected_stdout, expected_config_line', [
|
||||
('', 'binding to default interface: eth0', 'interface=eth0' ),
|
||||
('-e INTERFACE="eth0"', 'binding to default interface: eth0', 'interface=eth0' ),
|
||||
('-e INTERFACE="br0"', 'binding to custom interface: br0', 'interface=br0'),
|
||||
])
|
||||
def test_DNS_interface_override_defaults(Docker, Slow, args_env, expected_stdout, expected_config_line):
|
||||
''' When INTERFACE environment var is passed in, overwrite dnsmasq interface '''
|
||||
function = Docker.run('. /bash_functions.sh ; eval `grep "^setup_dnsmasq " /start.sh`')
|
||||
assert expected_stdout in function.stdout
|
||||
Slow(lambda: expected_config_line + '\n' == Docker.run('grep "^interface" /etc/dnsmasq.d/01-pihole.conf').stdout)
|
||||
|
||||
|
||||
expected_debian_lines = [
|
||||
'"VIRTUAL_HOST" => "127.0.0.1"',
|
||||
'"ServerIP" => "127.0.0.1"',
|
||||
'"PHP_ERROR_LOG" => "/var/log/lighttpd/error.log"'
|
||||
]
|
||||
|
||||
|
||||
@pytest.mark.parametrize('expected_lines,repeat_function', [
|
||||
(expected_debian_lines, 1),
|
||||
(expected_debian_lines, 2)
|
||||
])
|
||||
def test_debian_setup_php_env(Docker, expected_lines, repeat_function):
|
||||
''' confirm all expected output is there and nothing else '''
|
||||
stdout = ''
|
||||
for i in range(repeat_function):
|
||||
stdout = Docker.run('. /bash_functions.sh ; eval `grep setup_php_env /start.sh`').stdout
|
||||
for expected_line in expected_lines:
|
||||
search_config_cmd = "grep -c '{}' /etc/lighttpd/conf-enabled/15-fastcgi-php.conf".format(expected_line)
|
||||
search_config_count = Docker.run(search_config_cmd)
|
||||
found_lines = int(search_config_count.stdout.rstrip('\n'))
|
||||
if found_lines > 1:
|
||||
assert False, "Found line {} times (more than once): {}".format(expected_line)
|
||||
|
||||
|
||||
def test_webPassword_random_generation(Docker):
|
||||
''' When a user sets webPassword env the admin password gets set to that '''
|
||||
function = Docker.run('. /bash_functions.sh ; eval `grep generate_password /start.sh`')
|
||||
assert 'assigning random password' in function.stdout.lower()
|
||||
|
||||
|
||||
@pytest.mark.parametrize('entrypoint,cmd', [('--entrypoint=tail','-f /dev/null')])
|
||||
@pytest.mark.parametrize('args_env,secure,setupVarsHash', [
|
||||
('-e ServerIP=1.2.3.4 -e WEBPASSWORD=login', True, 'WEBPASSWORD=6060d59351e8c2f48140f01b2c3f3b61652f396c53a5300ae239ebfbe7d5ff08'),
|
||||
('-e ServerIP=1.2.3.4 -e WEBPASSWORD=""', False, ''),
|
||||
])
|
||||
def test_webPassword_env_assigns_password_to_file_or_removes_if_empty(Docker, args_env, secure, setupVarsHash):
|
||||
''' When a user sets webPassword env the admin password gets set or removed if empty '''
|
||||
function = Docker.run('. /bash_functions.sh ; eval `grep setup_web_password /start.sh`')
|
||||
|
||||
if secure:
|
||||
assert 'new password set' in function.stdout.lower()
|
||||
assert Docker.run('grep -q \'{}\' {}'.format(setupVarsHash, '/etc/pihole/setupVars.conf')).rc == 0
|
||||
else:
|
||||
assert 'password removed' in function.stdout.lower()
|
||||
assert Docker.run('grep -q \'^WEBPASSWORD=$\' /etc/pihole/setupVars.conf').rc == 0
|
||||
|
||||
|
||||
@pytest.mark.parametrize('entrypoint,cmd', [('--entrypoint=tail','-f /dev/null')])
|
||||
@pytest.mark.parametrize('test_args', ['-e WEBPASSWORD=login', '-e WEBPASSWORD=""'])
|
||||
def test_webPassword_pre_existing_trumps_all_envs(Docker, args_env, test_args):
|
||||
'''When a user setup webPassword in the volume prior to first container boot,
|
||||
during prior container boot, the prior volume password is left intact / setup skipped'''
|
||||
Docker.run('. /opt/pihole/webpage.sh ; add_setting WEBPASSWORD volumepass')
|
||||
function = Docker.run('. /bash_functions.sh ; eval `grep setup_web_password /start.sh`')
|
||||
|
||||
assert '::: Pre existing WEBPASSWORD found' in function.stdout
|
||||
assert Docker.run('grep -q \'{}\' {}'.format('WEBPASSWORD=volumepass', '/etc/pihole/setupVars.conf')).rc == 0
|
||||
|
||||
|
||||
@pytest.mark.parametrize('args_dns, expected_stdout', [
|
||||
# No DNS passed will vary by the host this is ran on, bad idea for a test
|
||||
#('', 'WARNING Misconfigured DNS in /etc/resolv.conf: Primary DNS should be 127.0.0.1'),
|
||||
('--dns 1.1.1.1', 'WARNING Misconfigured DNS in /etc/resolv.conf: Two DNS servers are recommended, 127.0.0.1 and any backup server\n'
|
||||
'WARNING Misconfigured DNS in /etc/resolv.conf: Primary DNS should be 127.0.0.1 (found 1.1.1.1)'),
|
||||
('--dns 127.0.0.1', 'WARNING Misconfigured DNS in /etc/resolv.conf: Two DNS servers are recommended, 127.0.0.1 and any backup server'),
|
||||
('--dns 1.1.1.1 --dns 127.0.0.1', 'WARNING Misconfigured DNS in /etc/resolv.conf: Primary DNS should be 127.0.0.1 (found 1.1.1.1)'),
|
||||
('--dns 127.0.0.1 --dns 1.1.1.1', 'OK: Checks passed for /etc/resolv.conf DNS servers'),
|
||||
])
|
||||
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)
|
||||
assert expected_stdout in function.stdout
|
||||
@@ -1,54 +0,0 @@
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.fixture(scope='module')
|
||||
def start_cmd():
|
||||
''' broken by default, required override '''
|
||||
return None
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def RunningPiHole(DockerPersist, Slow, persist_webserver, persist_tag, start_cmd):
|
||||
''' Override the RunningPiHole to run and check for success of a
|
||||
pihole-FTL start based `pihole` script command
|
||||
|
||||
Individual tests all must override start_cmd'''
|
||||
#print DockerPersist.run('ps -ef').stdout
|
||||
assert DockerPersist.dig.run('ping -c 1 test_pihole').rc == 0
|
||||
Slow(lambda: DockerPersist.run('pgrep pihole-FTL').rc == 0)
|
||||
Slow(lambda: DockerPersist.run('pgrep {}'.format(persist_webserver)).rc == 0)
|
||||
oldpid = DockerPersist.run('pidof pihole-FTL')
|
||||
cmd = DockerPersist.run('pihole {}'.format(start_cmd))
|
||||
Slow(lambda: DockerPersist.run('pgrep pihole-FTL').rc == 0)
|
||||
newpid = DockerPersist.run('pidof pihole-FTL')
|
||||
for pid in [oldpid, newpid]:
|
||||
assert pid != ''
|
||||
# ensure a new pid for pihole-FTL appeared due to service restart
|
||||
assert oldpid != newpid
|
||||
assert cmd.rc == 0
|
||||
# Save out cmd result to check different stdout of start/enable/disable
|
||||
DockerPersist.cmd = cmd
|
||||
return DockerPersist
|
||||
|
||||
|
||||
@pytest.mark.parametrize('start_cmd,hostname,expected_ip, expected_messages', [
|
||||
('enable', 'pi.hole', '127.0.0.1', ['Blocking already enabled,','nothing to do']),
|
||||
('disable', 'pi.hole', '127.0.0.1', ['Disabling blocking','Pi-hole Disabled']),
|
||||
])
|
||||
def test_pihole_enable_disable_command(RunningPiHole, Dig, persist_tag, start_cmd, hostname, expected_ip, expected_messages):
|
||||
''' the start_cmd tests are all built into the RunningPiHole fixture in this file '''
|
||||
dig_cmd = "dig +time=1 +noall +answer {} @test_pihole".format(hostname)
|
||||
lookup = RunningPiHole.dig.run(dig_cmd)
|
||||
assert lookup.rc == 0
|
||||
lookup_ip = lookup.stdout.split()[4]
|
||||
assert lookup_ip == expected_ip
|
||||
|
||||
for part_of_output in expected_messages:
|
||||
assert part_of_output in RunningPiHole.cmd.stdout
|
||||
|
||||
@pytest.mark.parametrize('start_cmd,expected_message', [
|
||||
('-up', 'Function not supported in Docker images')
|
||||
])
|
||||
def test_pihole_update_command(RunningPiHole, start_cmd, expected_message):
|
||||
assert RunningPiHole.cmd.stdout.strip() == expected_message
|
||||
|
||||
@@ -1,69 +0,0 @@
|
||||
|
||||
import pytest
|
||||
import time
|
||||
''' conftest.py provides the defaults through fixtures '''
|
||||
''' Note, testinfra builtins don't seem fully compatible with
|
||||
docker containers (esp. musl based OSs) stripped down nature '''
|
||||
|
||||
# If the test runs /start.sh, do not let s6 run it too! Kill entrypoint to avoid race condition/duplicated execution
|
||||
@pytest.mark.parametrize('persist_entrypoint,persist_cmd,persist_args_env', [('--entrypoint=tail','-f /dev/null','')])
|
||||
def test_ServerIP_missing_is_not_required_anymore(RunningPiHole):
|
||||
''' When args to docker are empty start.sh exits saying ServerIP is required '''
|
||||
start = Docker.run('/start.sh')
|
||||
error_msg = "ERROR: To function correctly you must pass an environment variables of 'ServerIP' into the docker container"
|
||||
assert start.rc == 1
|
||||
assert error_msg in start.stdout
|
||||
|
||||
# If the test runs /start.sh, do not let s6 run it too! Kill entrypoint to avoid race condition/duplicated execution
|
||||
@pytest.mark.parametrize('entrypoint,cmd', [('--entrypoint=tail','-f /dev/null')])
|
||||
@pytest.mark.parametrize('args,error_msg,expect_rc', [
|
||||
('-e ServerIP="1.2.3.z"', "ServerIP Environment variable (1.2.3.z) doesn't appear to be a valid IPv4 address",1),
|
||||
('-e ServerIP="1.2.3.4" -e ServerIPv6="1234:1234:1234:ZZZZ"', "Environment variable (1234:1234:1234:ZZZZ) doesn't appear to be a valid IPv6 address",1),
|
||||
('-e ServerIP="1.2.3.4" -e ServerIPv6="kernel"', "ERROR: You passed in IPv6 with a value of 'kernel'",1),
|
||||
])
|
||||
def test_ServerIP_invalid_IPs_triggers_exit_error(Docker, error_msg, expect_rc):
|
||||
''' When args to docker are empty start.sh exits saying ServerIP is required '''
|
||||
start = Docker.run('/start.sh')
|
||||
assert start.rc == expect_rc
|
||||
assert 'ERROR' in start.stdout
|
||||
assert error_msg in start.stdout
|
||||
|
||||
@pytest.mark.parametrize('hostname,expected_ip', [
|
||||
('pi.hole', '127.0.0.1'),
|
||||
('google-public-dns-a.google.com', '8.8.8.8'),
|
||||
('b.resolvers.Level3.net', '4.2.2.2')
|
||||
])
|
||||
def test_dns_responses(RunningPiHole, hostname, expected_ip):
|
||||
dig_cmd = "dig +time=1 +noall +answer {} @test_pihole | awk '{{ print $5 }}'".format(hostname)
|
||||
lookup = RunningPiHole.dig.run(dig_cmd).stdout.rstrip('\n')
|
||||
assert lookup == expected_ip
|
||||
|
||||
def test_indecies_are_present(RunningPiHole):
|
||||
File = RunningPiHole.get_module('File')
|
||||
File('/var/www/html/pihole/index.html').exists
|
||||
File('/var/www/html/pihole/index.js').exists
|
||||
|
||||
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')))
|
||||
|
||||
|
||||
@pytest.mark.parametrize('addr', [ 'localhost' ] )
|
||||
@pytest.mark.parametrize('url', [ '/admin/', '/admin/index.php' ] )
|
||||
def test_admin_requests_load_as_expected(RunningPiHole, version, addr, url):
|
||||
command = 'curl -L -s -o /tmp/curled_file -w "%{{http_code}}" http://{}{}'.format(addr, url)
|
||||
http_rc = RunningPiHole.run(command)
|
||||
page_contents = RunningPiHole.run('cat /tmp/curled_file ').stdout
|
||||
expected_http_code = 200
|
||||
|
||||
validate_curl(http_rc, expected_http_code, page_contents)
|
||||
assert http_rc.rc == 0
|
||||
assert int(http_rc.stdout) == expected_http_code
|
||||
for html_text in ['dns_queries_today', 'Content-Security-Policy',
|
||||
'scripts/pi-hole/js/footer.js']:
|
||||
# version removed, not showing up in footer of test env (fix me)
|
||||
assert html_text in page_contents
|
||||
|
||||
0
test/tests/__init__.py
Normal file
0
test/tests/__init__.py
Normal file
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user