Files: 1b0f88ad0dc819e99e066fb621372dabff4ab28f / salt / state / hub.sls
1964 bytesRaw
1 | ahdinosaur/ssb-pub: |
2 | docker_image.present |
3 | |
4 | ahdinosaur/healer: |
5 | docker_image.present |
6 | |
7 | healer: |
8 | docker_container.running: |
9 | - image: ahdinosaur/healer |
10 | - name: healer |
11 | - binds: |
12 | - /var/run/docker.sock:/tmp/docker.sock |
13 | - restart_policy: unless-stopped |
14 | - require: |
15 | - docker_image: ahdinosaur/healer |
16 | |
17 | {% set seeds = salt['pillar.get']('hub:seeds', []) %} |
18 | {% set pubs = salt['pillar.get']('hub:pubs', []) %} |
19 | |
20 | {% for pub in pubs %} |
21 | |
22 | {% set name = pub.name %} |
23 | {% set port = pub.port or 8008 %} |
24 | |
25 | {% set secret = pub.secret %} |
26 | {% set curve = secret.curve %} |
27 | {% set public = secret.public %} |
28 | {% set private = secret.private %} |
29 | |
30 | {{ name }}/: |
31 | file.directory: |
32 | - name: /root/bots/{{ name }}/ |
33 | - mode: 755 |
34 | - user: debian |
35 | - group: debian |
36 | - recurse: |
37 | - user |
38 | - group |
39 | |
40 | {{ name }}/secret: |
41 | file.managed: |
42 | - name: /root/bots/{{ name }}/secret |
43 | - dataset: |
44 | curve: {{ curve }} |
45 | public: {{ public }}.{{ curve }} |
46 | private: {{ private }}.{{ curve }} |
47 | id: "@{{ public }}.{{ curve }}" |
48 | - mode: 0400 |
49 | - user: debian |
50 | - group: debian |
51 | - formatter: json |
52 | - merge_if_exists: True |
53 | - require: |
54 | - file: {{ name }}/ |
55 | |
56 | {{ name }}/config: |
57 | file.serialize: |
58 | - name: /root/bots/{{ name }}/config |
59 | - dataset: |
60 | seeds: |
61 | - net:{{ name }}:{{ port }}~shs:{{ public }} |
62 | {% for seed in seeds %} |
63 | - {{ seed }} |
64 | {% endfor %} |
65 | - formatter: json |
66 | - mode: 644 |
67 | - user: debian |
68 | - group: debian |
69 | - merge_if_exists: True |
70 | - require: |
71 | - file: {{ name }}/ |
72 | |
73 | {{ name }}: |
74 | docker_container.running: |
75 | - image: ahdinosaur/ssb-pub |
76 | - name: {{ name }} |
77 | - env: |
78 | - ssb_host: {{ name }} |
79 | - binds: |
80 | - /root/bots/{{ name }}:/home/node/.ssb/ |
81 | - ports: |
82 | - 8008 |
83 | - restart_policy: unless-stopped |
84 | - require: |
85 | - docker_image: ahdinosaur/ssb-pub |
86 | - file: {{ name }}/secret |
87 | - file: {{ name }}/config |
88 | |
89 | {% endfor %} |
90 |
Built with git-ssb-web