-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdocker-compose-restoredb.yml
62 lines (59 loc) · 1.45 KB
/
docker-compose-restoredb.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
---
version: "2.4"
volumes:
mongo_data_restore:
driver: local
driver_opts:
device: $COMPOSEPATH/data/mongorestore
o: bind
type: bind
postgres_data_restore:
driver: local
driver_opts:
device: $COMPOSEPATH/data/postgresrestore
o: bind
type: bind
services:
mongorestore:
image: mongo:4.0
hostname: mongorestore
command: >
sh -c "set -xe
&& cd /home
&& ANAME=`ls -1 mongodb-*.archive | sort -ru | head -n 1`
&& mongorestore --archive=$$ANAME --host=mongo --drop -u noc -p noc -d noc
"
restart: "no"
volumes:
- mongo_data_restore:/home:ro
logging:
driver: $COMPOSE_LOG_DRIVER
options:
max-size: $COMPOSE_LOG_MAX_SIZE
max-file: $COMPOSE_LOG_MAX_FILE
labels:
traefik.enable: false
postgresrestore:
image: postgres:9.6
hostname: postgresrestore
command: >
sh -c "set -xe
&& cd /home
&& ARCHIVENAME=`ls -1 pg-*.dump | sort -ru | head -n 1`
&& pg_restore -c -h postgres -U noc -d noc $$ARCHIVENAME
"
restart: "no"
volumes:
- postgres_data_restore:/home:ro
environment:
POSTGRES_USER: noc
POSTGRES_DB: noc
POSTGRES_PASSWORD: $NOC_PG_PASSWORD
PGPASSWORD: $NOC_PG_PASSWORD
logging:
driver: $COMPOSE_LOG_DRIVER
options:
max-size: $COMPOSE_LOG_MAX_SIZE
max-file: $COMPOSE_LOG_MAX_FILE
labels:
traefik.enable: false