git ssb

1+

dinoworm ๐Ÿ› / butt-as-a-service



Tree: 74140b3654fc1b3b2e1316a793a4140d8a1860d0

Files: 74140b3654fc1b3b2e1316a793a4140d8a1860d0 / salt / state / hub.sls

2097 bytesRaw
1ahdinosaur/ssb-pub:
2 docker_image.present
3
4ahdinosaur/healer:
5 docker_image.present
6
7healer:
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/root/bots/:
18 file.directory
19
20{% set seeds = salt['pillar.get']('hub:seeds', []) %}
21{% set pubs = salt['pillar.get']('hub:pubs', []) %}
22
23{% for pub in pubs %}
24
25{% set name = pub.name %}
26{% set port = pub.get('port', 8008) %}
27
28{% set user = 1000 %}
29{% set group = 1000 %}
30
31{% set secret = pub.secret %}
32{% set curve = secret.curve %}
33{% set public = secret.public %}
34{% set private = secret.private %}
35
36{{ name }}/:
37 file.directory:
38 - name: /root/bots/{{ name }}/
39 - mode: 755
40 - user: {{ user }}
41 - group: {{ group }}
42 - recurse:
43 - user
44 - group
45
46{{ name }}/secret:
47 file.serialize:
48 - name: /root/bots/{{ name }}/secret
49 - dataset:
50 curve: "{{ curve }}"
51 public: "{{ public }}.{{ curve }}"
52 private: "{{ private }}.{{ curve }}"
53 id: "@{{ public }}.{{ curve }}"
54 - mode: 0400
55 - user: {{ user }}
56 - group: {{ group }}
57 - formatter: json
58 - require:
59 - file: {{ name }}/
60
61{{ name }}/config:
62 file.serialize:
63 - name: /root/bots/{{ name }}/config
64 - dataset:
65 seeds:
66 - net:{{ name }}:{{ port }}~shs:{{ public }}
67 {% for seed in seeds %}
68 - {{ seed }}
69 {% endfor %}
70 - formatter: json
71 - mode: 644
72 - user: {{ user }}
73 - group: {{ group }}
74 - merge_if_exists: True
75 - require:
76 - file: {{ name }}/
77
78{{ name }}:
79 docker_container.running:
80 - image: ahdinosaur/ssb-pub
81 - name: {{ name }}
82 - env:
83 - ssb_host: {{ name }}
84 - binds:
85 - /root/bots/{{ name }}:/home/node/.ssb/
86 - ports:
87 - 8008
88 - restart_policy: unless-stopped
89 - require:
90 - docker_image: ahdinosaur/ssb-pub
91 - file: {{ name }}/
92 - file: {{ name }}/secret
93 - file: {{ name }}/config
94
95{% endfor %}
96

Built with git-ssb-web