docker-compose.yml
5.64 KB
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
version: "3.9"
services:
#######################
# MYSQL - DBMS
#######################
db:
# if we're using mysql >= 8, some of sql queries aren't valid anymore, like for creating and grant an user at the same time
# This is fixed in pyros.py
container_name: pyros-db
image: mysql:8.0.28
restart: always
command: --default-authentication-plugin=mysql_native_password
environment:
# note : as db is an image of mysql, this root password will be set on the first installation on the image, if the value is changed, it will not be updated in the database
- "MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD:-root}"
- VNC_NO_PASSWORD=1
env_file:
- .env
volumes:
- db:/var/lib/mysql/
deploy:
restart_policy:
condition: on-failure
max_attempts: 5
resources:
limits:
cpus: '0.5'
memory: 1GB
#pids: 1
# create network to allow images to communicate with other images within the same network
# networks:
# pyros-network:
# ipv4_address: 172.19.0.2
healthcheck:
test: ["CMD", 'mysqladmin', 'ping', '-h', 'db', '-u', 'root', '-p$$MYSQL_ROOT_PASSWORD' ]
timeout: 10s
interval: 5s
retries: 20
######################################################
# REDIS - in memory communication bus (for websockets)
######################################################
redis:
container_name: pyros-redis
image: redis:7.0.7
restart: always
ports:
- "6379:6379"
deploy:
restart_policy:
condition: on-failure
max_attempts: 5
resources:
limits:
cpus: '1'
memory: 1GB
#pids: 1
healthcheck:
test: ["CMD", "redis-cli","ping"]
timeout: 10s
interval: 5s
retries: 20
# networks:
# pyros-network:
# ipv4_address: 172.19.0.5
######################################################
# PYROS (main image : docker_pyros) => defined in Dockerfile
# Ubuntu OS with Python3 and PyROS requirements installed
# PyROS will later be installed on this image with "pyros.py install" (PYROS_DOCKER_INSTALL)
######################################################
pyros:
container_name: pyros
restart: always
#read_only: true
# app/pyros is equivalent to your PYROS_SOFT/PYROS/ directory
# Change "pyros" to whatever you want for the PYROS/ dir name (if you do not want "PYROS")
working_dir:
/home/pyros_user/app/pyros
# path to the Dockerfile of this image
environment:
# environment variables only for Docker
- WITH_DOCKER=y
# disabling other env variables because they will override those from the env_file
# - MYSQL_ROOT_LOGIN=root
# - MYSQL_TCP_PORT=3306
# environment variables available for both Docker usage and non Docker usage
# - "MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD:-root}"
# - "MYSQL_PYROS_LOGIN=${MYSQL_PYROS_LOGIN:-pyros}"
# - "MYSQL_PYROS_PWD=${MYSQL_PYROS_PWD:-DjangoPyros}"
#- "IP_PYROS_USER=${IP_PYROS_USER:-172.28.1.5}"
env_file:
- .env
build:
args:
uid: ${CURRENT_UID}
context: ..
dockerfile: ./docker/Dockerfile
hostname: ${COMPUTER_HOSTNAME}
# tty is the -t option in docker exec
tty: true
# stdin_open is the -i option in docker exec
stdin_open: true
volumes:
- ../..:/home/pyros_user/app
# tells which port of local machine can communicate with the docker image (host:container), host is your local machine
ports:
- "${PYROS_WEBSITE_PORT:-8000}:${PYROS_WEBSITE_PORT:-8000}"
- 5900:5900
# starting db service before install service
depends_on:
- db
- redis
links:
- db
- redis
deploy:
restart_policy:
condition: on-failure
max_attempts: 5
resources:
limits:
cpus: '1'
memory: 8GB
#pids: 1
# create network to allow images to communicate with other images within the same network
# networks:
# pyros-network:
# ipv4_address: 172.19.0.3
#ipv4_address: "${IP_PYROS_USER}"
healthcheck:
test: ["CMD", "python3","-V"]
timeout: 10s
interval: 5s
retries: 20
######################################################
# PHPMYADMIN (to interact manually with mysql db)
# (dev only)
######################################################
phpmyadmin:
container_name: pyros-pma
image: phpmyadmin/phpmyadmin:5.2.0
restart: always
links:
- db
environment:
PMA_HOST: db
PMA_PORT: 3306
PMA_ARBITRARY: 1
env_file:
- .env
# networks:
# pyros-network:
# ipv4_address: 172.19.0.4
ports:
- "${PHPMYADMIN_PORT:-8081}:80"
deploy:
restart_policy:
condition: on-failure
max_attempts: 5
resources:
limits:
cpus: '1'
memory: 1GB
#pids: 1
healthcheck:
test: ["CMD", 'mysqladmin', 'ping', '-h', 'db', '-u', 'root', '-p$$MYSQL_ROOT_PASSWORD' ]
timeout: 10s
interval: 5s
retries: 20
######################################################
# Declaring volumes
######################################################
volumes:
db:
driver: local
######################################################
# Declaring networks
######################################################
# networks:
# pyros-network:
# #bridge is the default network driver
# driver: bridge
# ipam:
# config:
# - subnet: 172.19.0.0/16
# gateway: 172.19.0.1