Blame view

docker/docker-compose.yml 3.99 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
13
14
15
16
17
18
19
    deploy:  
      restart_policy:
        condition: on-failure
        delay: 5s
        max_attempts: 3
        window: 120s
      resources:
          limits:
            cpus: '0.5'
            memory: 1GB
ec4214ff   Alexis Koralewski   Renaming pyros co...
20
    container_name: pyros-db
c49d7824   Alexis Koralewski   create new folder...
21
22
23
    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...
24
      - VNC_NO_PASSWORD=1
c49d7824   Alexis Koralewski   create new folder...
25
26
    volumes:
      - db:/var/lib/mysql/
c49d7824   Alexis Koralewski   create new folder...
27
    # create network to allow images to communicate with other images within the same network 
23a61124   Alexis Koralewski   Change obsconfig ...
28
29
30
    # networks: 
    #   pyros-network: 
    #     ipv4_address: 172.19.0.2
f4ef0dd6   Alexis Koralewski   Add fix IP adress...
31

1db8bdb9   Alexis Koralewski   removing mysql tc...
32
33
34
35
36
    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...
37

6f83043c   Alexis Koralewski   Add websocket for...
38
  redis:
e1d22a59   Alexis Koralewski   Change redis cont...
39
    container_name: pyros-redis
6f83043c   Alexis Koralewski   Add websocket for...
40
41
    image: redis:latest
    restart: always
23a61124   Alexis Koralewski   Change obsconfig ...
42
43
44
45
46
47
48
49
50
51
    deploy:  
      restart_policy:
        condition: on-failure
        delay: 5s
        max_attempts: 3
        window: 120s
      resources:
          limits:
            cpus: '1'
            memory: 1GB
6f83043c   Alexis Koralewski   Add websocket for...
52
53
    ports:
      - "6379:6379"
23a61124   Alexis Koralewski   Change obsconfig ...
54
55
56
    # networks: 
    #   pyros-network:  
    #     ipv4_address: 172.19.0.5
6f83043c   Alexis Koralewski   Add websocket for...
57

c49d7824   Alexis Koralewski   create new folder...
58
  # service image of python, that let users to interact with python scripts such as pyros.
49805654   Alexis Koralewski   renaming pyros co...
59
  pyros:
23a61124   Alexis Koralewski   Change obsconfig ...
60
61
62
63
64
65
66
67
68
69
70
    #read_only: true
    deploy:
      restart_policy:
        condition: on-failure
        delay: 5s
        max_attempts: 3
        window: 120s
      resources:
        limits:
          cpus: '1'
          memory: 8GB
950ade71   Alexis Koralewski   fixing comment on...
71
    # path to the Dockerfile of this image
c49d7824   Alexis Koralewski   create new folder...
72
    environment:
23d1f666   Alexis Koralewski   Set specific envi...
73
74
      # environment variables only for Docker
      - WITH_DOCKER=y
e5d50896   Alexis Koralewski   Disabling common ...
75
76
77
      # 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...
78
      # environment variables available for both Docker usage and non Docker usage
e5d50896   Alexis Koralewski   Disabling common ...
79
80
81
      # - "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...
82
      #- "IP_PYROS_USER=${IP_PYROS_USER:-172.28.1.5}"
d5436f46   Alexis Koralewski   Fix dockercompose...
83
84
    env_file: 
      - .env
e4c37a1a   Alexis Koralewski   Upgrading mysql v...
85
86
87
88
    build: 
      args:
        uid: ${CURRENT_UID}
      context: ..
d7a4c851   Etienne Pallier   Dockerfile avec U...
89
        #filename: Dockerfile
e4c37a1a   Alexis Koralewski   Upgrading mysql v...
90
    container_name: pyros
90bc3587   Alexis Koralewski   Add fix hostname ...
91
    hostname: ${COMPUTER_HOSTNAME}
e4c37a1a   Alexis Koralewski   Upgrading mysql v...
92
93
94
95
    # 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...
96
    volumes:
9cddcbc7   Alexis Koralewski   fixing path for p...
97
      - ..:/home/pyros_user/app
c49d7824   Alexis Koralewski   create new folder...
98
99
    # 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...
100
      - "${PYROS_WEBSITE_PORT:-8000}:${PYROS_WEBSITE_PORT:-8000}"
d7a4c851   Etienne Pallier   Dockerfile avec U...
101
      - 5900:5900
c49d7824   Alexis Koralewski   create new folder...
102
103
104
    # starting db service before install service 
    depends_on:
      - db
6f83043c   Alexis Koralewski   Add websocket for...
105
      - redis
23a61124   Alexis Koralewski   Change obsconfig ...
106
107
108
    links:
      - db
      - redis
c49d7824   Alexis Koralewski   create new folder...
109
    # create network to allow images to communicate with other images within the same network 
23a61124   Alexis Koralewski   Change obsconfig ...
110
111
112
    # networks: 
    #   pyros-network:
    #     ipv4_address: 172.19.0.3
48bacc35   Alexis Koralewski   add mysql port as...
113
        #ipv4_address: "${IP_PYROS_USER}"
1db8bdb9   Alexis Koralewski   removing mysql tc...
114
    restart: always
864ec466   Alexis Koralewski   Renaming common t...
115
116
  phpmyadmin:
    image: phpmyadmin/phpmyadmin
ec4214ff   Alexis Koralewski   Renaming pyros co...
117
    container_name: pyros-pma
864ec466   Alexis Koralewski   Renaming common t...
118
119
120
121
122
123
    links:
      - db
    environment:
      PMA_HOST: db
      PMA_PORT: 3306
      PMA_ARBITRARY: 1
d5436f46   Alexis Koralewski   Fix dockercompose...
124
125
    env_file: 
      - .env
864ec466   Alexis Koralewski   Renaming common t...
126
    restart: always
23a61124   Alexis Koralewski   Change obsconfig ...
127
128
129
    # networks: 
    #   pyros-network:
    #     ipv4_address: 172.19.0.4
864ec466   Alexis Koralewski   Renaming common t...
130
    ports:
d5436f46   Alexis Koralewski   Fix dockercompose...
131
      - "${PHPMYADMIN_PORT:-8081}:80"
1db8bdb9   Alexis Koralewski   removing mysql tc...
132

6f83043c   Alexis Koralewski   Add websocket for...
133
134


c49d7824   Alexis Koralewski   create new folder...
135
136
137
138
# declaring volumes
volumes:
  db:
    driver: local
c49d7824   Alexis Koralewski   create new folder...
139
# declaring networks
23a61124   Alexis Koralewski   Change obsconfig ...
140
141
142
143
144
145
146
147
# networks: 
#   pyros-network:
#     #bridge is the default network driver
#     driver: bridge
#     ipam:
#       config:
#         - subnet: 172.19.0.0/16
#           gateway: 172.19.0.1