Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow user to set listen address and port #55

Merged
merged 4 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.5.0] - 2023-10-26

- Added usage instructions to the readme (#51).
- Added snapcraft build recipes and automation. (#52)
- Added the ability to set the listen address and port for the web server. (#55)

## [0.4.0] - 2023-05-31

Expand Down
2 changes: 1 addition & 1 deletion CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @abuelodelanada @dstathis @lucabello @PietroPasotti @rbarry82 @sed-i @simskij
* @abuelodelanada @dstathis @lucabello @PietroPasotti @sed-i @simskij @mmkay @IbraAoad
2 changes: 1 addition & 1 deletion cos_alerter/alerter.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def deep_update(base: dict, new: typing.Optional[dict]):
if new is None:
return
for key in base:
if key in new and type(base[key]) == dict:
if key in new and isinstance(base[key], dict):
deep_update(base[key], new[key])
elif key in new:
base[key] = new[key]
Expand Down
4 changes: 4 additions & 0 deletions cos_alerter/config-defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,7 @@ notify:
# The logging level of COS Alerter
# Levels available: critical, error, warning, info, debug
log_level: "info"

# The address to listen on for http traffic.
# Format HOST:PORT
web_listen_addr: "0.0.0.0:8080"
7 changes: 6 additions & 1 deletion cos_alerter/daemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,12 @@ def main(run_for: Optional[int] = None, argv: List[str] = sys.argv):
# from the daemon. It also facilitates communication over memory rather than files.
# clear_untrusted_proxy_headers is set to suppress a DeprecationWarning.
server_thread = threading.Thread(
target=waitress.serve, args=(app,), kwargs={"clear_untrusted_proxy_headers": True}
target=waitress.serve,
args=(app,),
kwargs={
"clear_untrusted_proxy_headers": True,
"listen": config["web_listen_addr"],
},
)
server_thread.daemon = True # Makes this thread exit when the main thread exits.
logger.info("Starting the web server thread.")
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "cos-alerter"
version = "0.4.0"
version = "0.5.0"
authors = [
{ name="Dylan Stephano-Shachter", email="[email protected]" }
]
Expand Down
4 changes: 2 additions & 2 deletions rockcraft.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: cos-alerter
summary: A liveness checker for self-monitoring.
description: Receive regular pings from the cos stack and alert when they stop.
version: "0.4.0" # NOTE: Make sure this matches `cos-alerter` below
version: "0.5.0" # NOTE: Make sure this matches `cos-alerter` below
base: ubuntu:22.04
license: Apache-2.0
platforms:
Expand All @@ -11,7 +11,7 @@ parts:
plugin: python
source: .
python-packages:
- cos-alerter==0.4.0 # NOTE: Make sure this matches `version` above
- cos-alerter==0.5.0 # NOTE: Make sure this matches `version` above
stage-packages:
- python3-venv
services:
Expand Down
2 changes: 1 addition & 1 deletion snap/snapcraft.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: cos-alerter
version: '0.4.0'
version: '0.5.0'
summary: A watchdog alerting on alertmanager notification failures.
license: Apache-2.0
contact: [email protected]
Expand Down
2 changes: 2 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ commands =
[testenv:static]
description = Run static analysis checks
deps =
types-pyyaml
types-waitress
pyright
commands =
pyright
Expand Down
Loading