/
kontena.yml
67 lines (67 loc) · 1.53 KB
/
kontena.yml
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
stack: kontena/cockroachdb
version: 0.2.0
description: CockroachDB is an open source, survivable, strongly consistent, scale-out SQL database.
expose: lb
variables:
version:
type: string
default: "1.1.3"
from:
prompt: Version
cluster_size:
type: integer
default: 3
from:
prompt: Cluster size (min 3)
memory_limit:
type: integer
default: 1024
from:
prompt: Node memory limit (MB)
affinity:
type: string
default: label==~cockroach
from:
prompt: Affinity
cache_size:
type: integer
from:
evaluate: ${memory_limit} * 0.25
services:
node:
image: "cockroachdb/cockroach:v{{ version}}"
stateful: true
instances: {{ cluster_size }}
command: "start --logtostderr --insecure --cache {{ cache_size }}MB --max-sql-memory {{ cache_size }}MB --join node-1,node-2,node-3"
mem_limit: "{{ memory_limit }}m"
deploy:
wait_for_port: 26257
affinity:
- {{ affinity }}
environment:
KONTENA_LB_EXTERNAL_PORT: 26257
KONTENA_LB_INTERNAL_PORT: 26257
KONTENA_LB_MODE: tcp
health_check:
protocol: tcp
initial_delay: 120
port: 26257
hooks:
post_start:
- name: init
cmd: sleep 10 && /cockroach/cockroach init --insecure
instances: 1
oneshot: true
volumes:
- data:/cockroach/cockroach-data
links:
- lb
lb:
image: kontena/lb:latest
instances: 2
affinity:
- {{ affinity }}
volumes:
data:
external:
name: ${STACK}-data