add debug

This commit is contained in:
ElevenNotes
2024-01-22 16:33:25 +01:00
parent ff8e1d9cd9
commit 3f89d3ddd9
4 changed files with 10 additions and 6 deletions

View File

@@ -1,5 +1,5 @@
# Alpine :: Traefik Labels
![size](https://img.shields.io/docker/image-size/11notes/traefik-labels/amd64-0.1.8?color=0eb305) ![version](https://img.shields.io/docker/v/11notes/traefik-labels/amd64-0.1.8?color=eb7a09) ![pulls](https://img.shields.io/docker/pulls/11notes/traefik-labels?color=2b75d6) ![activity](https://img.shields.io/github/commit-activity/m/11notes/docker-traefik-labels?color=c91cb8) ![commit-last](https://img.shields.io/github/last-commit/11notes/docker-traefik-labels?color=c91cb8)
![size](https://img.shields.io/docker/image-size/11notes/traefik-labels/amd64-0.1.9?color=0eb305) ![version](https://img.shields.io/docker/v/11notes/traefik-labels/amd64-0.1.9?color=eb7a09) ![pulls](https://img.shields.io/docker/pulls/11notes/traefik-labels?color=2b75d6) ![activity](https://img.shields.io/github/commit-activity/m/11notes/docker-traefik-labels?color=c91cb8) ![commit-last](https://img.shields.io/github/last-commit/11notes/docker-traefik-labels?color=c91cb8)
Run Traefik Labels based on Alpine Linux. Small, lightweight, secure and fast 🏔️
@@ -49,11 +49,11 @@ docker run --name traefik-rfc2136-demo \
-l "traefik/http/services/demo.domain.com/loadbalancer/servers/0/url=http://fqdn-of-docker-node:8080" \
-l "rfc2136/WAN/server=ns.domain.com" \
-l "rfc2136/WAN/key=algo:name:secret" \
-l "rfc2136/WAN/nsupdate=update add foo.domain.com A 175.12.41.11" \
-l "rfc2136/WAN/nsupdate=update add foo.domain.com TXT \"hello from traefik-labels!\"" \
-l "rfc2136/WAN/nsupdate=update add foo.domain.com 300 A 175.12.41.11" \
-l "rfc2136/WAN/nsupdate=update add foo.domain.com 300 TXT \"hello from traefik-labels!\"" \
-l "rfc2136/LAN/server=ns.domain.local" \
-l "rfc2136/LAN/key=algo:name:secret" \
-l "rfc2136/LAN/nsupdate=update add foo.domain.local A 192.168.12.54" \
-l "rfc2136/LAN/nsupdate=update add foo.domain.local 300 A 192.168.12.54" \
-d 11notes/nginx:stable
```
@@ -75,7 +75,7 @@ docker run --name traefik-rfc2136-demo \
| `LABELS_TIMEOUT` | how many seconds after an interval the keys should stay till they expire in seconds | 30 |
| `LABELS_WEBHOOK` | URL to call on each event or poll for each container | |
| `LABELS_WEBHOOK_AUTH_BASIC` | Basic authentication to use in the form of "username:password" for the webhook | |
| `LABELS_RFC2136_ONLY_UPDATE_ON_CHANGE` | Only update DNS entries if they are new or changed (will use dig on each call!) | false |
| `LABELS_RFC2136_ONLY_UPDATE_ON_CHANGE` | Only update DNS entries if they are new or changed (will use dig on each call to the set server) | false |
## Parent image
* [11notes/node:stable](https://hub.docker.com/r/11notes/node)

View File

@@ -8,6 +8,7 @@ exports.dig = async(resolver, type, record) => {
dig.stdout.on('data', data => {io.stdout += (data.toString()).replace(/[\r\n]*$/ig, '')});
dig.on('error', error => {reject(error)});
dig.on('close', code =>{
elevenLogJSON('debug', {method:'dig()', params:arguments, io:io});
switch(true){
case /no servers could be reached/ig.test(io.stdout): io.stderr += io.stdout; break;
}

View File

@@ -192,7 +192,9 @@ class Labels{
if(matches && matches.length >= 4){
try{
const record = await dig(server, matches[2], matches[1]);
return(matches[3].match(new RegExp(record, 'ig')));
const match = matches[3].match(new RegExp(record, 'ig'));
elevenLogJSON('debug', {method:'rfc2136KnownRecord()', params:arguments, record:{src:record, dst:match[3]}});
return(match);
}catch(e){
elevenLogJSON('error', e);
return(false);

View File

@@ -7,6 +7,7 @@ exports.nsupdate = async(server, key, commands) => {
commands.push('quit');
return(new Promise((resolve, reject) => {
elevenLogJSON('debug', {method:'nsupdate()', params:arguments});
const nsupdate = spawn('/usr/bin/nsupdate', ['-y', key]);
const io = {stdout:'', stderr:''};
nsupdate.stderr.on('data', data => {io.stderr += data.toString()});