Bläddra i källkod

Fix Composer auth.json not properly set after installation #424

Mark Shust 3 år sedan
förälder
incheckning
edafd37e26

+ 0 - 1
compose/bin/devtools-cli-check

@@ -2,7 +2,6 @@
 if ! bin/clinotty ls /var/www/.composer-global/vendor/bin/cache-clean.js 1> /dev/null 2>&1; then
   echo "Installing devtools metapackage, just a moment..."
   bin/cliq mkdir -p /var/www/.composer-global
-  bin/composer init --working-dir=/var/www/.composer-global --quiet --no-interaction
   bin/composer require --working-dir=/var/www/.composer-global --quiet markshust/magento2-metapackage-devtools-cli:^1.0
   echo "Devtools installed."
 fi

+ 4 - 1
compose/bin/setup

@@ -22,7 +22,7 @@ echo "Waiting for connection to Elasticsearch..."
 bin/clinotty timeout 100 bash -c "
     until curl --silent --output /dev/null http://$ES_HOST:$ES_PORT/_cat/health?h=st; do
         printf '.'
-        sleep 5
+        sleep 2
     done"
 [ $? != 0 ] && echo "Failed to connect to Elasticsearch" && exit
 
@@ -80,5 +80,8 @@ bin/clinotty bin/magento cache:flush
 echo "Generating SSL certificate..."
 bin/setup-ssl "$BASE_URL"
 
+echo "Ensuring Composer auth.json is setup..."
+bin/setup-composer-auth
+
 echo "Docker development environment setup complete."
 echo "You may now access your Magento instance at https://${BASE_URL}/"

+ 3 - 0
compose/bin/setup-composer-auth

@@ -25,4 +25,7 @@ fi
 # Output must be piped otherwise file descriptor errors occur. Carriage returns?
 echo "composer config --global http-basic.repo.magento.com ${PUBLIC_KEY} ${PRIVATE_KEY}" | bin/clinotty bash -
 
+# Also make sure alternate auth.json is setup (Magento uses this internally)
+bin/clinotty cp /var/www/.composer/auth.json ./var/composer_home/auth.json
+
 echo "Composer auth has been setup."

+ 1 - 1
compose/bin/setup-integration-tests

@@ -5,7 +5,7 @@ source env/db.env
 
 MYSQL_INTEGRATION_CONFIG=dev/tests/integration/etc/install-config-mysql.php
 
-# If database doesn't exist create it and add user permissions
+# If database doesn't exist, create it and add user permissions
 bin/clinotty mysql -h"${MYSQL_INTEGRATION_HOST}" -uroot -p"${MYSQL_ROOT_PASSWORD}" "${MYSQL_INTEGRATION_DATABASE}" -e exit &> /dev/null ||
   bin/clinotty mysqladmin -h"${MYSQL_INTEGRATION_HOST}" -uroot -p"${MYSQL_ROOT_PASSWORD}" create "${MYSQL_INTEGRATION_DATABASE}" &&
   echo "Database ${MYSQL_INTEGRATION_DATABASE} created." &&

+ 3 - 1
compose/bin/start

@@ -36,6 +36,7 @@ function parseYaml {
 VOLUME_LIST=$(parseYaml docker-compose.dev.yml services_app_volumes)
 IGNORE_LIST="./src/app/code ./src/m2-hotfixes ./src/patches ./src/var/log ./src/var/report ./src"
 IS_VALID=true
+
 # Loop through all files missing from the docker-compose.dev.yml file
 for file in $VOLUME_LIST; do
   if [ ! -e "$file" ] && [[ ! " $IGNORE_LIST " =~ $file ]]; then
@@ -43,13 +44,14 @@ for file in $VOLUME_LIST; do
     IS_VALID=false
   fi
 done
+
 # Wait to exit until all missing files have been outputted to the user
 [ $IS_VALID = false ] && echo "Failed to start docker for missing volume files" && exit
 
 docker-compose -f docker-compose.yml -f docker-compose.dev.yml up -d --remove-orphans "$@"
 
 ## Blackfire support
-# ------------------
+## ------------------
 ## First register the blackfire agent with:
 #bin/root blackfire-agent --register --server-id={YOUR_SERVER_ID} --server-token={YOUR_SERVER_TOKEN}
 ## Then uncomment the below line (and leave uncommented) to start the agent automatically with bin/start: