From 5ab2221dd61eb81a9da4aa23eb65060e0614ee57 Mon Sep 17 00:00:00 2001 From: Arthur Moreira Date: Fri, 15 Sep 2023 10:44:19 +0200 Subject: [PATCH 1/2] Update docker --- Dockerfile | 7 +++++ README.md | 4 +++ docker-compose.yml | 66 +++++++++++++++++++++++++++++++++------------- 3 files changed, 58 insertions(+), 19 deletions(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..53e112f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,7 @@ +FROM bitnami/magento:2 + +RUN apt update +RUN apt -y install unzip +RUN apt -y install nano + +RUN echo 'Mutex posixsem' >> /opt/bitnami/apache/conf/httpd.conf diff --git a/README.md b/README.md index a58e6cc..2dd807f 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ ## Installation ### Install using Composer (Recommended) +
  1. From the CLI, run the following commands to install the Mondu module. composer require mondu/magento2-payment
  2. @@ -13,12 +14,15 @@
### Install using Docker +
  1. Install docker and docker-compose.
  2. Run the following script: docker-compose up
  3. +
  4. Wait the container to start (it may take a while)
### Install manually +
  1. Download the latest release of Mondu module for Magento 2 file from the Mondu github repository https://github.com/mondu-ai/magento2-checkout/releases
  2. Unzip the file
  3. diff --git a/docker-compose.yml b/docker-compose.yml index 9f7e297..9364546 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,38 +1,66 @@ -version: '2' +version: "3" services: magento: - image: docker.io/bitnami/magento:2 + container_name: magento + build: . + platform: linux/amd64 ports: - - '80:8080' - - '443:8443' + - 80:8080 environment: - MAGENTO_HOST=localhost + - MAGENTO_MODE=developer - MAGENTO_DATABASE_HOST=mariadb - MAGENTO_DATABASE_PORT_NUMBER=3306 - - MAGENTO_DATABASE_USER=magento - - MAGENTO_DATABASE_PASSWORD=magento - - MAGENTO_DATABASE_NAME=magento + - MAGENTO_DATABASE_USER=bn_magento + - MAGENTO_DATABASE_NAME=bitnami_magento + - MAGENTO_USERNAME=mondu + - MAGENTO_PASSWORD=mondu + - ALLOW_EMPTY_PASSWORD=yes - ELASTICSEARCH_HOST=elasticsearch - ELASTICSEARCH_PORT_NUMBER=9200 + - PHP_MEMORY_LIMIT=5120M volumes: - - '.:/bitnami/magento/app/code/Mondu/Mondu' - - 'magento_data:/bitnami/magento' + - magento_data:/bitnami/magento + - .:/bitnami/magento/vendor/mondu/magento2-payment/ depends_on: - - mariadb - - elasticsearch + mariadb: + condition: service_healthy + elasticsearch: + condition: service_healthy + working_dir: /bitnami/magento + mem_limit: 5120MB + memswap_limit: 5120MB + mem_swappiness: 0 mariadb: - image: docker.io/bitnami/mariadb:10.4 + image: bitnami/mariadb:10.4 + platform: linux/amd64 environment: - - MARIADB_USER=magento - - MARIADB_DATABASE=magento - - MARIADB_PASSWORD=magento - - MARIADB_ROOT_PASSWORD=magento + - ALLOW_EMPTY_PASSWORD=yes + - MARIADB_USER=bn_magento + - MARIADB_DATABASE=bitnami_magento volumes: - - 'mariadb_data:/bitnami/mariadb' + - mariadb_data:/bitnami/mariadb + healthcheck: + test: ["CMD-SHELL", "mysqladmin -h 'localhost' -u root ping --silent"] + interval: 30s + timeout: 30s + retries: 3 elasticsearch: - image: docker.io/bitnami/elasticsearch:7 + image: bitnami/elasticsearch:7 + platform: linux/amd64 + ports: + - 9200:9200 volumes: - - 'elasticsearch_data:/bitnami/elasticsearch/data' + - elasticsearch_data:/bitnami/elasticsearch/data + depends_on: + mariadb: + condition: service_healthy + healthcheck: + test: ["CMD-SHELL", "curl --silent --fail localhost:9200/_cluster/health || exit 1"] + start_period: 60s + interval: 30s + timeout: 60s + retries: 50 volumes: mariadb_data: driver: local From 94bff75734f23a1436101ecf0b528e7a3459af3e Mon Sep 17 00:00:00 2001 From: Arthur Moreira Date: Fri, 15 Sep 2023 11:10:23 +0200 Subject: [PATCH 2/2] Include auth.json to install dependencies in docker --- .gitignore | 3 +++ README.md | 6 ++++-- auth.json.example | 8 ++++++++ docker-compose.yml | 1 + 4 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 auth.json.example diff --git a/.gitignore b/.gitignore index e43b0f9..e8773d5 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,4 @@ .DS_Store + +# Magento authentication file +auth.json diff --git a/README.md b/README.md index 2dd807f..4e76545 100644 --- a/README.md +++ b/README.md @@ -17,8 +17,10 @@
    1. Install docker and docker-compose. -
    2. Run the following script: docker-compose up
    3. -
    4. Wait the container to start (it may take a while)
    5. +
    6. Create a `auth.json` file copying it from `auth.json.example` according to https://experienceleague.adobe.com/docs/commerce-cloud-service/user-guide/develop/authentication-keys.html?lang=en.
    7. +
    8. Run the following script: docker-compose up.
    9. +
    10. Wait the container to start (it may take a while).
    11. +
    12. Run `composer install` inside the magento container.
    ### Install manually diff --git a/auth.json.example b/auth.json.example new file mode 100644 index 0000000..2ff4a31 --- /dev/null +++ b/auth.json.example @@ -0,0 +1,8 @@ +{ + "http-basic": { + "repo.magento.com": { + "username": "", + "password": "" + } + } +} diff --git a/docker-compose.yml b/docker-compose.yml index 9364546..8c1cc7e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -22,6 +22,7 @@ services: volumes: - magento_data:/bitnami/magento - .:/bitnami/magento/vendor/mondu/magento2-payment/ + - ./auth.json:/bitnami/magento/auth.json depends_on: mariadb: condition: service_healthy