Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
U
Utility
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
Utility
Commits
49eb98a2
Commit
49eb98a2
authored
Dec 19, 2020
by
nanahira
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of git.mycard.moe:mycard/utility
parents
d8e31187
56b745dc
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
55 additions
and
37 deletions
+55
-37
.gitignore
.gitignore
+1
-1
defaults/main.yml
defaults/main.yml
+3
-1
files/smartdns/.gitkeep
files/smartdns/.gitkeep
+1
-0
gen.sh
gen.sh
+5
-3
tasks/main.yml
tasks/main.yml
+13
-8
templates/apt-cacher-ng-docker/Dockerfile.j2
templates/apt-cacher-ng-docker/Dockerfile.j2
+0
-18
templates/docker-compose.yml.j2
templates/docker-compose.yml.j2
+24
-4
templates/smartdns/smartdns.conf.j2
templates/smartdns/smartdns.conf.j2
+8
-2
No files found.
.gitignore
View file @
49eb98a2
/dnsmasq-china-list
/
templates/smartdns/smartdns.conf.j2
/
files/smartdns/china-list.conf
defaults/main.yml
View file @
49eb98a2
...
...
@@ -3,7 +3,7 @@
utility_root
:
~/utility
apt_cacher_path
:
./apt-cacher-ng/cache
apt_mirror
:
mirrors.tuna.tsinghua.edu.cn
smartdns_image
:
yousiki/smartdns:x86_64
smartdns_image
:
git-registry.mycard.moe/nanahira/docker-smartdns:latest
web_port_occupied
:
false
# array of addresses
smartdns_address
:
null
...
...
@@ -12,10 +12,12 @@ smartdns_ports:
-
54
-
55
smartdns_disable_ipv6
:
false
smartdns_cache_path
:
./smartdns-cache
kms_address
:
null
squid_address
:
null
apt_cacher_address
:
null
sniproxy_address
:
null
ntp_address
:
null
smartdns_china_dns
:
-
114.114.114.114
-
223.5.5.5
...
...
files/smartdns/.gitkeep
0 → 100644
View file @
49eb98a2
1
gen.sh
View file @
49eb98a2
...
...
@@ -4,6 +4,8 @@ git fetch origin master
git reset
--hard
FETCH_HEAD
make smartdns
cd
..
cp
-rf
./templates/smartdns/header.conf.j2 ./templates/smartdns/smartdns.conf.j2
sed
's/114.114.114.114/china/g'
./dnsmasq-china-list/
*
.smartdns.conf
>>
./templates/smartdns/smartdns.conf.j2
grep
-P
'^bogus-nxdomain=.+$'
dnsmasq-china-list/bogus-nxdomain.china.conf |
sed
's/=/ /g'
>>
./templates/smartdns/smartdns.conf.j2
rm
-rf
./files/smartdns/china-list.conf
sed
's/114.114.114.114/china/g'
./dnsmasq-china-list/
*
.smartdns.conf
>>
./files/smartdns/china-list.conf
grep
-P
'^bogus-nxdomain=.+$'
dnsmasq-china-list/bogus-nxdomain.china.conf |
sed
's/=/ /g'
>>
./files/smartdns/china-list.conf
# wget -O ./files/smartdns/anti-ad.conf https://anti-ad.net/anti-ad-for-smartdns.conf
echo
''
>
./files/smartdns/anti-ad.conf
tasks/main.yml
View file @
49eb98a2
...
...
@@ -18,13 +18,20 @@
state
:
directory
with_items
:
-
smartdns
-
apt-cacher-ng-docker
-
sni
-
name
:
smartdns
template
:
src
:
smartdns/smartdns.conf.j2
dest
:
'
{{utility_root}}/smartdns/smartdns.conf'
notify
:
restart_smartdns
-
name
:
smartdns related files
copy
:
src
:
smartdns/{{item}}.conf
dest
:
'
{{utility_root}}/smartdns/{{item}}.conf'
notify
:
restart_smartdns
with_items
:
-
china-list
-
anti-ad
-
name
:
sni
synchronize
:
src
:
./sni/
...
...
@@ -35,14 +42,12 @@
checksum
:
yes
archive
:
no
notify
:
restart_sni
-
name
:
apt cacher Dockerfile
template
:
src
:
./apt-cacher-ng-docker/Dockerfile.j2
dest
:
'
{{utility_root}}/apt-cacher-ng-docker/Dockerfile'
register
:
dockerfile_res
-
name
:
apt cacher Dockerfile clean
file
:
path
:
'
{{utility_root}}/apt-cacher-ng-docker'
state
:
absent
-
name
:
docker-compose up -d
docker_compose
:
project_src
:
'
{{utility_root}}'
remove_orphans
:
true
pull
:
false
build
:
'
{{dockerfile_res.changed}}'
pull
:
true
templates/apt-cacher-ng-docker/Dockerfile.j2
deleted
100644 → 0
View file @
d8e31187
FROM debian:buster-slim
{% if apt_mirror != 'deb.debian.org' %}
RUN sed -i 's/deb.debian.org/{{apt_mirror}}/g;s/security.debian.org/{{apt_mirror}}/g' /etc/apt/sources.list
{% endif %}
RUN apt update && apt install -y apt-cacher-ng && rm -rf /var/lib/apt/lists/*
RUN sed -i 's/# ForeGround: 0/ForeGround: 1/' /etc/apt-cacher-ng/acng.conf && \
sed -i 's/Remap-debrep: .*/Remap-debrep: \/debian ; http:\/\/{{apt_mirror}}\/debian/' /etc/apt-cacher-ng/acng.conf && \
sed -i 's/Remap-uburep: .*/Remap-uburep: \/ubuntu ; http:\/\/{{apt_mirror}}\/ubuntu/' /etc/apt-cacher-ng/acng.conf && \
sed -i 's/Remap-secdeb: .*/Remap-debdeb: \/debian-security ; http:\/\/{{apt_mirror}}\/debian-security/' /etc/apt-cacher-ng/acng.conf
RUN ln -s /dev/stdout /var/log/apt-cacher-ng/apt-cacher.log && ln -s /dev/stderr /var/log/apt-cacher-ng.err
EXPOSE 3142/tcp
CMD [ "/usr/sbin/apt-cacher-ng", "-c", "/etc/apt-cacher-ng" ]
templates/docker-compose.yml.j2
View file @
49eb98a2
...
...
@@ -19,7 +19,8 @@ services:
{% endif %}
command: -f -x -c /etc/smartdns/smartdns.conf
volumes:
- ./smartdns/smartdns.conf:/etc/smartdns/smartdns.conf:ro
- ./smartdns:/etc/smartdns:ro
- {{smartdns_cache_path}}:/tmp/smartdns-cache
kms:
restart: always
...
...
@@ -51,18 +52,20 @@ services:
apt-cacher-ng:
restart: always
build: apt-cacher-ng-docker
image: git-registry.mycard.moe/nanahira/apt-cacher-ng-docker:latest
dns: {{ smartdns_china_dns[0] }}
ports:
{% if apt_cacher_address %}
{% for address in apt_cacher_address %}
- '{{address}}:80:
3142
'
- '{{address}}:80:
80
'
{% endfor %}
{% else %}
- '80:
3142
'
- '80:
80
'
{% endif %}
volumes:
- {{apt_cacher_path}}:/var/cache/apt-cacher-ng
environment:
UPSTREAM_MIRROR: {{apt_mirror}}
sni:
restart: always
...
...
@@ -78,3 +81,20 @@ services:
volumes:
- ./sni/nginx.conf:/etc/nginx/nginx.conf
{% endif %}
ntp:
restart: always
image: cturra/ntp
environment:
NTP_SERVERS: ntp1.aliyun.com,ntp2.aliyun.com,ntp3.aliyun.com,ntp4.aliyun.com
cap_add:
- SYS_TIME
ports:
{% if ntp_address %}
{% for address in ntp_address %}
- '{{address}}:123:123/udp'
{% endfor %}
{% else %}
- '123:123/udp'
{% endif %}
templates/smartdns/
header
.conf.j2
→
templates/smartdns/
smartdns
.conf.j2
View file @
49eb98a2
server-name mycard-smartdns
bind-tcp [::]:53
bind [::]:53
tcp-idle-time 3
cache-size 4096
cache-persist yes
cache-file /tmp/smartdns-cache/cache
prefetch-domain yes
dualstack-ip-selection yes
serve-expired yes
serve-expired-ttl 0
...
...
@@ -38,4 +41,7 @@ server {{dns}} -group china -exclude-default-group
nameserver /{{domain}}/china
{% endfor %}
# dnsmasq-china-list below
# anti ad
conf-file /etc/smartdns/anti-ad.conf
# china list
conf-file /etc/smartdns/china-list.conf
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment