-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcompose.yml.jinja2
68 lines (64 loc) · 1.8 KB
/
compose.yml.jinja2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
version: "3.8"
name: lost
services:
lost-db-resolver:
container_name: lost-db-resolver
image: janakj.net/lost/db
restart: always
shm_size: "256MB"
environment:
POSTGRES_PASSWORD: mLFC3YRH
volumes:
- db-resolver:/var/lib/postgresql/data
- /run/postgresql/resolver:/run/postgresql
{% for name, node, attrs in servers() %}
{% set id = attrs['$path'].replace('/', '-') %}
lost-db-{{ id }}:
container_name: lost-db-{{ id }}
image: janakj.net/lost/db
restart: always
{% if attrs['profile'] %}
profiles: [ {{ attrs['profile'] }} ]
{% endif %}
shm_size: "256MB"
environment:
POSTGRES_PASSWORD: mLFC3YRH
volumes:
- db-{{ id }}:/var/lib/postgresql/data
- /run/postgresql/server/{{ attrs['$path'] }}:/run/postgresql
lost-server-{{ id }}:
container_name: lost-server-{{ id }}
image: janakj.net/lost/server
restart: always
network_mode: "host"
{% if attrs['profile'] %}
profiles: [ {{ attrs['profile'] }} ]
{% endif %}
environment:
PORT: {{ attrs['$port'] }}
SERVER_ID: "lost-server-{{ id }}"
{% if attrs['redirect'] %}
REDIRECT: true
{% endif %}
{% if node['loadShapes'] %}
LOAD_SHAPES: "{{ node['loadShapes'] }}"
{% endif %}
{% if node['osmId'] %}
{% set _ = ports.map(url_prefix + '/' + node['osmId'], "http://localhost" + ':' + str(attrs['$port'])) %}
SERVICE_AREA: "{{ url_prefix }}/{{ node['osmId'] }}"
{% endif %}
DB_URL: "user=lost-server host=/run/postgresql dbname=lost"
volumes:
- /run/postgresql/server/{{ attrs['$path'] }}:/run/postgresql
depends_on:
- lost-db-{{ id }}
{% endfor %}
volumes:
db-resolver:
labels:
role: resolver
{% for _, _, attrs in servers() %}
db-{{ attrs['$path'].replace('/', '-') }}:
labels:
role: server
{% endfor %}