diff --git a/Dockerfile.builder.linux-amd64-static b/Dockerfile.builder.linux-amd64-static index 864f61e1c..22d2682e6 100644 --- a/Dockerfile.builder.linux-amd64-static +++ b/Dockerfile.builder.linux-amd64-static @@ -3,12 +3,10 @@ FROM debian:11 RUN apt-get update -y && \ apt-get install -y --no-install-recommends \ build-essential \ - musl \ - musl-dev \ - musl-tools \ + musl musl-dev musl-tools \ zlib1g-dev \ - curl \ - ca-certificates \ + zlib1g-dev-musl \ + curl ca-certificates \ && ln -sf /usr/bin/musl-gcc /usr/local/bin/x86_64-linux-musl-gcc \ && rm -rf /var/lib/apt/lists/* diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index f5b6a0881..c9b9cd8f9 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -1,5 +1,6 @@ -## 5.0.2 +## 5.0.3 * Refactoring Linux amd64 static build to work on Github Actions +* Creating the docs for config v3 ## 5.0.0 * Refactoring config module to support config v3 diff --git a/docs/content/2-features/remote-solver-circuitbreaker/_index.en.md b/docs/content/2-features/remote-solver-circuitbreaker/_index.en.md index 62d07257f..4c70cff33 100644 --- a/docs/content/2-features/remote-solver-circuitbreaker/_index.en.md +++ b/docs/content/2-features/remote-solver-circuitbreaker/_index.en.md @@ -4,107 +4,38 @@ title: Remote Solver Circuit Breaker DPS use circuit breaker strategies to choose the most available Remote Server from the configured ones. -## Static Threshold - -* Consider all remote servers circuits as **closed** on app start. -* Opens and closes circuits based on fixed number of failures or successes. - - -#### Configuration Example - -```json -{ - "version": 2, - "remoteDnsServers": [], - "envs": [], - "activeEnv": "", - "webServerPort": 5380, - "dnsServerPort": 53, - "logLevel": "INFO", - "logFile": "console", - "registerContainerNames": false, - "domain": "docker", - "dpsNetwork": false, - "dpsNetworkAutoConnect": false, - "defaultDns": true, - "hostMachineHostname": "host.docker", - "serverProtocol": "UDP_TCP", - "dockerHost": null, - "resolvConfOverrideNameServers": true, - "noRemoteServers": false, - "noEntriesResponseCode": 3, - "dockerSolverHostMachineFallbackActive": true, - "solverRemote": { - "circuitBreaker": { - "failureThreshold": 3, - "failureThresholdCapacity": 10, - "successThreshold": 5, - "testDelay": "PT20S" - } - } -} -``` - -* **failureThreshold**: How many attempts before open the circuit? -* **failureThresholdCapacity**: How many attempts store to the stack? -* **successThreshold**: How many attempts before close the circuit? -* **testDelay**: How much time to wait before test the circuit again?, see [Duration docs][1] for format explanation - - ## Canary Rate Threshold - * Consider all remote servers circuits as **open** on app start * Opens and closes circuits based on percentage of failure #### Consider all remote servers circuits as open on app start - Test them on startup and add the healthy ones as HALF_OPEN this will evict to app get resolution fails right on the start because the first server on the remote servers list is offline. -#### Configuration Example +Activated by `solver.remote.circuitBreaker.type=CANARY_RATE_THRESHOLD` + +| Name | Description | Default Value | +| -------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- | +| `solver.remote.circuitBreaker.failureRateThreshold` | Failure rate percentage which, when equal to or greater than this value, causes the CircuitBreaker to transition to open. Valid values are greater than 0 and less than or equal to 100. | `21` | +| `solver.remote.circuitBreaker.minimumNumberOfCalls` | Minimum number of calls required (per sliding window) before the CircuitBreaker starts calculating the failure rate. | `50` | +| `solver.remote.circuitBreaker.permittedNumberOfCallsInHalfOpenState` | Number of calls allowed while the CircuitBreaker is in the half-open state. | `10` | + + +## Static Threshold +* Consider all remote servers circuits as **closed** on app start. +* Opens and closes circuits based on fixed number of failures or successes. -```json -{ - "version": 2, - "remoteDnsServers": [], - "envs": [], - "activeEnv": "", - "webServerPort": 5380, - "dnsServerPort": 53, - "logLevel": "INFO", - "logFile": "console", - "registerContainerNames": false, - "domain": "docker", - "dpsNetwork": false, - "dpsNetworkAutoConnect": false, - "defaultDns": true, - "hostMachineHostname": "host.docker", - "serverProtocol": "UDP_TCP", - "dockerHost": null, - "resolvConfOverrideNameServers": true, - "noRemoteServers": false, - "noEntriesResponseCode": 3, - "dockerSolverHostMachineFallbackActive": true, - "solverRemote": { - "circuitBreaker": { - "strategy": "CANARY_RATE_THRESHOLD", - "failureRateThreshold": 21, - "minimumNumberOfCalls": 50, - "permittedNumberOfCallsInHalfOpenState": 10 - } - } -} -``` +Activated by `solver.remote.circuitBreaker.type=STATIC_THRESHOLD` -* **failureRateThreshold**: If the failure rate is equal to or greater than this threshold, the CircuitBreaker will - transition to open. rules: values greater than 0 and not greater than 100. -* **minimumNumberOfCalls**: Configures the minimum number of calls which are required (per sliding window period) before - the CircuitBreaker can calculate the error rate. -* **permittedNumberOfCallsInHalfOpenState**: Configures the number of permitted calls when the CircuitBreaker is half - open. +| Name | Description | Default Value | +| ------------------------------------------------------- |------------------------------------------------------------------------------------------------------------------------------------------| ------------- | +| `solver.remote.circuitBreaker.failureThreshold` | How many failed attempts are allowed before opening the circuit. | `3` | +| `solver.remote.circuitBreaker.failureThresholdCapacity` | How many failed attempts should be stored in the internal buffer used to evaluate failures. | `10` | +| `solver.remote.circuitBreaker.successThreshold` | How many successful attempts are required to close the circuit after it has been opened. | `5` | +| `solver.remote.circuitBreaker.testDelay` | How long the system should wait before testing the circuit again after it is opened. See Duration format [documentation][1] for details. | `PT20S` | -## Refs +### Refs * [A more resilient circuit breaker strategy #533][2] [1]: https://docs.oracle.com/javase/8/docs/api/java/time/Duration.html#toString-- diff --git a/docs/content/3-configuration/_index.en.md b/docs/content/3-configuration/_index.en.md old mode 100755 new mode 100644 index b05f67a4b..f900eca63 --- a/docs/content/3-configuration/_index.en.md +++ b/docs/content/3-configuration/_index.en.md @@ -1,236 +1,167 @@ --- -title: Configuration +title: Configuration Reference weight: 3 pre: "3. " --- -## Configs +Current Version: `3`. See [how to set the configurations][5]. -### Remote DNS Servers -Remote DNS servers to be asked when can not solve from docker or local storage. -Default: `8.8.8.8`. +### Server -### Web Server Port -Web GUI port, Default: `5380`. +| Name | Description | Default Value | +|------|-------------|---------------| +| `server.protocol` | Protocol to start the DNS server. | `UDP_TCP` | -### DNS Server Port -Default: `53`. - -### Log Level -Default: `INFO`. - -| Env | JSON | Terminal | -|----------------|------------|------------| -| `MG_LOG_LEVEL` | `logLevel` | See --help | - -### Log File -Where the log will be written. Default: console. - -| Env | JSON | Terminal | -|---------------|-----------|------------| -| `MG_LOG_FILE` | `logFile` | See --help | - -### Register Container Names -If should register container name / service name as a hostname. Default: false. - -| Env | JSON | Terminal | -|-------------------------------|--------------------------|------------| -| `MG_REGISTER_CONTAINER_NAMES` | `registerContainerNames` | See --help | - -### Domain -The container names domain used on the registered container, services. Default: `docker`. - -Ex: -```bash -docker run --rm --name nginx nginx -``` -Will register a container with the name `nginx.docker` - -| Env | JSON | Terminal | -|-------------|----------|------------| -| `MG_DOMAIN` | `domain` | See --help | +--- -### DPS Network -If should create a bridge network for dps container. Default: false. +### DNS Server -### DPS Network Auto Connect -If should connect all containers to dps container so they can surely talk with each other. requires DPS Network Option. -Default: false. +| Name | Description | Default Value | +|------|-------------|---------------| +| `server.dns.port` | Port where the DNS server listens. | `53` | +| `server.dns.noEntriesResponseCode` | Response code returned when no entries are resolved by any solver. | `3` | -### Default DNS -If DPS must be set as the default DNS automatically, commonly requires DPS be run as sudo/administrator permissions, -this options also won't work in some cases when running inside a docker container, [see the feature details][1]. - -### Host Machine Hostname -Hostname to solve machine IP, domain can be changed by Domain option. Default: `host.docker`. +--- -| Env | JSON | Terminal | -|----------------------------|-----------------------|------------| -| `MG_HOST_MACHINE_HOSTNAME` | `hostMachineHostname` | See --help | +### WEB Server -### Server Protocol -Protocol to start the dns server. Default: `UDP_TCP`. +| Name | Description | Default Value | +|------|-------------|---------------| +| `server.web.port` | Web GUI port. | `5380` | -### Docker Host -Docker host address. Default value is SO dependent. +--- -| Env | JSON | Terminal | -|------------------|--------------|------------| -| `MG_DOCKER_HOST` | `dockerHost` | See --help | +### Solvers -### Resolvconf Override Name Servers -If must comment all existing nameservers at `resolv.conf` file (Linux, MacOS) or just put DPS at the first place. -Default: true. +Common DNS resolution mechanisms used by DPS. Solvers are evaluated according to their activation and configuration. -| Env | JSON | Terminal | -|--------------------------------------|---------------------------------|------------| -| `MG_RESOLVCONF_OVERRIDE_NAMESERVERS` | `resolvConfOverrideNameServers` | See --help | +--- -### Resolvconf -Linux/Mac resolvconf or systemd-resolved path to set DPS as default DNS. -Default: `/host/etc/systemd/resolved.conf,/host/etc/resolv.conf,/etc/systemd/resolved.conf,/etc/resolv.conf`. +### Remote Solver -| Env | JSON | Terminal | -|---------------|------|------------| -| MG_RESOLVCONF | | See --help | +| Name | Description | Default Value | +|------|-------------|---------------| +| `solver.remote.active` | Enables or disables querying remote DNS servers. | `true` | +| `solver.remote.dnsServers` | Remote DNS servers to be queried when resolution cannot be done locally or via Docker. | `[8.8.8.8]` | -### No Remote Servers -If remote servers like 8.8.8.8 must be disabled and only local solvers like docker containers or local db must be used. -Default: false. +--- -| Env | JSON | Terminal | -|------------------------|-------------------|------------| -| `MG_NO_REMOTE_SERVERS` | `noRemoteServers` | See --help | +### Docker Solver -### Active Env -Active Env used to query local db entries. Default `` (Empty String). +| Name | Description | Default Value | +|------|-------------|---------------| +| `solver.docker.registerContainerNames` | Whether container or service names should be registered as DNS hostnames. | `false` | +| `solver.docker.domain` | Domain suffix used when registering Docker containers and services. | `docker` | +| `solver.docker.hostMachineFallback` | Whether the host machine IP should be returned when a container is found but has no IP. | `true` | +| `solver.docker.dockerDaemonUri` | Docker daemon URI used to connect to Docker. | OS dependent | +| `solver.docker.dpsNetwork.autoCreate` | Whether DPS should automatically create a Docker bridge network. | `false` | +| `solver.docker.dpsNetwork.autoConnect` | Whether all containers should be auto-connected to the DPS network. | `false` | -| Env | JSON | Terminal | -|-----|-------------|----------| -| | `activeEnv` | | +--- -### No Entries Response Code -Response code to use when no entries are returned by the configured solvers. Default: 3 +### System Solver -| Env | JSON | Terminal | -|-----------------------------|-------------------------|-----------| -| MG_NO_ENTRIES_RESPONSE_CODE | `noEntriesResponseCode` | See -help | +| Name | Description | Default Value | +|------|-------------|---------------| +| `solver.system.hostMachineHostname` | Hostname that resolves to the host machine IP. | `host.docker` | -### Local Entries Solving (LocalDB) -See [Local Entries Solving][2] docs. +--- -### Docker Solver Host Machine IP Fallback +### Local Solver -Whether should answer host machine IP when a matching container is found but it hasn't -an IP to be answered, see Github Issue [#442](https://github.com/mageddo/dns-proxy-server/issues/442). -Default: true +| Name | Description | Default Value | +|------|-------------|---------------| +| `solver.local.activeEnv` | Active environment used to resolve local DNS entries. | `` (empty string) | -| Env | JSON | Terminal | -|-----------------------------------------------|-----------------------------------------|-----------| -| MG_DOCKER_SOLVER_HOST_MACHINE_FALLBACK_ACTIVE | `dockerSolverHostMachineFallbackActive` | See -help | +--- ### Stub Solver -#### Stub Solver - Domain Name - -The domain name used for stub solver resolved hostnames. Default: `stub`. - -| Env | JSON | Terminal | -|----------------------------|-------------------------|-----------| -| MG_STUB_SOLVER_DOMAIN_NAME | `solverStub.domainName` | See -help | - -## Config File Path +| Name | Description | Default Value | +|------|-------------|---------------| +| `solver.stub.domainName` | Domain name used for stub solver resolved hostnames. | `stub` | -The location of the external config file (as the JSON file) can be changed by setting two variables: - -### Config File Path - -Relative or absolute path to the config file. Default: `conf/config.json` +--- -| Env | JSON | Terminal | -|---------------------|------|-----------| -| MG_CONFIG_FILE_PATH | N/A | See -help | +### Default DNS -### Working Dir (Optional) +| Name | Description | Default Value | +|------|-------------|---------------| +| `defaultDns.active` | Whether DPS should be automatically configured as the system default DNS. | `false` | +| `defaultDns.resolvConf.overrideNameServers` | Whether existing nameservers should be commented out or DPS should be placed first. | `true` | +| `defaultDns.resolvConf.paths` | Resolv.conf or systemd-resolved configuration paths used to apply default DNS. | /host/etc/systemd/resolved.conf,/host/etc/resolv.conf,/etc/systemd/resolved.conf,/etc/resolv.conf | -Is the path which will be used when **ConfigFilePath** is set as a relative path. -Default: `DPS executing path, aka Working Directory`. +--- -| Env | JSON | Terminal | -|-------------|------|----------| -| MG_WORK_DIR | N/A | N/A | +### Logs +| Name | Description | Default Value | +|------|-------------|---------------| +| `log.level` | Logging level used by DPS. | `INFO` | +| `log.file` | Output target for logs (file path or console). | `console` | -## Example JSON configuration -__Version 2__ +### File Configuration Example +* [Solver remote circuit breaker configuration][3] ```json -{ - "version": 2, - "remoteDnsServers": [ "8.8.8.8", "4.4.4.4:54" ], - "envs": [ - { - "name": "", // empty string is the default enviroment - "hostnames": [ // all local hostnames entries - { - "id": 1, // (optional) used to control it will be automatically generated if not passed - "type": "A", - "hostname": "github.com", - "ip": "192.168.0.1", - "ttl": 255 // how many seconds cache this entry - } - ] - } - ], - "activeEnv": "", - "webServerPort": 5380, - "dnsServerPort": 53, - "logLevel": "INFO", - "logFile": "console", - "registerContainerNames": false, - "domain": "docker", - "dpsNetwork": false, - "dpsNetworkAutoConnect": false, - "defaultDns": true, - "hostMachineHostname" : "host.docker", - "serverProtocol": "UDP_TCP", - "dockerHost": null, - "resolvConfOverrideNameServers": true, - "noRemoteServers": false, - "noEntriesResponseCode": 3, - "dockerSolverHostMachineFallbackActive": true, - "solverRemote" : { - "circuitBreaker" : { - "failureThreshold" : 3, - "failureThresholdCapacity" : 10, - "successThreshold" : 5, - "testDelay" : "PT20S" - } - } -} +version: 3 +server: + dns: + port: 53 + noEntriesResponseCode: 3 + web: + port: 5380 + protocol: UDP_TCP +solver: + remote: + active: true + dnsServers: + - 8.8.8.8 + - 4.4.4.4:53 + circuitBreaker: + type: CANARY_RATE_THRESHOLD + failureRateThreshold: 21 + minimumNumberOfCalls: 50 + permittedNumberOfCallsInHalfOpenState: 10 + docker: + registerContainerNames: false + domain: docker + hostMachineFallback: true + dpsNetwork: + name: dps + autoCreate: false + autoConnect: false + dockerDaemonUri: + system: + hostMachineHostname: host.docker + local: + activeEnv: '' + envs: + - name: '' + hostnames: + - type: A + hostname: dps-sample.dev + ip: 192.168.0.254 + ttl: 30 + stub: + domainName: stub +defaultDns: + active: true + resolvConf: + paths: "/host/etc/systemd/resolved.conf,/host/etc/resolv.conf,/etc/systemd/resolved.conf,/etc/resolv.conf" + overrideNameServers: true +log: + level: DEBUG + file: console ``` -* [Solver remote circuit breaker configuration][3] - -## Environment variable configuration - -Boolean values - -> You can use `1` or `true` (case insensitive) to specify which the flag is activated, any other -> value will be considered false. -## Terminal configuration -Run one of the commands below to get the commandline instructions help: - -```bash -$ ./dns-proxy-server --help -``` - -```bash -$ docker run defreitas/dns-proxy-server --help -``` +### Legacy Configuration +[[ref][4]] [1]: {{%relref "2-features/auto-configuration-as-default-dns/_index.md" %}} [2]: {{%relref "2-features/local-entries/_index.md" %}} [3]: {{%relref "2-features/remote-solver-circuitbreaker/_index.en.md" %}} +[4]: {{%relref "3-configuration/legacy.en.md" %}} +[5]: {{%relref "3-configuration/format.en.md" %}} diff --git a/docs/content/3-configuration/format.en.md b/docs/content/3-configuration/format.en.md new file mode 100644 index 000000000..11d6f6d8d --- /dev/null +++ b/docs/content/3-configuration/format.en.md @@ -0,0 +1,46 @@ +--- +title: Supported Formats +weight: 2 +pre: "2. " +--- + +## Supported Formats +* ENV +* YAML +* JSON +* Command Line Arguments + +### YAML/JSON File Path Configuration +**Default**: `conf/config.json` + +The location can be changed by setting `DPS_CONFIG_FILE_PATH`, `MG_CONFIG_FILE_PATH` legacy env or +`--conf-path` command line argument. The path can be relative (to the binary path) or absolute. + +### Working Dir +**Default**: DPS executing path, a.k.a Working Directory + +Is the path which will be used when **ConfigFilePath** is set as a relative path. +Can be set by `DPS_WORK_DIR` or `DPS_WORK_DIR` legacy env. + +### Environment Variable configuration +Environment Variable configuration are dynamically generated respecting the file configuration using the format: + +* `DPS_${property}` +* `DPS_${property}__${subProperty}`, ex: `DPS_SERVER__PROTOCOL` +* `DPS_${property}_${index}__${property}`, ex: `DPS_SOLVER__LOCAL__ENVS_0__HOSTNAMES_0__TARGET` + +**Boolean values** + +You can use `1` or `true` (case-insensitive) to specify which the flag is activated, any other +value will be considered false. + +### Terminal configuration +Run one of the commands below to get the commandline instructions help: + +```bash +$ ./dns-proxy-server --help +``` + +```bash +$ docker run defreitas/dns-proxy-server --help +``` diff --git a/docs/content/3-configuration/legacy.en.md b/docs/content/3-configuration/legacy.en.md new file mode 100755 index 000000000..66444b932 --- /dev/null +++ b/docs/content/3-configuration/legacy.en.md @@ -0,0 +1,239 @@ +--- +title: Legacy Configuration (v2) +weight: 3 +pre: "3. " +--- + +**Important**: Legacy configurations are supported only for read, they won't receive new properties, +can be replaced when using the GUI to make changes on the settings and can be removed on future versions of DPS. + +I would recommend to migrate to version 3. + +### Remote DNS Servers +Remote DNS servers to be asked when can not solve from docker or local storage. +Default: `8.8.8.8`. + +### Web Server Port +Web GUI port, Default: `5380`. + +### DNS Server Port +Default: `53`. + +### Log Level +Default: `INFO`. + +| Env | JSON | Terminal | +|----------------|------------|------------| +| `MG_LOG_LEVEL` | `logLevel` | See --help | + +### Log File +Where the log will be written. Default: console. + +| Env | JSON | Terminal | +|---------------|-----------|------------| +| `MG_LOG_FILE` | `logFile` | See --help | + +### Register Container Names +If should register container name / service name as a hostname. Default: false. + +| Env | JSON | Terminal | +|-------------------------------|--------------------------|------------| +| `MG_REGISTER_CONTAINER_NAMES` | `registerContainerNames` | See --help | + +### Domain +The container names domain used on the registered container, services. Default: `docker`. + +Ex: +```bash +docker run --rm --name nginx nginx +``` +Will register a container with the name `nginx.docker` + +| Env | JSON | Terminal | +|-------------|----------|------------| +| `MG_DOMAIN` | `domain` | See --help | + +### DPS Network +If should create a bridge network for dps container. Default: false. + +### DPS Network Auto Connect +If should connect all containers to dps container so they can surely talk with each other. requires DPS Network Option. +Default: false. + +### Default DNS +If DPS must be set as the default DNS automatically, commonly requires DPS be run as sudo/administrator permissions, +this options also won't work in some cases when running inside a docker container, [see the feature details][1]. + +### Host Machine Hostname +Hostname to solve machine IP, domain can be changed by Domain option. Default: `host.docker`. + +| Env | JSON | Terminal | +|----------------------------|-----------------------|------------| +| `MG_HOST_MACHINE_HOSTNAME` | `hostMachineHostname` | See --help | + +### Server Protocol +Protocol to start the dns server. Default: `UDP_TCP`. + +### Docker Host +Docker host address. Default value is SO dependent. + +| Env | JSON | Terminal | +|------------------|--------------|------------| +| `MG_DOCKER_HOST` | `dockerHost` | See --help | + +### Resolvconf Override Name Servers +If must comment all existing nameservers at `resolv.conf` file (Linux, MacOS) or just put DPS at the first place. +Default: true. + +| Env | JSON | Terminal | +|--------------------------------------|---------------------------------|------------| +| `MG_RESOLVCONF_OVERRIDE_NAMESERVERS` | `resolvConfOverrideNameServers` | See --help | + +### Resolvconf +Linux/Mac resolvconf or systemd-resolved path to set DPS as default DNS. +Default: `/host/etc/systemd/resolved.conf,/host/etc/resolv.conf,/etc/systemd/resolved.conf,/etc/resolv.conf`. + +| Env | JSON | Terminal | +|---------------|------|------------| +| MG_RESOLVCONF | | See --help | + +### No Remote Servers +If remote servers like 8.8.8.8 must be disabled and only local solvers like docker containers or local db must be used. +Default: false. + +| Env | JSON | Terminal | +|------------------------|-------------------|------------| +| `MG_NO_REMOTE_SERVERS` | `noRemoteServers` | See --help | + +### Active Env +Active Env used to query local db entries. Default `` (Empty String). + +| Env | JSON | Terminal | +|-----|-------------|----------| +| | `activeEnv` | | + +### No Entries Response Code +Response code to use when no entries are returned by the configured solvers. Default: 3 + +| Env | JSON | Terminal | +|-----------------------------|-------------------------|-----------| +| MG_NO_ENTRIES_RESPONSE_CODE | `noEntriesResponseCode` | See -help | + +### Local Entries Solving (LocalDB) +See [Local Entries Solving][2] docs. + +### Docker Solver Host Machine IP Fallback + +Whether should answer host machine IP when a matching container is found but it hasn't +an IP to be answered, see Github Issue [#442](https://github.com/mageddo/dns-proxy-server/issues/442). +Default: true + +| Env | JSON | Terminal | +|-----------------------------------------------|-----------------------------------------|-----------| +| MG_DOCKER_SOLVER_HOST_MACHINE_FALLBACK_ACTIVE | `dockerSolverHostMachineFallbackActive` | See -help | + +### Stub Solver + +#### Stub Solver - Domain Name + +The domain name used for stub solver resolved hostnames. Default: `stub`. + +| Env | JSON | Terminal | +|----------------------------|-------------------------|-----------| +| MG_STUB_SOLVER_DOMAIN_NAME | `solverStub.domainName` | See -help | + +## Config File Path + +The location of the external config file (as the JSON file) can be changed by setting two variables: + +### Config File Path + +Relative or absolute path to the config file. Default: `conf/config.json` + +| Env | JSON | Terminal | +|---------------------|------|-----------| +| MG_CONFIG_FILE_PATH | N/A | See -help | + +### Working Dir (Optional) + +Is the path which will be used when **ConfigFilePath** is set as a relative path. +Default: `DPS executing path, aka Working Directory`. + +| Env | JSON | Terminal | +|-------------|------|----------| +| MG_WORK_DIR | N/A | N/A | + + +## Example JSON configuration + +__Version 2__ + +```json +{ + "version": 2, + "remoteDnsServers": [ "8.8.8.8", "4.4.4.4:54" ], + "envs": [ + { + "name": "", // empty string is the default enviroment + "hostnames": [ // all local hostnames entries + { + "id": 1, // (optional) used to control it will be automatically generated if not passed + "type": "A", + "hostname": "github.com", + "ip": "192.168.0.1", + "ttl": 255 // how many seconds cache this entry + } + ] + } + ], + "activeEnv": "", + "webServerPort": 5380, + "dnsServerPort": 53, + "logLevel": "INFO", + "logFile": "console", + "registerContainerNames": false, + "domain": "docker", + "dpsNetwork": false, + "dpsNetworkAutoConnect": false, + "defaultDns": true, + "hostMachineHostname" : "host.docker", + "serverProtocol": "UDP_TCP", + "dockerHost": null, + "resolvConfOverrideNameServers": true, + "noRemoteServers": false, + "noEntriesResponseCode": 3, + "dockerSolverHostMachineFallbackActive": true, + "solverRemote" : { + "circuitBreaker" : { + "failureThreshold" : 3, + "failureThresholdCapacity" : 10, + "successThreshold" : 5, + "testDelay" : "PT20S" + } + } +} +``` + +* [Solver remote circuit breaker configuration][3] + +## Environment variable configuration + +Boolean values + +> You can use `1` or `true` (case insensitive) to specify which the flag is activated, any other +> value will be considered false. + +## Terminal configuration +Run one of the commands below to get the commandline instructions help: + +```bash +$ ./dns-proxy-server --help +``` + +```bash +$ docker run defreitas/dns-proxy-server --help +``` + +[1]: {{%relref "2-features/auto-configuration-as-default-dns/_index.md" %}} +[2]: {{%relref "2-features/local-entries/_index.md" %}} +[3]: {{%relref "2-features/remote-solver-circuitbreaker/_index.en.md" %}} diff --git a/gradle.properties b/gradle.properties index 4aa55c6bd..2fb4fb46c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1 +1 @@ -version=5.0.2-snapshot +version=5.0.3-snapshot