From 9bdbb687a0854d5a0f76ff1d06ba7ebd31ce172d Mon Sep 17 00:00:00 2001 From: Alexis Koralewski Date: Mon, 15 Nov 2021 18:13:08 +0100 Subject: [PATCH] re-enabling previous version of docker-compose, adding new docker-compose file with two pyros services --- docker/docker-compose.yml | 37 ------------------------------------- docker/docker-compose_with_two_django_versions.yml | 104 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 104 insertions(+), 37 deletions(-) create mode 100644 docker/docker-compose_with_two_django_versions.yml diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 1fd9a70..55bfabb 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -56,43 +56,6 @@ services: #ipv4_address: "${IP_PYROS_USER}" restart: always - pyros2: - # path to the Dockerfile of this image - build: - context: .. - dockerfile: Dockerfile-django2 - container_name: pyros2 - # tty is the -t option in docker exec - tty: true - # stdin_open is the -i option in docker exec - stdin_open: true - env_file: - - variables.env - environment: - # environment variables only for Docker - - WITH_DOCKER=y - - 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}" - - PYROS_WEBSITE_PORT=8002 - #- "IP_PYROS_USER=${IP_PYROS_USER:-172.28.1.5}" - 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: - - 8002:8002 - # starting db service before install service - depends_on: - - db - # create network to allow images to communicate with other images within the same network - networks: - - pyros-network - #ipv4_address: "${IP_PYROS_USER}" - restart: always - # declaring volumes volumes: db: diff --git a/docker/docker-compose_with_two_django_versions.yml b/docker/docker-compose_with_two_django_versions.yml new file mode 100644 index 0000000..1fd9a70 --- /dev/null +++ b/docker/docker-compose_with_two_django_versions.yml @@ -0,0 +1,104 @@ +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 + image: mysql:5.7.22 + command: --default-authentication-plugin=mysql_native_password + restart: always + container_name: db_pyros + 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}" + volumes: + - db:/var/lib/mysql/ + # create network to allow images to communicate with other images within the same network + networks: + - pyros-network + healthcheck: + test: ["CMD", 'mysqladmin', 'ping', '-h', 'db', '-u', 'root', '-p$$MYSQL_ROOT_PASSWORD' ] + timeout: 10s + interval: 5s + retries: 20 + + # service image of python, that let users to interact with python scripts such as pyros. + pyros: + # path to the Dockerfile of this image + build: .. + container_name: pyros + # tty is the -t option in docker exec + tty: true + # stdin_open is the -i option in docker exec + stdin_open: true + env_file: + - variables.env + environment: + # environment variables only for Docker + - WITH_DOCKER=y + - 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}" + 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}" + # starting db service before install service + depends_on: + - db + # create network to allow images to communicate with other images within the same network + networks: + - pyros-network + #ipv4_address: "${IP_PYROS_USER}" + restart: always + + pyros2: + # path to the Dockerfile of this image + build: + context: .. + dockerfile: Dockerfile-django2 + container_name: pyros2 + # tty is the -t option in docker exec + tty: true + # stdin_open is the -i option in docker exec + stdin_open: true + env_file: + - variables.env + environment: + # environment variables only for Docker + - WITH_DOCKER=y + - 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}" + - PYROS_WEBSITE_PORT=8002 + #- "IP_PYROS_USER=${IP_PYROS_USER:-172.28.1.5}" + 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: + - 8002:8002 + # starting db service before install service + depends_on: + - db + # create network to allow images to communicate with other images within the same network + networks: + - pyros-network + #ipv4_address: "${IP_PYROS_USER}" + restart: always + +# declaring volumes +volumes: + db: + driver: local +# declaring networks +networks: + pyros-network: + #bridge is the default network driver + driver: bridge \ No newline at end of file -- libgit2 0.21.2