git ssb

1+

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



Tree: 570a635e80dfd51d57bc92d52f2e5cbd1ddd011d

Files: 570a635e80dfd51d57bc92d52f2e5cbd1ddd011d / salt / state / hub.sls

2099 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.managed:
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 - merge_if_exists: True
59 - require:
60 - file: {{ name }}/
61
62{{ name }}/config:
63 file.serialize:
64 - name: /root/bots/{{ name }}/config
65 - dataset:
66 seeds:
67 - net:{{ name }}:{{ port }}~shs:{{ public }}
68 {% for seed in seeds %}
69 - {{ seed }}
70 {% endfor %}
71 - formatter: json
72 - mode: 644
73 - user: {{ user }}
74 - group: {{ group }}
75 - merge_if_exists: True
76 - require:
77 - file: {{ name }}/
78
79{{ name }}:
80 docker_container.running:
81 - image: ahdinosaur/ssb-pub
82 - name: {{ name }}
83 - env:
84 - ssb_host: {{ name }}
85 - binds:
86 - /root/bots/{{ name }}:/home/node/.ssb/
87 - ports:
88 - 8008
89 - restart_policy: unless-stopped
90 - require:
91 - docker_image: ahdinosaur/ssb-pub
92 - file: {{ name }}/
93 - file: {{ name }}/secret
94 - file: {{ name }}/config
95
96{% endfor %}
97

Built with git-ssb-web