1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- #!/bin/bash
- set -o errexit
- # shellcheck source=../env/db.env
- source env/db.env
- BASE_URL=${1:-magento2.test}
- ES_HOST=elasticsearch
- ES_PORT=9200
- bin/stop
- docker-compose -f docker-compose.yml up -d
- [ $? != 0 ] && echo "Failed to start Docker services" && exit
- 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/setup-composer-auth
- echo "Forcing reinstall of composer deps to ensure perms & reqs..."
- bin/clinotty composer global require hirak/prestissimo
- bin/clinotty composer update
- echo "Waiting for connection to Elasticsearch..."
- bin/clinotty timeout 30 bash -c "
- until curl --silent --output /dev/null http://$ES_HOST:$ES_PORT/_cat/health?h=st; do
- printf '.'
- sleep 5
- done"
- [ $? != 0 ] && echo "Failed to connect to Elasticsearch" && exit
- bin/clinotty bin/magento setup:install \
- --db-host="$MYSQL_HOST" \
- --db-name="$MYSQL_DATABASE" \
- --db-user="$MYSQL_USER" \
- --db-password="$MYSQL_PASSWORD" \
- --base-url=https://"$BASE_URL"/ \
- --base-url-secure=https://"$BASE_URL"/ \
- --backend-frontname=admin \
- --admin-firstname=John \
- --admin-lastname=Smith \
- --admin-email=john.smith@gmail.com \
- --admin-user=john.smith \
- --admin-password=password123 \
- --language=en_US \
- --currency=USD \
- --timezone=America/New_York \
- --amqp-host=rabbitmq \
- --amqp-port=5672 \
- --amqp-user=guest \
- --amqp-password=guest \
- --amqp-virtualhost=/ \
- --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 \
- --search-engine=elasticsearch7 \
- --elasticsearch-host=$ES_HOST \
- --elasticsearch-port=$ES_PORT \
- --use-rewrites=1
- echo "Turning on developer mode.."
- 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 "Re-indexing with Elasticsearch..."
- bin/clinotty bin/magento indexer:reindex
- echo "Clearing the cache to apply updates..."
- 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..."
- bin/setup-ssl "$BASE_URL"
- echo "Docker development environment setup complete."
- echo "You may now access your Magento instance at https://${BASE_URL}/"
|