浏览代码

Update bin/download and bin/setup to not use local Composer #336

Mark Shust 4 年之前
父节点
当前提交
e98dc2176b
共有 2 个文件被更改,包括 9 次插入41 次删除
  1. 5 24
      compose/bin/download
  2. 4 17
      compose/bin/setup

+ 5 - 24
compose/bin/download

@@ -5,29 +5,10 @@ set -o errexit
 
 
 edition=${2:-community}
 edition=${2:-community}
 
 
-if [[ "$edition" == "enterprise" ]]; then
-    rm -rf src
-    composer create-project --repository=https://repo.magento.com/ --ignore-platform-reqs magento/project-enterprise-edition="$1" src
-    exit 0
-fi
+bin/stop
 
 
-if [ ! -f ~/.docker-magento/magento2-"$1".tar.gz ]; then
-    mkdir -p ~/.docker-magento
-    (cd ~/.docker-magento && curl -fOL http://pubfiles.nexcess.net/magento/ce-packages/magento2-"$1".tar.gz) || true
-fi
+docker-compose -f docker-compose.yml up -d
+[ $? != 0 ] && echo "Failed to start Docker services" && exit
+sleep 5 #Ensure containers are started...
 
 
-# Fallback download to hypernode if archive doesn't exist on Nexcess (smaller than 1MB)
-if ! tar -tzf  ~/.docker-magento/magento2-"$1".tar.gz -O &>/dev/null; then
-    (cd ~/.docker-magento && curl -o magento2-"$1".tar.gz -fOL https://www.magento.mirror.hypernode.com/releases/magento-"$1".tar.gz) || true
-fi
-
-# Final fallback. If no archive exists, let's use Composer!
-if ! tar -tzf  ~/.docker-magento/magento2-"$1".tar.gz -O &>/dev/null; then
-    echo "Archive not found, or not yet available due to new version release."
-    echo "Attempting install with Composer..."
-    rm -rf src
-    composer create-project --repository=https://repo.magento.com/ --ignore-platform-reqs magento/project-community-edition="$1" src
-else
-    echo "Extracting magento2-$1.tar.gz to ./src"
-    mkdir -p src && tar xzf ~/.docker-magento/magento2-"$1".tar.gz -o -C src
-fi
+bin/composer create-project --repository=https://repo.magento.com/ --ignore-platform-reqs magento/project-$edition-edition="$1" .

+ 4 - 17
compose/bin/setup

@@ -7,7 +7,6 @@ source env/db.env
 source env/magento.env
 source env/magento.env
 
 
 BASE_URL=${1:-magento2.test}
 BASE_URL=${1:-magento2.test}
-
 ES_HOST=elasticsearch
 ES_HOST=elasticsearch
 ES_PORT=9200
 ES_PORT=9200
 
 
@@ -17,17 +16,8 @@ docker-compose -f docker-compose.yml up -d
 [ $? != 0 ] && echo "Failed to start Docker services" && exit
 [ $? != 0 ] && echo "Failed to start Docker services" && exit
 sleep 5 #Ensure containers are started...
 sleep 5 #Ensure containers are started...
 
 
-echo "Copying all files from host to container..."
-rm -rf src/vendor #Clear for step below
-bin/copytocontainer --all
-
 bin/clinotty chmod u+x bin/magento
 bin/clinotty chmod u+x bin/magento
-
-bin/setup-composer-auth
-
-echo "Forcing reinstall of composer deps to ensure perms & reqs..."
-bin/clinotty composer global require hirak/prestissimo
-bin/clinotty composer update
+mv .vscode src/
 
 
 echo "Waiting for connection to Elasticsearch..."
 echo "Waiting for connection to Elasticsearch..."
 bin/clinotty timeout 30 bash -c "
 bin/clinotty timeout 30 bash -c "
@@ -73,11 +63,12 @@ bin/clinotty bin/magento setup:install \
   --elasticsearch-port=$ES_PORT \
   --elasticsearch-port=$ES_PORT \
   --use-rewrites=1
   --use-rewrites=1
 
 
+echo "Copying files from container to host after install..."
+bin/copyfromcontainer --all
+
 echo "Turning on developer mode.."
 echo "Turning on developer mode.."
 bin/clinotty bin/magento deploy:mode:set developer
 bin/clinotty bin/magento deploy:mode:set developer
 
 
-bin/clinotty bin/magento indexer:reindex
-
 echo "Forcing deploy of static content to speed up initial requests..."
 echo "Forcing deploy of static content to speed up initial requests..."
 bin/clinotty bin/magento setup:static-content:deploy -f
 bin/clinotty bin/magento setup:static-content:deploy -f
 
 
@@ -87,10 +78,6 @@ bin/clinotty bin/magento indexer:reindex
 echo "Clearing the cache to apply updates..."
 echo "Clearing the cache to apply updates..."
 bin/clinotty bin/magento cache:flush
 bin/clinotty bin/magento cache:flush
 
 
-echo "Copying files from container to host after install..."
-bin/copyfromcontainer app
-bin/copyfromcontainer vendor
-
 echo "Generating SSL certificate..."
 echo "Generating SSL certificate..."
 bin/setup-ssl "$BASE_URL"
 bin/setup-ssl "$BASE_URL"