From b1cae04b1768fd0f5d1eaf1ba091eb73e0f52b2d Mon Sep 17 00:00:00 2001 From: Mateus Dutra Dadalto Date: Thu, 4 Aug 2022 16:02:28 -0300 Subject: [PATCH 1/6] build: change Dolphin to use mage-OS repository by default --- .env.sample | 6 +++++ docs/stories/composer/auth.md | 22 ++++++++++++++++++ docs/stories/dolphin.md | 30 ++++++------------------- php/7.2/fpm-alpine-dolphin/bin/setup.sh | 2 +- php/7.3/fpm-alpine-dolphin/bin/setup.sh | 2 +- php/7.4/fpm-alpine-dolphin/bin/setup.sh | 2 +- 6 files changed, 38 insertions(+), 26 deletions(-) create mode 100644 docs/stories/composer/auth.md diff --git a/.env.sample b/.env.sample index e956323..046dbef 100644 --- a/.env.sample +++ b/.env.sample @@ -31,6 +31,12 @@ COMPOSE_PROJECT_NAME=YOUR_PROJECT_NAME ########### COMPOSER_PROJECT_ENABLED=true +########################################################################## +# The repository that composer will use to create your magento project +# by default the value is the mage-OS (https://mage-os.org/) repository +########### +COMPOSER_PROJECT_REPO=https://mirror.mage-os.org/ + ########################################################################## # The Composer Project to install. Note, that on certain PHP versions, the glob # syntax does not work, so you may need to specify an exact version. diff --git a/docs/stories/composer/auth.md b/docs/stories/composer/auth.md new file mode 100644 index 0000000..a6892b0 --- /dev/null +++ b/docs/stories/composer/auth.md @@ -0,0 +1,22 @@ +### Setting up your Magento Account +[The process of creating a Magento account is fully documented by Magento and you should follow their process](https://docs.magento.com/m2/ce/user_guide/magento/magento-account-create.html). + +### Configuring Composer +In case you have not done so, we will add your Magento composer authentication credentials to your user's local `auth.json`. + +First check to see if you have a credentials file under `~/.composer/auth.json`. + +```bash +cat ~/.composer/auth.json +``` + +If you have a `auth.json` file here, you have most likely already configured your credentials and can skip to the next step. + +If you don't see your credentials there, [you can follow the Magento 2 guide to find your credentials](https://devdocs.magento.com/guides/v2.3/install-gde/prereq/connect-auth.html) and copy the `auth.json.sample` [found in the Magento 2 repo](https://github.com/magento/magento2/blob/2.4-develop/auth.json.sample) to your user's `auth.json` file: `~/.composer/auth.json` file and fill out the required credentials. + +```bash +cp /path/to/magento/project/auth.json.sample ~/.composer/auth.json +``` + +### Per-project configuration +We recommend using `auth.json` in your user's directory, but when you're working on multiple Magento 2 applications at once, you may need multiple `auth.json`. You can simply add the `auth.json` to the root of your Magento 2 project after project creation, and composer will use those credentials instead. \ No newline at end of file diff --git a/docs/stories/dolphin.md b/docs/stories/dolphin.md index 5af4f57..818b3c4 100644 --- a/docs/stories/dolphin.md +++ b/docs/stories/dolphin.md @@ -13,29 +13,6 @@ git clone https://www.github.com/graycoreio/mage2docker \ && cd mage2docker ``` -### Setting up your Magento Account -[The process of creating a Magento account is fully documented by Magento and you should follow their process](https://docs.magento.com/m2/ce/user_guide/magento/magento-account-create.html). - -### Configuring Composer -In case you have not done so, we will add your Magento composer authentication credentials to your user's local `auth.json`. - -First check to see if you have a credentials file under `~/.composer/auth.json`. - -```bash -cat ~/.composer/auth.json -``` - -If you have a `auth.json` file here, you have most likely already configured your credentials and can skip to the next step. - -If you don't see your credentials there, [you can follow the Magento 2 guide to find your credentials](https://devdocs.magento.com/guides/v2.3/install-gde/prereq/connect-auth.html) and copy the `auth.json.sample` [found in the Magento 2 repo](https://github.com/magento/magento2/blob/2.4-develop/auth.json.sample) to your user's `auth.json` file: `~/.composer/auth.json` file and fill out the required credentials. - -```bash -cp /path/to/magento/project/auth.json.sample ~/.composer/auth.json -``` - -### Per-project configuration -We recommend using `auth.json` in your user's directory, but when you're working on multiple Magento 2 applications at once, you may need multiple `auth.json`. You can simply add the `auth.json` to the root of your Magento 2 project after project creation, and composer will use those credentials instead. - ### Configuring Docker Compose Mage2Docker comes with a basic environment configuration file `.env.sample`, you can utilize this file to tailor your environment to your needs. @@ -72,6 +49,13 @@ If you're using [WSL2, use this instead.](https://github.com/microsoft/WSL/issue * [Install Recommended Extensions](../../.vscode/extensions.json) * [Install the devcontainer cli](https://code.visualstudio.com/docs/remote/devcontainer-cli) + +### Magento Open Source and Adobe Commerce Only - Composer auth.json +By default this project uses [Mage-OS](https://mage-os.org/). To use Adobe's Magento Open Source or Adobe Commerce you will need to: +1. Follow [these steps](./composer/auth.md) to configure composer's `auth.json` with your Magento Account credentials. +2. Change the repository variable in `.env` file to `https://repo.magento.com/` + + ### Start your environment From your `mage2docker` repo: diff --git a/php/7.2/fpm-alpine-dolphin/bin/setup.sh b/php/7.2/fpm-alpine-dolphin/bin/setup.sh index 4d8a676..eb5d0b8 100755 --- a/php/7.2/fpm-alpine-dolphin/bin/setup.sh +++ b/php/7.2/fpm-alpine-dolphin/bin/setup.sh @@ -19,7 +19,7 @@ if [ -f 'pub/index.php' ]; then echo "Setup took: $((SETUP_END-SETUP_START)) seconds..." exit 0; elif [ "$COMPOSER_PROJECT_ENABLED" == true ]; then - composer create-project --no-install --repository-url=https://repo.magento.com/ $COMPOSER_PROJECT . + composer create-project --no-install --repository-url=$COMPOSER_PROJECT_REPO $COMPOSER_PROJECT . composer config --no-interaction allow-plugins.dealerdirect/phpcodesniffer-composer-installer true composer config --no-interaction allow-plugins.laminas/laminas-dependency-plugin true diff --git a/php/7.3/fpm-alpine-dolphin/bin/setup.sh b/php/7.3/fpm-alpine-dolphin/bin/setup.sh index 4d8a676..eb5d0b8 100755 --- a/php/7.3/fpm-alpine-dolphin/bin/setup.sh +++ b/php/7.3/fpm-alpine-dolphin/bin/setup.sh @@ -19,7 +19,7 @@ if [ -f 'pub/index.php' ]; then echo "Setup took: $((SETUP_END-SETUP_START)) seconds..." exit 0; elif [ "$COMPOSER_PROJECT_ENABLED" == true ]; then - composer create-project --no-install --repository-url=https://repo.magento.com/ $COMPOSER_PROJECT . + composer create-project --no-install --repository-url=$COMPOSER_PROJECT_REPO $COMPOSER_PROJECT . composer config --no-interaction allow-plugins.dealerdirect/phpcodesniffer-composer-installer true composer config --no-interaction allow-plugins.laminas/laminas-dependency-plugin true diff --git a/php/7.4/fpm-alpine-dolphin/bin/setup.sh b/php/7.4/fpm-alpine-dolphin/bin/setup.sh index 1be933d..3a689e9 100755 --- a/php/7.4/fpm-alpine-dolphin/bin/setup.sh +++ b/php/7.4/fpm-alpine-dolphin/bin/setup.sh @@ -23,7 +23,7 @@ if [ -f 'pub/index.php' ]; then echo "Setup took: $((SETUP_END-SETUP_START)) seconds..." exit 0; elif [ "$COMPOSER_PROJECT_ENABLED" == true ]; then - composer create-project --no-interaction --no-install --repository-url=https://repo.magento.com/ $COMPOSER_PROJECT . + composer create-project --no-interaction --no-install --repository-url=$COMPOSER_PROJECT_REPO $COMPOSER_PROJECT . composer config --no-interaction allow-plugins.dealerdirect/phpcodesniffer-composer-installer true composer config --no-interaction allow-plugins.laminas/laminas-dependency-plugin true From 8dcd58f585168b50124266e29437bccb1b8bc712 Mon Sep 17 00:00:00 2001 From: Mateus Dutra Dadalto Date: Thu, 4 Aug 2022 17:05:50 -0300 Subject: [PATCH 2/6] build: use COMPOSER_PROJECT_REPO variable when installing venia --- php/7.2/fpm-alpine-dolphin/bin/setup.sh | 2 +- php/7.3/fpm-alpine-dolphin/bin/setup.sh | 2 +- php/7.4/fpm-alpine-dolphin/bin/setup.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/php/7.2/fpm-alpine-dolphin/bin/setup.sh b/php/7.2/fpm-alpine-dolphin/bin/setup.sh index eb5d0b8..8a57d95 100755 --- a/php/7.2/fpm-alpine-dolphin/bin/setup.sh +++ b/php/7.2/fpm-alpine-dolphin/bin/setup.sh @@ -79,7 +79,7 @@ bin/magento config:set web/seo/use_rewrites 1 if [ "$MAGENTO_SAMPLE_DATA" == "venia" ]; then echo "Installing 'Venia' Sample Data..."; - composer config --no-interaction --ansi repositories.venia-sample-data composer https://repo.magento.com + composer config --no-interaction --ansi repositories.venia-sample-data composer $COMPOSER_PROJECT_REPO composer require --no-interaction --ansi magento/venia-sample-data:* bin/magento setup:upgrade diff --git a/php/7.3/fpm-alpine-dolphin/bin/setup.sh b/php/7.3/fpm-alpine-dolphin/bin/setup.sh index eb5d0b8..8a57d95 100755 --- a/php/7.3/fpm-alpine-dolphin/bin/setup.sh +++ b/php/7.3/fpm-alpine-dolphin/bin/setup.sh @@ -79,7 +79,7 @@ bin/magento config:set web/seo/use_rewrites 1 if [ "$MAGENTO_SAMPLE_DATA" == "venia" ]; then echo "Installing 'Venia' Sample Data..."; - composer config --no-interaction --ansi repositories.venia-sample-data composer https://repo.magento.com + composer config --no-interaction --ansi repositories.venia-sample-data composer $COMPOSER_PROJECT_REPO composer require --no-interaction --ansi magento/venia-sample-data:* bin/magento setup:upgrade diff --git a/php/7.4/fpm-alpine-dolphin/bin/setup.sh b/php/7.4/fpm-alpine-dolphin/bin/setup.sh index 3a689e9..6d0df56 100755 --- a/php/7.4/fpm-alpine-dolphin/bin/setup.sh +++ b/php/7.4/fpm-alpine-dolphin/bin/setup.sh @@ -83,7 +83,7 @@ bin/magento config:set web/seo/use_rewrites 1 if [ "$MAGENTO_SAMPLE_DATA" == "venia" ]; then echo "Installing 'Venia' Sample Data..."; - composer config --no-interaction --ansi repositories.venia-sample-data composer https://repo.magento.com + composer config --no-interaction --ansi repositories.venia-sample-data composer $COMPOSER_PROJECT_REPO composer require --no-interaction --ansi magento/venia-sample-data:* bin/magento setup:upgrade From 9c6a775906b3121e74e2a265ca92806b0bef1167 Mon Sep 17 00:00:00 2001 From: Mateus Dutra Dadalto Date: Thu, 4 Aug 2022 17:06:32 -0300 Subject: [PATCH 3/6] docs: improve documentation by adding variable name --- docs/stories/dolphin.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/stories/dolphin.md b/docs/stories/dolphin.md index 818b3c4..d1b2565 100644 --- a/docs/stories/dolphin.md +++ b/docs/stories/dolphin.md @@ -53,7 +53,7 @@ If you're using [WSL2, use this instead.](https://github.com/microsoft/WSL/issue ### Magento Open Source and Adobe Commerce Only - Composer auth.json By default this project uses [Mage-OS](https://mage-os.org/). To use Adobe's Magento Open Source or Adobe Commerce you will need to: 1. Follow [these steps](./composer/auth.md) to configure composer's `auth.json` with your Magento Account credentials. -2. Change the repository variable in `.env` file to `https://repo.magento.com/` +2. Change the `COMPOSER_PROJECT_REPO` variable in `.env` file to `https://repo.magento.com/` ### Start your environment From a2b73892206bce7e1b896ae3d7a38dabfd4bf366 Mon Sep 17 00:00:00 2001 From: Mateus Dutra Dadalto Date: Thu, 4 Aug 2022 17:51:35 -0300 Subject: [PATCH 4/6] fix: keep venia using adobe's repo and change the default to luma --- .env.sample | 6 +++--- php/7.2/fpm-alpine-dolphin/bin/setup.sh | 2 +- php/7.3/fpm-alpine-dolphin/bin/setup.sh | 2 +- php/7.4/fpm-alpine-dolphin/bin/setup.sh | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.env.sample b/.env.sample index 046dbef..72684a5 100644 --- a/.env.sample +++ b/.env.sample @@ -86,8 +86,8 @@ MAGENTO_CURRENCY=USD MAGENTO_TIMEZONE="America/Chicago" ########################################################################## -# Whether or not to use sample data. By default, we use Venia. +# Whether or not to use sample data. By default, we use Luma. # Supported values include 'venia', 'luma', 'none' -# Default: 'venia' +# Default: 'luma' ########### -MAGENTO_SAMPLE_DATA="venia" \ No newline at end of file +MAGENTO_SAMPLE_DATA="luma" \ No newline at end of file diff --git a/php/7.2/fpm-alpine-dolphin/bin/setup.sh b/php/7.2/fpm-alpine-dolphin/bin/setup.sh index 8a57d95..180d891 100755 --- a/php/7.2/fpm-alpine-dolphin/bin/setup.sh +++ b/php/7.2/fpm-alpine-dolphin/bin/setup.sh @@ -79,7 +79,7 @@ bin/magento config:set web/seo/use_rewrites 1 if [ "$MAGENTO_SAMPLE_DATA" == "venia" ]; then echo "Installing 'Venia' Sample Data..."; - composer config --no-interaction --ansi repositories.venia-sample-data composer $COMPOSER_PROJECT_REPO + composer config --no-interaction --ansi repositories.venia-sample-data composer https://repo.magento.com/ composer require --no-interaction --ansi magento/venia-sample-data:* bin/magento setup:upgrade diff --git a/php/7.3/fpm-alpine-dolphin/bin/setup.sh b/php/7.3/fpm-alpine-dolphin/bin/setup.sh index 8a57d95..180d891 100755 --- a/php/7.3/fpm-alpine-dolphin/bin/setup.sh +++ b/php/7.3/fpm-alpine-dolphin/bin/setup.sh @@ -79,7 +79,7 @@ bin/magento config:set web/seo/use_rewrites 1 if [ "$MAGENTO_SAMPLE_DATA" == "venia" ]; then echo "Installing 'Venia' Sample Data..."; - composer config --no-interaction --ansi repositories.venia-sample-data composer $COMPOSER_PROJECT_REPO + composer config --no-interaction --ansi repositories.venia-sample-data composer https://repo.magento.com/ composer require --no-interaction --ansi magento/venia-sample-data:* bin/magento setup:upgrade diff --git a/php/7.4/fpm-alpine-dolphin/bin/setup.sh b/php/7.4/fpm-alpine-dolphin/bin/setup.sh index 6d0df56..0c407d9 100755 --- a/php/7.4/fpm-alpine-dolphin/bin/setup.sh +++ b/php/7.4/fpm-alpine-dolphin/bin/setup.sh @@ -83,7 +83,7 @@ bin/magento config:set web/seo/use_rewrites 1 if [ "$MAGENTO_SAMPLE_DATA" == "venia" ]; then echo "Installing 'Venia' Sample Data..."; - composer config --no-interaction --ansi repositories.venia-sample-data composer $COMPOSER_PROJECT_REPO + composer config --no-interaction --ansi repositories.venia-sample-data composer https://repo.magento.com/ composer require --no-interaction --ansi magento/venia-sample-data:* bin/magento setup:upgrade From 0d829333145f74e078cea61a2d971e30a1a0be5f Mon Sep 17 00:00:00 2001 From: Mateus Dutra Dadalto Date: Thu, 4 Aug 2022 17:59:27 -0300 Subject: [PATCH 5/6] docs: create doc to explain venia data sample requirement --- docs/stories/dolphin.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/stories/dolphin.md b/docs/stories/dolphin.md index d1b2565..defab49 100644 --- a/docs/stories/dolphin.md +++ b/docs/stories/dolphin.md @@ -56,6 +56,9 @@ By default this project uses [Mage-OS](https://mage-os.org/). To use Adobe's Mag 2. Change the `COMPOSER_PROJECT_REPO` variable in `.env` file to `https://repo.magento.com/` +### Using Venia Data Sample +For now, if you want to use Venia data sample you'll need to configure your `auth.json` because it is only available repo.magento.com. Please follow [these steps](./composer/auth.md) to set up composer's `auth.json` + ### Start your environment From your `mage2docker` repo: From 515ca5bd5a20abd1b15d75263bd90ee78fd172e9 Mon Sep 17 00:00:00 2001 From: Damien Retzinger Date: Sat, 6 Aug 2022 18:00:17 -0400 Subject: [PATCH 6/6] bust cache --- .github/workflows/test-env-startup.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-env-startup.yml b/.github/workflows/test-env-startup.yml index c3578ae..2532bd1 100644 --- a/.github/workflows/test-env-startup.yml +++ b/.github/workflows/test-env-startup.yml @@ -24,7 +24,7 @@ jobs: - uses: actions/cache@v2 with: path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-composer-${{ matrix.COMPOSER_PROJECT }} + key: ${{ runner.os }}-composer-${{ matrix.COMPOSER_PROJECT }}-v1.0 restore-keys: | ${{ runner.os }}-composer- - name: Add HTTP basic auth credentials for composer