Skip to content

Commit

Permalink
fix bind address bug (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
circa10a authored Nov 16, 2018
1 parent e27555b commit 8cb2021
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ docker run --rm circa10a/ouroboros --help
- `--keep-tag`, `-k` Only monitor if updates are made to the tag of the image that the container was created with instead of using `latest`. This will enable [watchtower](https://github.com/v2tec/watchtower)-like functionality.
- Default is `False`.
- Environment variable: `KEEPTAG=true`
- `--metrics-addr` What address for the prometheus endpoint to bind to. Runs on `127.0.0.1` by default if `--metrics-addr` is not supplied.
- Default is `127.0.0.1`.
- Environment variable: `METRICS_ADDR=127.0.0.1`
- `--metrics-addr` What address for the prometheus endpoint to bind to. This arg is best suited for `ouroboros-cli`.
- Default is `0.0.0.0`.
- Environment variable: `METRICS_ADDR=0.0.0.0`
- `--metrics-port` What port to run prometheus endpoint on. Running on port `8000` by default if `--metrics-port` is not supplied.
- Default is `8000`.
- Environment variable: `METRICS_PORT=8000`
Expand Down Expand Up @@ -230,9 +230,9 @@ You should then be able to see the metrics at http://localhost:5000/

#### Bind Address

Ouroboros allows you to bind the exporter to a different interface using the `--metrics-addr` argument.
Ouroboros allows you to bind the exporter to a different interface using the `--metrics-addr` argument. This works better for the CLI since docker networks always use `172.*.*.*` addresses, unless you have a very specific config.

> Default is `127.0.0.1`
> Default is `0.0.0.0`
```bash
docker run -d --name ouroboros \
Expand Down
2 changes: 1 addition & 1 deletion ouroboros/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
RUNONCE = False
CLEANUP = False
KEEPTAG = False
METRICS_ADDR = '127.0.0.1'
METRICS_ADDR = '0.0.0.0'
METRICS_PORT = 8000
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def read_reqs(requirements):

setup(
name='ouroboros-cli',
version='0.3.0',
version='0.3.1',
description='Automatically update running docker containers',
long_description=readme(),
long_description_content_type='text/markdown',
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/cli_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def test_keeptag_env_var(mocker, keeptag_env_var, keeptag_env_var_result):

# METRICS_ADDR
@pytest.mark.parametrize('metrics_addr_args, metrics_addr_result', [
(['--metrics-addr', '127.0.0.0'], '127.0.0.0')
(['--metrics-addr', '0.0.0.1'], '0.0.0.1')
])
def test_metrics_addr_args(mocker, metrics_addr_args, metrics_addr_result):
mocker.patch('ouroboros.cli')
Expand All @@ -181,7 +181,7 @@ def test_metrics_addr_args(mocker, metrics_addr_args, metrics_addr_result):


@pytest.mark.parametrize('metrics_addr_env_var, metrics_addr_env_var_result', [
({'METRICS_ADDR': '127.0.0.0'}, '127.0.0.0'),
({'METRICS_ADDR': '0.0.0.1'}, '0.0.0.1'),
])
def test_metrics_addr_env_var(mocker, metrics_addr_env_var, metrics_addr_env_var_result):
mocker.patch.dict('os.environ', metrics_addr_env_var)
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/defaults_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
(defaults.LOGLEVEL, 'info'),
(defaults.RUNONCE, False),
(defaults.CLEANUP, False),
(defaults.METRICS_ADDR, '127.0.0.1'),
(defaults.METRICS_ADDR, '0.0.0.0'),
(defaults.METRICS_PORT, 8000)
])
def test_defaults(default, result):
Expand Down

0 comments on commit 8cb2021

Please sign in to comment.