This repository has been archived by the owner on Jul 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
vagga.yaml
99 lines (92 loc) · 2.77 KB
/
vagga.yaml
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
containers:
postgres:
setup:
- !Ubuntu xenial
# Use fixed user id and group id for postgres, because in some cases
# we may need to upgrade (rebuild) a postgres container, but keep the data
# on a `!Persistent` volume still usable. User ids in ubuntu packages are
# not guaranteed to be same on every installation.
#
# The command-lines are from the postgres-common package except
# added --uid 200 --gid 200
- !Sh |
locale-gen cs_CZ.UTF-8
addgroup --system --gid 200 postgres
adduser --uid 200 --system --home /data --no-create-home \
--shell /bin/bash --group --gecos "PostgreSQL administrator" \
postgres
- !Install
- postgresql-9.5
- postgresql-contrib-9.5
- !EnsureDir /data
environ:
PG_PORT: 5433 # Port of host to use
PG_DB: sirius
PGDATA: /data
PG_BIN: /usr/lib/postgresql/9.5/bin
volumes:
/data: !Persistent
name: postgres
owner-uid: 200
owner-gid: 200
init-command: _pg-init
/run: !Tmpfs
subdirs:
postgresql: { mode: 0o777 } # until we have user, group options
elastic:
setup:
- !Ubuntu xenial
- !UbuntuUniverse
- !Install
- ca-certificates
- ca-certificates-java
- openjdk-8-jre-headless
- elasticsearch
- !EnsureDir /var/elastic
volumes:
/var/elastic: !Persistent { name: elastic }
commands:
_pg-init: !Command
description: Init postgres database
container: postgres
user-id: 200
group-id: 200
run: |
set -ex
ls -la /data
$PG_BIN/pg_ctl initdb -o "-E=UTF8"
$PG_BIN/pg_ctl -w -o '-F --port=$PG_PORT -k /tmp' start
$PG_BIN/createuser -h 127.0.0.1 -p $PG_PORT -s -d sirius
$PG_BIN/createdb -h 127.0.0.1 -p $PG_PORT $PG_DB -O sirius
$PG_BIN/pg_ctl stop
postgres: &postgres !Command
description: Run postgres database
container: postgres
user-id: 200
group-id: 200
run: |
trap "$PG_BIN/pg_ctl -w stop; trap - INT; kill -INT $$" INT
$PG_BIN/pg_ctl -w -o '-F --port=$PG_PORT -k /tmp' start
sleep infinity
psql: &psql !Command
description: Run postgres shell
container: postgres
run: |
psql -U sirius postgres://$PG_USER:[email protected]:$PG_PORT/$PG_DB
elastic: &elastic !Command
description: Run elasticsearch
container: elastic
user-id: 1
external-user-id: 0
run:
- /usr/share/elasticsearch/bin/elasticsearch
- -Des.path.conf=/etc/elasticsearch
- -Des.path.logs=/tmp
- -Des.path.work=/tmp
- -Des.path.data=/var/elastic/data
- -Des.network.host=127.0.0.1
run: !Supervise
description: Run both postgres and shell
children:
postgres: *postgres
elastic: *elastic