forked from TobiasAntiGravity/pysystemtrade_ecosystem
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
107 lines (95 loc) · 2.72 KB
/
docker-compose.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
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
99
100
101
102
103
104
105
106
version: '3.9'
services:
pysystemstrade:
build:
context: ./pysystemtrade
dockerfile: ./Dockerfile
args:
GIT_TOKEN: add_personal_access_token_here
SCRIPT_PATH: ${SCRIPT_PATH}
ECHO_PATH: ${ECHO_PATH}
container_name: pysystemtrade${NAME_SUFFIX}
restart: always
environment:
IPV4_NETWORK_PART: ${IPV4_NETWORK_PART}
PYSYS_CODE: ${PYSYS_CODE}
depends_on:
- ib_gateway
- mongo_db
volumes:
- ./csv_backup:/home/csv_backup
networks:
channel:
ipv4_address: ${IPV4_NETWORK_PART}0.5
stdin_open: true
tty: true
ib_gateway:
build:
context: ./ib_gateway
dockerfile: ./Dockerfile
container_name: ib_gateway${NAME_SUFFIX}
restart: always
ports:
- "4002:4002"
- "5900:5900"
environment:
TWSUSERID: "user_id"
TWSPASSWORD: "password"
networks:
channel:
ipv4_address: ${IPV4_NETWORK_PART}0.3
mongo_db:
container_name: mongo_db${NAME_SUFFIX}
image: mongo
restart: always
volumes:
- mongo_db:/data/db
- mongo_conf:/data/configdb
networks:
channel:
ipv4_address: ${IPV4_NETWORK_PART}0.2
ipython:
build:
context: ./ipython
dockerfile: ./Dockerfile
args:
GIT_TOKEN: add_personal_access_token_here
ECHO_PATH: ${ECHO_PATH}
container_name: ipython${NAME_SUFFIX}
restart: always
ports:
- "8888:8888"
networks:
channel:
ipv4_address: ${IPV4_NETWORK_PART}0.6
db-backup:
image: alpine
profiles: ["backup"]
volumes:
- mongo_db:/data/db
- mongo_conf:/data/configdb
- ./db_backup:/backup
command: sh -c "tar -cvf /backup/backup_db.tar /data/db; tar -cvf /backup/backup_conf.tar /data/configdb"
db-restore:
image: alpine
profiles: ["restore"]
volumes:
- mongo_db:/data/db
- mongo_conf:/data/configdb
- ./db_backup:/backup
command: sh -c "cd /data/ && tar -xvf /backup/backup_db.tar --strip 1; cd /data/ && tar -xvf /backup/backup_conf.tar --strip 1"
volumes:
mongo_db:
name: mongo_db_volume${NAME_SUFFIX}
mongo_conf:
name: mongo_conf_volume${NAME_SUFFIX}
networks:
channel:
driver: bridge
name: channel${NAME_SUFFIX}
ipam:
config:
- subnet: ${IPV4_NETWORK_PART}0.0/16
gateway: ${IPV4_NETWORK_PART}0.1
# Backup concept; https://stackoverflow.com/a/56432886/1020693
# about profile; https://docs.docker.com/compose/profiles/, https://stackoverflow.com/a/65957695/1020693