Skip to content

Conversation

adhityaravi
Copy link
Contributor

Issue

Fixes issue #56

Solution

  1. A config option to define a dashboard address is added to the config yaml.
  2. Depending on if the dashboard address config exists or not, cos-alerter is started in monolithic or microservice mode
  3. No dashboard addr in config, single server that serves both api and dashboard
  4. dashboard addr exists, dashboard served on dashboard addr and api server on web addr.

Context

Both the flask servers are started in the same process in different threads so the sate info is shared between them

Testing Instructions

  1. Create test config (test-config.yaml) with the following contents
 watch:
    clients:
      test-client:
        key: "822295b207a0b73dd4690b60a03c55599346d44aef3da4cf28c3296eadb98b2647ae18863cc3ae8ae5574191b60360858982fd8a8d176c0edf646ce6eee24ef9"
        name: "Test Client"
  notify:
    destinations: []
  web_listen_addr: "127.0.0.1:8080"
  1. Start server
  pip install -e .
  cos-alerter --config test-config.yaml &
  1. Test both endpoints on same port
  curl http://127.0.0.1:8080/  # Should return dashboard HTML
  curl -X POST "http://127.0.0.1:8080/alive?clientid=test-client&key=clientkey1"  # Should return "Success!"
  1. Test Microservice Mode (new feature)
  echo 'dashboard_listen_addr: "127.0.0.1:8081"' >> test-config.yaml
  1. Restart server
  pkill -f cos-alerter
  cos-alerter --config test-config.yaml &
  1. Test split endpoints
  curl http://127.0.0.1:8080/  # Should return 404 (API server only)
  curl -X POST "http://127.0.0.1:8080/alive?clientid=test-client&key=clientkey1"  # Should return "Success!"

  curl http://127.0.0.1:8081/  # Should return dashboard HTML
  curl -X POST "http://127.0.0.1:8081/alive?clientid=test-client&key=clientkey1"  # Should return 404 (dashboard server only)

@adhityaravi adhityaravi force-pushed the feat/SMS-46-bind-ui-and-api-to-different-addresses branch 2 times, most recently from 03e077e to 8564560 Compare August 13, 2025 09:14
@adhityaravi adhityaravi requested review from a team and dstathis August 13, 2025 09:14
@adhityaravi
Copy link
Contributor Author

Ci fixes from #86 need to be merged into this PR for the checks to pass

@adhityaravi adhityaravi force-pushed the feat/SMS-46-bind-ui-and-api-to-different-addresses branch from ca574bc to 9af63f5 Compare August 25, 2025 10:00
@adhityaravi adhityaravi merged commit f30a123 into main Aug 25, 2025
5 of 6 checks passed
@adhityaravi adhityaravi deleted the feat/SMS-46-bind-ui-and-api-to-different-addresses branch August 25, 2025 10:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants