git ssb

1+

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



Tree: 40418a9424b81b0aad278b3f2ab3bb4365608462

Files: 40418a9424b81b0aad278b3f2ab3bb4365608462 / salt / state / pub.sls

1823 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 - require:
11 - docker_image: ahdinosaur/healer
12
13{% set seeds = salt['grains.get']('pub.seeds', []) %}
14{% set pubs = salt['grains.get']('pub.list', []) %}
15{% for pub in pubs %}
16
17{% set name = pub.name %}
18{% set port = pub.port or 8008 %}
19
20{% set secret = pub.secret %}
21{% set curve = secret.curve %}
22{% set public = secret.public %}
23{% set private = secret.private %}
24
25{{ name }}/:
26 file.directory:
27 - name: /root/bots/{{ name }}/
28 - mode: 755
29 - user: debian
30 - group: debian
31 - recurse:
32 - user
33 - group
34
35{{ name }}/secret:
36 file.managed:
37 - name: /root/bots/{{ name }}/secret
38 - dataset:
39 curve: {{ curve }}
40 public: {{ public }}.{{ curve }}
41 private: {{ private }}.{{ curve }}
42 id: @{{ public }}.{{ curve }}
43 - mode: 0400
44 - user: debian
45 - group: debian
46 - formatter: json
47 - merge_if_exists: True
48 - require:
49 - file: {{ name }}/
50
51{{ name }}/config:
52 file.serialize:
53 - name: /root/bots/{{ name }}/config
54 - dataset:
55 seeds:
56 - net:{{ name }}:{{ port }}~shs:{{ public }}
57 {% for seed in seeds %}
58 - {{ seed }}
59 {% endfor %}
60 - formatter: json
61 - mode: 644
62 - user: debian
63 - group: debian
64 - merge_if_exists: True
65 - require:
66 - file: {{ name }}/
67
68{{ name }}:
69 docker_container.running:
70 - image: ahdinosaur/ssb-pub
71 - env:
72 - ssb_host: {{ name }}
73 - binds:
74 - /root/bots/{{ name }}:/home/node/.ssb/
75 - ports:
76 - 8008
77 - restart_policy: unless-stopped
78 - require:
79 - docker_image: ahdinosaur/ssb-pub
80 - file: {{ name }}/secret
81 - file: {{ name }}/config
82
83{% endfor %}
84

Built with git-ssb-web