summaryrefslogtreecommitdiffstats
path: root/roles/fedmsg/base/templates/endpoints.py.j2
blob: abead5a416fd5dd299021e078d5c0e70b40058b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
{% if env == 'staging' %}
suffix  = 'stg.phx2.fedoraproject.org'
non_phx_suffix = 'stg.fedoraproject.org'
{% else %}
suffix = 'phx2.fedoraproject.org'
non_phx_suffix = 'fedoraproject.org'
vpn_suffix = 'vpn.fedoraproject.org'
{% endif %}


config = dict(
    # This is a dict of possible addresses from which fedmsg can send
    # messages.  fedmsg.init(...) requires that a 'name' argument be passed
    # to it which corresponds with one of the keys in this dict.
    endpoints = {
        # For message producers, fedmsg will try to guess the
        # name of it's calling module to determine which endpoint definition
        # to use.  This can be overridden by explicitly providing the name in
        # the initial call to fedmsg.init(...).
        # This used to be on value01 and value03.. but now we just have one
        "supybot.value01": [
            "tcp://value01.%s:3000" % suffix,
        ],

        # Askbot runs as 12 processes with 1 thread each.
        "askbot.ask01": [
            "tcp://ask01.%s:30%02i" % (suffix, i)
            for i in range(12)
        ],

{% if env != 'staging' %}
        "askbot.ask02": [
            "tcp://ask02.%s:30%02i" % (suffix, i)
            for i in range(12)
        ],
{% endif %}

        # The mirrormanager2 frontend runs as 2 processes with 1 thread each.
        "mirrormanager2.mm-frontend01": [
            "tcp://mm-frontend01.%s:30%02i" % (suffix, i)
            for i in range(2)
        ],
{% if env != 'staging' %}
        "mirrormanager2.mm-frontend02": [
            "tcp://mm-frontend02.%s:30%02i" % (suffix, i)
            for i in range(2)
        ],
{% endif %}

        # mizdebsk says he thinks we'll need five sockets. Three services
        # (koschei-{build,repo}-resolver and koschei-polling) are only sending
        # messages, one service (koschei-watcher) can both send and receive
        # them.  The wsgi webapp doesn't use fedmsg at all and all services are
        # single-threaded
        # koschei-watcher uses two endpoints
        "koschei.koschei-backend01": [
            "tcp://koschei-backend01.%s:30%02i" % (suffix, i)
            for i in range(5)
        ],

        # koji is not listed here since it publishes to the fedmsg-relay


# Dynamically generate endpoint declarations from our wsgi app vars.
# Eventually, replace *all* fedmsg endpoint definitions with this one loop
{% for host in groups['all']|sort %}
{% if 'wsgi_fedmsg_service' in hostvars[host] and env == hostvars[host]['env'] %}
        "{{hostvars[host]['wsgi_fedmsg_service']}}.{{host.split('.')|first}}": [
{% for i in range(hostvars[host]['wsgi_procs'] * hostvars[host]['wsgi_threads']) %}
            "tcp://{{host}}:30{{'%02d' % i}}",
{% endfor %}
        ],
{% endif %}
{% endfor %}
    },
)