Merge lp://qastaging/~danilo/landscape-charm/service-count-defaults into lp://qastaging/~landscape/landscape-charm/trunk

Proposed by Данило Шеган
Status: Merged
Approved by: Данило Шеган
Approved revision: 262
Merged at revision: 261
Proposed branch: lp://qastaging/~danilo/landscape-charm/service-count-defaults
Merge into: lp://qastaging/~landscape/landscape-charm/trunk
Diff against target: 325 lines (+81/-29)
7 files modified
hooks/lib/relations/haproxy.py (+27/-11)
hooks/lib/relations/tests/test_haproxy.py (+23/-11)
hooks/lib/services.py (+9/-2)
hooks/lib/tests/sample.py (+5/-0)
hooks/lib/tests/test_services.py (+4/-2)
hooks/lib/tests/test_templates.py (+11/-1)
templates/landscape-server (+2/-2)
To merge this branch: bzr merge lp://qastaging/~danilo/landscape-charm/service-count-defaults
Reviewer Review Type Date Requested Status
Chris Glass (community) Approve
🤖 Landscape Builder test results Approve
Free Ekanayaka (community) Approve
Review via email: mp+258032@code.qastaging.launchpad.net

Commit message

Start up 2 message servers and 2 ping servers on each landscape-server unit

To do this we set values in /etc/defaults/landscape-server. Most of the work is in configuring the haproxy relation, where we move away from a single backend per server to multiple. HAProxy charm deals with unifying these for multiple units.

Description of the change

Start up 2 message servers and 2 ping servers on each landscape-server unit

As discussed in Malta, we start up 2 each of message-server and ping-server on a landscape-server unit by setting the value in /etc/defaults/landscape-server. Gist of the work, however, is in configuring the haproxy relation.

To set this up, we move away from a single backend server in the configuration to multiple. Our services, when configured in the defaults file, use up ports starting with hard-coded base ports. We only allow up to 10 processes (otherwise, we'd attempt to run two different services on the same port): this is a limitation of our scripts.

This has been tested with the landscape.yaml from https://pastebin.canonical.com/130688/ and local provider:

  juju-deployer -vdW -w180 -c landscape.yaml landscape

(two message server and two ping server processes do show up).

You can check out haproxy-monitoring on http://ha-proxy-unit-ip:10000/ (login as haproxy:haproxy) to see two services running. For further testing, add another landscape-server unit, and notice how another two message-servers and pingservers join the pool of appropriate services on the monitoring page.

To post a comment you must log in.
Revision history for this message
🤖 Landscape Builder (landscape-builder) wrote :

Command: make ci-test
Result: Success
Revno: 256
Branch: lp:~danilo/landscape-charm/service-count-defaults
Jenkins: https://ci.lscape.net/job/latch-test/830/

review: Approve (test results)
Revision history for this message
Free Ekanayaka (free.ekanayaka) wrote :

I think you need the haproxy part too (not sure it needs a change in the haproxy charm).

Alternatively we might consider to have multiple processes that share the same listening socket, e.g.:

http://stackoverflow.com/questions/10077745/twistedweb-on-multicore-multiprocessor

so from the point of view of HAProxy you would see just one port.

Revision history for this message
Данило Шеган (danilo) wrote :

I've added the HAProxy configuration: we are listing all processes/servers as the backends because that ensures that haproxy has a full picture of what load-balancing it should apply (and it's a setup we generally use, so should be better tested).

Please review.

Revision history for this message
Данило Шеган (danilo) wrote :

I've also updated the MP.

Revision history for this message
Данило Шеган (danilo) wrote :

Btw, I'd like to introduce an integration test for this as well, but in a separate branch.

Revision history for this message
🤖 Landscape Builder (landscape-builder) wrote :

Command: make ci-test
Result: Success
Revno: 261
Branch: lp:~danilo/landscape-charm/service-count-defaults
Jenkins: https://ci.lscape.net/job/latch-test/851/

review: Approve (test results)
Revision history for this message
Free Ekanayaka (free.ekanayaka) wrote :

Looks good and works as expected, +1 with minor comments.

review: Approve
Revision history for this message
Free Ekanayaka (free.ekanayaka) wrote :

I forgot to mention that the pingserver should be probably changed in the same way, I think (i.e. we want to run 2 of them).

262. By Данило Шеган

Improve docstring for HAProxyProvider._get_servers() and move SERVICE_COUNTS top-level. Addresses review comments by Free.

Revision history for this message
Данило Шеган (danilo) wrote :

Thanks for review, Free.

Pingserver is included (and do I hate the naming discrepancy between "pingserver"—no dash—and "message-server"—with dash). After discussion on IRC (see below as well), decided to simply move SERVICE_COUNTS to top-level in the same module (also potentially to allow setting these in the configuration, but that's still up in the air).

Revision history for this message
🤖 Landscape Builder (landscape-builder) wrote :

Command: make ci-test
Result: Success
Revno: 262
Branch: lp:~danilo/landscape-charm/service-count-defaults
Jenkins: https://ci.lscape.net/job/latch-test/861/

review: Approve (test results)
Revision history for this message
Chris Glass (tribaal) wrote :

Looks good! +1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches