浏览代码

Fixed bin/setup for more dependable/faster install, added bin/removevolumes

Mark Shust 6 年之前
父节点
当前提交
7af02f38cd

+ 10 - 0
CHANGELOG.md

@@ -8,6 +8,16 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
 
 - N/A
 
+## [21.1.0] - 2018-12-26
+
+### Added
+- Helper script `bin/removevolumes` to remove docker volumes easily.
+- Added removal of `vendor` folder and force of composer install to `bin/setup` script. When installed from zip, it's possible Magento isn't installing all deps properly and assigning wrong permissions in Docker. Forcing a reinstall fixes this issue.
+- Force deploy of static content when running `bin/setup` to speed up initial requests.
+
+### Fixed
+- Fixed helper script `bin/dev-urn-catalog-generate` to copy file to host.
+
 ## [21.0.0] - 2018-12-24
 
 🎅 Santa Shust wishes you a very Merry Christmas!

+ 6 - 5
README.md

@@ -138,14 +138,15 @@ open https://magento2.test
 - `bin/magento`: Run the Magento CLI. Ex: `bin/magento cache:flush`
 - `bin/node`: Run the node binary. Ex. `bin/node --version`
 - `bin/npm`: Run the npm binary. Ex. `bin/npm install`
-- `bin/remove`: Remove all containers. Ex. `bin/remove`
-- `bin/restart`: Stop and then start all containers. Ex. `bin/restart`
+- `bin/remove`: Remove all containers.
+- `bin/removevolumes`: Remove all volumes.
+- `bin/restart`: Stop and then start all containers.
 - `bin/root`: Run any CLI command as root without going into the bash prompt. Ex `bin/root apt-get install nano`
 - `bin/rootnotty`: Run any CLI command as root with no TTY. Ex `bin/rootnotty chown -R app:app /var/www/html`
 - `bin/setup`: Run the Magento setup process to install Magento from the source code, with optional domain name. Defaults to `magento2.test`. Ex. `bin/setup magento2.test`
-- `bin/start`: Start all containers. This includes helper for bi-directional file sync, so be sure to use this instead of `docker-compose up -d`. Ex. `bin/start`
-- `bin/stop`: Stop all containers. Ex. `bin/stop`
-- `bin/xdebug`: Disable or enable Xdebug. Ex. `bin/xdebug enable`
+- `bin/start`: Start all containers, good practice to use this instead of `docker-compose up -d`, as it may contain additional helpers.
+- `bin/stop`: Stop all containers.
+- `bin/xdebug`: Disable or enable Xdebug. Accepts params `disable` (default) or `enable`. Ex. `bin/xdebug enable`
 
 ## Misc Info
 

+ 1 - 0
compose/magento-2/bin/dev-urn-catalog-generate

@@ -1,5 +1,6 @@
 #!/bin/bash
 bin/magento dev:urn-catalog:generate misc.xml
+bin/copyfromcontainer misc.xml
 
 sed -i .bak 's?/var/www/html?'`pwd`/src'?' src/misc.xml
 rm src/misc.xml.bak

+ 5 - 0
compose/magento-2/bin/removevolumes

@@ -0,0 +1,5 @@
+#!/bin/bash
+current_folder=${PWD##*/}
+docker volume rm ${current_folder}_appdata
+docker volume rm ${current_folder}_dbdata
+docker volume rm ${current_folder}_sockdata

+ 14 - 1
compose/magento-2/bin/setup

@@ -2,8 +2,10 @@
 bin/stop
 
 docker-compose -f docker-compose.yml up -d
+sleep 1 #Ensure containers are started...
 
 echo "Copying all files from host to container..."
+rm -rf src/vendor #Clear for step below
 bin/copytocontainer --all
 
 bin/fixowns
@@ -12,6 +14,9 @@ bin/clinotty chmod u+x bin/magento
 
 BASE_URL=${1:-magento2.test}
 
+echo "Forcing reinstall of composer deps to ensure perms & reqs..."
+bin/clinotty composer install
+
 bin/clinotty bin/magento setup:install \
   --db-host=db \
   --db-name=magento \
@@ -33,9 +38,17 @@ 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..."
+bin/clinotty bin/magento setup:static-content:deploy -f 
+
+echo "Clearing the cache for good measure..."
+bin/clinotty bin/magento cache:flush
+
+echo "Copying files from container to host after install..."
 bin/copyfromcontainer app
+bin/copyfromcontainer vendor
 
-echo "Restarting containers with host bind mounts..."
+echo "Restarting containers with host bind mounts for dev..."
 bin/restart
 
 echo "Docker development environment setup complete."

+ 1 - 1
compose/magento-2/docker-compose.dev.yml

@@ -1,5 +1,5 @@
 # Mark Shust's Docker Configuration for Magento (https://github.com/markoshust/docker-magento)
-# Version 21.0.0
+# Version 21.1.0
 
 version: "3"
 

+ 1 - 1
compose/magento-2/docker-compose.yml

@@ -1,5 +1,5 @@
 # Mark Shust's Docker Configuration for Magento (https://github.com/markoshust/docker-magento)
-# Version 21.0.0
+# Version 21.1.0
 
 version: "3"
 

+ 3 - 0
lib/onelinesetup

@@ -4,5 +4,8 @@ VERSION=${2:-2.3.0}
 
 curl -s https://raw.githubusercontent.com/markoshust/docker-magento/master/lib/template|bash -s - magento-2
 bin/download $VERSION
+
+echo "Your system password has been requested to add an entry to /etc/hosts..."
 echo "127.0.0.1 $DOMAIN" | sudo tee -a /etc/hosts
+
 bin/setup $DOMAIN