markshust / docker-magento

Mark Shust's Docker Configuration for Magento
https://m.academy/courses/set-up-magento-2-development-environment-docker/
MIT License
2.59k stars 1.01k forks source link

Some ideas to improve docker-magento #283

Open rangerz opened 4 years ago

rangerz commented 4 years ago

Please give me some advice and comment to agree and disagree them.

1. bin/start, before docker start to check delegated files and folder (#256)

2. bin/mysql, bin/dbdump, provide import and export db (#259)

  1. bin/patch, for apply patch m2-hotfixes (magento-cloud)
    
    #!/bin/bash
    PATCH_DIR=${1:-m2-hotfixes}

for file in $(bin/clinotty ls $PATCH_DIR); do if [ ${file: -6} == ".patch" ]; then echo "Apply $file" bin/clinotty git apply $PATCH_DIR/$file fi done


4. `bin/redeploy`, clean anything and redeploy magento

!/bin/bash

if [ "$1" == "--all" ]; then bin/clinotty rm -rf vendor bin/composer install bin/patch fi

bin/magento maintenance:enable --ip=none

Use sh -c for asterisk character '*'

bin/clinotty sh -c "rm -rf var/cache/" bin/clinotty sh -c "rm -rf var/page_cache/" bin/clinotty sh -c "rm -rf generated/" bin/clinotty sh -c "rm -rf var/view_preprocessed/" bin/clinotty sh -c "rm -rf pub/static/frontend/" bin/clinotty sh -c "rm -rf pub/static/adminhtml/" bin/clinotty sh -c "rm -rf pub/static/_requirejs/" bin/clinotty sh -c "rm -rf var/di/" bin/clinotty sh -c "rm -rf var/composer_home"

bin/magento setup:upgrade bin/magento setup:di:compile

bin/magento setup:static-content:deploy -f

bin/magento cache:flush

bin/magento maintenance:disable --ip=none


~~5. `bin/setup`, use `setup:install` to setup redis settings, adminurl, and secure base url(#304 )~~

... bin/clinotty bin/magento setup:install \ --base-url=https://$BASE_URL/ \ --base-url-secure=https://$BASE_URL/ \ --backend-frontname=admin \ ... --cache-backend=redis \ --cache-backend-redis-server=redis \ --cache-backend-redis-db=0 \ --page-cache=redis \ --page-cache-redis-server=redis \ --page-cache-redis-db=1 \ --session-save=redis \ --session-save-redis-host=redis \ --session-save-redis-log-level=4 \ --session-save-redis-db=2 ...



6. Support Ngrok.io or other options for temporarily public accessing docker env.
markshust commented 4 years ago

Thanks @rangerz! Suggestions like this make the project so much better.

I'll need some time to review/analyze. I'm trying to get a major version out today first, then will look over this list 👍

hieulecoffeemug commented 4 years ago

Nginx doesn't allow to run store view in the subdirectory, does anyone know it??

tylerpage commented 3 years ago

Was there any traction on supporting ngrok? I tried setting it up as I usually would by opening port 80: ./ngrok http --region=us --hostname=[url] 80

updated my Magento urls to my ngrok URL but I just get "[url] redirected you too many times ERR_TOO_MANY_REDIRECTS." in the browser and: GET / 301 Moved Permanently in the ngrok terminal.

I'll update if I figure anything else out.

markshust commented 3 years ago

@tylerpage After starting ngrok, you will need to update Magento's config values that point to that domain. There is a helper at bin/setup-domain you can use to assist with this, and you will need to point it at the ngrok domain.