git ssb

1+

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



Tree: fc7bb9787fd193ef240432680c1c942729273766

Files: fc7bb9787fd193ef240432680c1c942729273766 / salt / state / hub.sls

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

Built with git-ssb-web