diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml new file mode 100644 index 0000000..3dac8b9 --- /dev/null +++ b/.gitea/workflows/build.yml @@ -0,0 +1,38 @@ +name: Build Docker +run-name: Build Docker Images +on: + push: + +jobs: + Build Docker: + runs-on: [ubuntu-latest, amd] # Add amd to require amd64 + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Install Docker + run : | + echo "Updating apt sources" + echo "deb http://ftp.au.debian.org/debian buster main" > /etc/apt/sources.list + apt-get update --allow-unauthenticated --allow-insecure-repositories + apt-get install docker.io -y + - name: Build Docker image + run : | + echo "${{ secrets.DOCKERGIT_TOKEN }}" | docker login git.woodburn.au -u nathanwoodburn --password-stdin + echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" + tag=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}} + tag=${tag//\//-} + tag_num=${GITHUB_RUN_NUMBER} + echo "tag_num=$tag_num" + + if [[ "$tag" == "main" ]]; then + tag="latest" + else + tag_num="${tag}-${tag_num}" + fi + + + docker build -t hns_doh:$tag_num . + docker tag hns_doh:$tag_num git.woodburn.au/nathanwoodburn/hns_doh:$tag_num + docker push git.woodburn.au/nathanwoodburn/hns_doh:$tag_num + docker tag hns_doh:$tag_num git.woodburn.au/nathanwoodburn/hns_doh:$tag + docker push git.woodburn.au/nathanwoodburn/hns_doh:$tag \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..e22e136 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,3 @@ +FROM nginx +RUN rm /etc/nginx/conf.d/default.conf +COPY nginx.conf /etc/nginx/conf.d/default.conf \ No newline at end of file diff --git a/README.md b/README.md index 5b38f00..15a438e 100644 --- a/README.md +++ b/README.md @@ -1 +1,9 @@ # hns_doh_loadbalancer + + +Load balancing to the following DNS-over-HTTPS providers: +- https://doh.hnshosting.au/dns-query +- https://easyhandshake.com:8053/dns-query +- https://doh.hnsdns.com/dns-query +- https://hs.dnssec.dev/dns-query +- https://hnsns.net/dns-query \ No newline at end of file diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..dfcb73e --- /dev/null +++ b/nginx.conf @@ -0,0 +1,20 @@ +upstream loadbalancer { + server doh.hnshosting.au:443 weight=1; + server easyhandshake.com:8053 weight=1; + server doh.hnsdns.com:443 weight=1; + server hs.dnssec.dev:443 weight=1; + server hnsns.net:443 weight=1; +} + +server { + listen 80; + server_name your_domain.com; + + location / { + proxy_pass http://loadbalancer; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } +}