Blame view

docker/docker-compose.yml 4.56 KB
c49d7824   Alexis Koralewski   create new folder...
1
2
3
4
5
version: "3.9"

services:
  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
e4c37a1a   Alexis Koralewski   Upgrading mysql v...
6
7
    # This is fixed in pyros.py
    image: mysql:8.0.28
c49d7824   Alexis Koralewski   create new folder...
8
9
    command: --default-authentication-plugin=mysql_native_password
    restart: always
23a61124   Alexis Koralewski   Change obsconfig ...
10
11
12
    deploy:  
      restart_policy:
        condition: on-failure
79e2cb01   Alexis Koralewski   fix docker warnings
13
        max_attempts: 5
23a61124   Alexis Koralewski   Change obsconfig ...
14
15
16
17
      resources:
          limits:
            cpus: '0.5'
            memory: 1GB
79e2cb01   Alexis Koralewski   fix docker warnings
18
            #pids: 1
ec4214ff   Alexis Koralewski   Renaming pyros co...
19
    container_name: pyros-db
c49d7824   Alexis Koralewski   create new folder...
20
21
22
    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}"
d7a4c851   Etienne Pallier   Dockerfile avec U...
23
      - VNC_NO_PASSWORD=1
c49d7824   Alexis Koralewski   create new folder...
24
25
    volumes:
      - db:/var/lib/mysql/
c49d7824   Alexis Koralewski   create new folder...
26
    # create network to allow images to communicate with other images within the same network 
23a61124   Alexis Koralewski   Change obsconfig ...
27
28
29
    # networks: 
    #   pyros-network: 
    #     ipv4_address: 172.19.0.2
f4ef0dd6   Alexis Koralewski   Add fix IP adress...
30

1db8bdb9   Alexis Koralewski   removing mysql tc...
31
32
33
34
35
    healthcheck:
      test: ["CMD", 'mysqladmin', 'ping', '-h', 'db', '-u', 'root', '-p$$MYSQL_ROOT_PASSWORD' ]
      timeout: 10s
      interval: 5s
      retries: 20
c49d7824   Alexis Koralewski   create new folder...
36

6f83043c   Alexis Koralewski   Add websocket for...
37
  redis:
e1d22a59   Alexis Koralewski   Change redis cont...
38
    container_name: pyros-redis
6f83043c   Alexis Koralewski   Add websocket for...
39
40
    image: redis:latest
    restart: always
23a61124   Alexis Koralewski   Change obsconfig ...
41
42
43
    deploy:  
      restart_policy:
        condition: on-failure
79e2cb01   Alexis Koralewski   fix docker warnings
44
        max_attempts: 5
23a61124   Alexis Koralewski   Change obsconfig ...
45
46
47
48
      resources:
          limits:
            cpus: '1'
            memory: 1GB
79e2cb01   Alexis Koralewski   fix docker warnings
49
            #pids: 1
6f83043c   Alexis Koralewski   Add websocket for...
50
51
    ports:
      - "6379:6379"
79e2cb01   Alexis Koralewski   fix docker warnings
52
53
54
55
56
    healthcheck:
      test: ["CMD", "redis-cli","ping"]
      timeout: 10s
      interval: 5s
      retries: 20
23a61124   Alexis Koralewski   Change obsconfig ...
57
58
59
    # networks: 
    #   pyros-network:  
    #     ipv4_address: 172.19.0.5
6f83043c   Alexis Koralewski   Add websocket for...
60

c49d7824   Alexis Koralewski   create new folder...
61
  # service image of python, that let users to interact with python scripts such as pyros.
49805654   Alexis Koralewski   renaming pyros co...
62
  pyros:
23a61124   Alexis Koralewski   Change obsconfig ...
63
    #read_only: true
c6c12930   Alexis Koralewski   update docker-com...
64
65
    working_dir: 
      /home/pyros_user/app/pyros 
23a61124   Alexis Koralewski   Change obsconfig ...
66
67
68
    deploy:
      restart_policy:
        condition: on-failure
79e2cb01   Alexis Koralewski   fix docker warnings
69
        max_attempts: 5
23a61124   Alexis Koralewski   Change obsconfig ...
70
71
72
73
      resources:
        limits:
          cpus: '1'
          memory: 8GB
79e2cb01   Alexis Koralewski   fix docker warnings
74
          #pids: 1
950ade71   Alexis Koralewski   fixing comment on...
75
    # path to the Dockerfile of this image
c49d7824   Alexis Koralewski   create new folder...
76
    environment:
23d1f666   Alexis Koralewski   Set specific envi...
77
78
      # environment variables only for Docker
      - WITH_DOCKER=y
e5d50896   Alexis Koralewski   Disabling common ...
79
80
81
      # disabling other env variables because they will override those from the env_file
      # - MYSQL_ROOT_LOGIN=root
      # - MYSQL_TCP_PORT=3306
23d1f666   Alexis Koralewski   Set specific envi...
82
      # environment variables available for both Docker usage and non Docker usage
e5d50896   Alexis Koralewski   Disabling common ...
83
84
85
      # - "MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD:-root}"
      # - "MYSQL_PYROS_LOGIN=${MYSQL_PYROS_LOGIN:-pyros}"
      # - "MYSQL_PYROS_PWD=${MYSQL_PYROS_PWD:-DjangoPyros}"
48bacc35   Alexis Koralewski   add mysql port as...
86
      #- "IP_PYROS_USER=${IP_PYROS_USER:-172.28.1.5}"
d5436f46   Alexis Koralewski   Fix dockercompose...
87
88
    env_file: 
      - .env
e4c37a1a   Alexis Koralewski   Upgrading mysql v...
89
90
91
92
    build: 
      args:
        uid: ${CURRENT_UID}
      context: ..
d7a4c851   Etienne Pallier   Dockerfile avec U...
93
        #filename: Dockerfile
e4c37a1a   Alexis Koralewski   Upgrading mysql v...
94
    container_name: pyros
90bc3587   Alexis Koralewski   Add fix hostname ...
95
    hostname: ${COMPUTER_HOSTNAME}
e4c37a1a   Alexis Koralewski   Upgrading mysql v...
96
97
98
99
    # tty is the -t option in docker exec 
    tty: true
    # stdin_open is the -i option in docker exec
    stdin_open: true
c49d7824   Alexis Koralewski   create new folder...
100
    volumes:
9b2dff05   Alexis Koralewski   update dockerfile...
101
      - ../..:/home/pyros_user/app
c49d7824   Alexis Koralewski   create new folder...
102
103
    # tells which port of local machine can communicate with the docker image (host:container), host is your local machine
    ports:
3e125e8f   Alexis Koralewski   Add webport perso...
104
      - "${PYROS_WEBSITE_PORT:-8000}:${PYROS_WEBSITE_PORT:-8000}"
d7a4c851   Etienne Pallier   Dockerfile avec U...
105
      - 5900:5900
c49d7824   Alexis Koralewski   create new folder...
106
107
108
    # starting db service before install service 
    depends_on:
      - db
6f83043c   Alexis Koralewski   Add websocket for...
109
      - redis
23a61124   Alexis Koralewski   Change obsconfig ...
110
111
112
    links:
      - db
      - redis
c49d7824   Alexis Koralewski   create new folder...
113
    # create network to allow images to communicate with other images within the same network 
23a61124   Alexis Koralewski   Change obsconfig ...
114
115
116
    # networks: 
    #   pyros-network:
    #     ipv4_address: 172.19.0.3
48bacc35   Alexis Koralewski   add mysql port as...
117
        #ipv4_address: "${IP_PYROS_USER}"
1db8bdb9   Alexis Koralewski   removing mysql tc...
118
    restart: always
79e2cb01   Alexis Koralewski   fix docker warnings
119
120
121
122
123
124
125
    healthcheck:
      test: ["CMD", "python3","-V"]
      timeout: 10s
      interval: 5s
      retries: 20


864ec466   Alexis Koralewski   Renaming common t...
126
127
  phpmyadmin:
    image: phpmyadmin/phpmyadmin
ec4214ff   Alexis Koralewski   Renaming pyros co...
128
    container_name: pyros-pma
864ec466   Alexis Koralewski   Renaming common t...
129
130
131
132
133
134
    links:
      - db
    environment:
      PMA_HOST: db
      PMA_PORT: 3306
      PMA_ARBITRARY: 1
79e2cb01   Alexis Koralewski   fix docker warnings
135
136
137
138
139
140
141
142
143
144
    deploy:  
      restart_policy:
        condition: on-failure
        max_attempts: 5
      resources:
          limits:
            cpus: '1'
            memory: 1GB
            #pids: 1

d5436f46   Alexis Koralewski   Fix dockercompose...
145
146
    env_file: 
      - .env
864ec466   Alexis Koralewski   Renaming common t...
147
    restart: always
23a61124   Alexis Koralewski   Change obsconfig ...
148
149
150
    # networks: 
    #   pyros-network:
    #     ipv4_address: 172.19.0.4
864ec466   Alexis Koralewski   Renaming common t...
151
    ports:
d5436f46   Alexis Koralewski   Fix dockercompose...
152
      - "${PHPMYADMIN_PORT:-8081}:80"
79e2cb01   Alexis Koralewski   fix docker warnings
153
154
155
156
157
    healthcheck:
      test: ["CMD", 'mysqladmin', 'ping', '-h', 'db', '-u', 'root', '-p$$MYSQL_ROOT_PASSWORD' ]
      timeout: 10s
      interval: 5s
      retries: 20
1db8bdb9   Alexis Koralewski   removing mysql tc...
158

6f83043c   Alexis Koralewski   Add websocket for...
159
160


c49d7824   Alexis Koralewski   create new folder...
161
162
163
164
# declaring volumes
volumes:
  db:
    driver: local
c49d7824   Alexis Koralewski   create new folder...
165
# declaring networks
23a61124   Alexis Koralewski   Change obsconfig ...
166
167
168
169
170
171
172
173
# networks: 
#   pyros-network:
#     #bridge is the default network driver
#     driver: bridge
#     ipam:
#       config:
#         - subnet: 172.19.0.0/16
#           gateway: 172.19.0.1