Skip to content

Commit

Permalink
v. 1.2.0
Browse files Browse the repository at this point in the history
- Magento atualizado de 2.4.2 para 2.4.2-p1
- SystemCode_BrazilCustomerAttributes atualizado pra 1.1.1 corrigindo problema de bairro inválido quando o complemento não é preenchido
- Projeto docker (markshust/docker-magento) atualizado para última versão (37.0.2)
  • Loading branch information
r-martins committed May 28, 2021
2 parents ba208ae + 0a20eda commit b4b12a6
Show file tree
Hide file tree
Showing 18 changed files with 506 additions and 486 deletions.
2 changes: 2 additions & 0 deletions bin/cache-clean
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
bin/cli /var/www/.composer-global/vendor/bin/cache-clean.js "$@"
3 changes: 3 additions & 0 deletions bin/cliq
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
[ -z "$1" ] && echo "Please specify a CLI command (ex. ls)" && exit
bin/clinotty "$@" >/dev/null
7 changes: 7 additions & 0 deletions bin/dev-test-run
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

[ -z "$1" ] && echo "Please specify test type (ex. integration)" && exit

TEST_TYPE="$1"
shift
bin/clinotty bash -c "cd dev/tests/${TEST_TYPE} && ../../../vendor/bin/phpunit -c phpunit.xml.dist $*"
8 changes: 8 additions & 0 deletions bin/devtools-cli-check
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash
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
33 changes: 7 additions & 26 deletions bin/download
Original file line number Diff line number Diff line change
@@ -1,32 +1,13 @@
#!/bin/bash
set -o errexit
[ -z "$1" ] && echo "Please specify the version to download (ex. 2.0.0)" && exit

edition=${2:-community}
VERSION=${1:-2.4.2}
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
docker-compose -f docker-compose.yml up -d
[ $? != 0 ] && echo "Failed to start Docker services" && exit

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)
fi
bin/setup-composer-auth

# 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)
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/clinotty composer create-project --repository=https://repo.magento.com/ magento/project-"${EDITION}"-edition="${VERSION}" .
4 changes: 2 additions & 2 deletions bin/fixowns
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/bin/bash
echo "Correcting filesystem ownerships..."
echo "Fixing filesystem ownerships..."

if [ -z "$1" ]; then
bin/rootnotty chown -R app:app /var/www/
else
bin/rootnotty chown -R app:app /var/www/html/"$1"
fi

echo "Filesystem ownerships corrected."
echo "Filesystem ownerships fixed."
4 changes: 2 additions & 2 deletions bin/fixperms
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
echo "Correcting filesystem permissions..."
echo "Fixing filesystem permissions..."

if [ -z "$1" ]; then
bin/clinotty find var vendor pub/static pub/media app/etc \( -type f -or -type d \) -exec chmod u+w {} +;
Expand All @@ -8,4 +8,4 @@ else
bin/clinotty find "$1" \( -type f -or -type d \) -exec chmod u+w {} +;
fi

echo "Filesystem permissions corrected."
echo "Filesystem permissions fixed."
24 changes: 5 additions & 19 deletions bin/setup
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,19 @@ source env/db.env
source env/magento.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
mv .vscode src

echo "Waiting for connection to Elasticsearch..."
bin/clinotty timeout 30 bash -c "
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
Expand Down Expand Up @@ -73,11 +62,12 @@ bin/clinotty bin/magento setup:install \
--elasticsearch-port=$ES_PORT \
--use-rewrites=1

echo "Copying files from container to host after install..."
bin/copyfromcontainer --all

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

Expand All @@ -87,10 +77,6 @@ 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"

Expand Down
97 changes: 13 additions & 84 deletions bin/setup-composer-auth
Original file line number Diff line number Diff line change
@@ -1,99 +1,28 @@
#!/bin/bash
MAGENTO_USERNAME_PROP="http-basic.repo.magento.com.username"
MAGENTO_PASSWORD_PROP="http-basic.repo.magento.com.password"
hash composer 2>/dev/null && IS_COMPOSER_ON_HOST=true

GLOBAL_AUTH=~/.composer/auth.json
PROJECT_AUTH=./src/auth.json
NEED_AUTH=false

hash composer 2>/dev/null && USE_COMPOSER=true
hash python3 2>/dev/null && USE_PYTHON3=true

[ ! $USE_COMPOSER ] && [ ! $USE_PYTHON3 ] && echo "Failed to setup composer auth, it needs composer or python3" && exit 1

# Get composer auth: username and password
if [ $USE_COMPOSER ]; then
COMPOSER_USER="http-basic.repo.magento.com.username"
COMPOSER_PASS="http-basic.repo.magento.com.password"

PUBLIC_KEY="$(composer config -g $COMPOSER_USER 2>/dev/null)"
PRIVATE_KEY="$(composer config -g $COMPOSER_PASS 2>/dev/null)"

if [ -z "$PUBLIC_KEY" ] || [ -z "$PRIVATE_KEY" ]; then
PUBLIC_KEY="$(composer config -d ./src $COMPOSER_USER 2>/dev/null)"
PRIVATE_KEY="$(composer config -d ./src $COMPOSER_PASS 2>/dev/null)"
NEED_AUTH=true
fi
elif [ $USE_PYTHON3 ]; then
PY3_USER="import sys, json; print(json.load(sys.stdin)['http-basic']['repo.magento.com']['username'])"
PY3_PASS="import sys, json; print(json.load(sys.stdin)['http-basic']['repo.magento.com']['password'])"

if [ -f "$GLOBAL_AUTH" ]; then
PUBLIC_KEY=$(python3 -c "$PY3_USER" 2>/dev/null < "$GLOBAL_AUTH")
PRIVATE_KEY=$(python3 -c "$PY3_PASS" 2>/dev/null < "$GLOBAL_AUTH")
fi

if [ -z "$PUBLIC_KEY" ] || [ -z "$PRIVATE_KEY" ]; then
if [ -f "$PROJECT_AUTH" ]; then
PUBLIC_KEY=$(python3 -c "$PY3_USER" 2>/dev/null < "$PROJECT_AUTH")
PRIVATE_KEY=$(python3 -c "$PY3_PASS" 2>/dev/null < "$PROJECT_AUTH")
NEED_AUTH=true
fi
fi
if [ $IS_COMPOSER_ON_HOST ]; then
PUBLIC_KEY="$(composer config --global $MAGENTO_USERNAME_PROP 2>/dev/null)"
PRIVATE_KEY="$(composer config --global $MAGENTO_PASSWORD_PROP 2>/dev/null)"
fi

if [ -n "$PUBLIC_KEY" ] && [ -n "$PRIVATE_KEY" ] && [ $NEED_AUTH = false ]; then
echo "Global composer auth already exists" && exit
fi

# The last chance to enter manually
if [ -z "$PUBLIC_KEY" ] || [ -z "$PRIVATE_KEY" ]; then
exec < /dev/tty
echo
echo " Authentication required (repo.magento.com, public_key and private_key):"
read -r -p " Username: " PUBLIC_KEY
read -r -p " Password: " PRIVATE_KEY
echo "Composer authentication required (repo.magento.com public and private keys):"
read -r -p " Username: " PUBLIC_KEY
read -r -p " Password: " PRIVATE_KEY
echo
exec <&-
fi

if [ -z "$PUBLIC_KEY" ] || [ -z "$PRIVATE_KEY" ]; then
echo "Please enter composer auth for repo.magento.com" && exit 1
echo "Please setup Composer auth for repo.magento.com to continue." && exit 1
fi

# For docker-compose.yml setting: ~/.composer:/var/www/.composer:cached
echo "Authentication will add to host composer global config ($GLOBAL_AUTH) for docker container"
if [ $USE_COMPOSER ]; then
composer global config http-basic.repo.magento.com "$PUBLIC_KEY" "$PRIVATE_KEY"
elif [ $USE_PYTHON3 ]; then
PY3_MERGE_AUTH="""
import sys, json;
data = json.load(sys.stdin)
auth= {
'http-basic': {
'repo.magento.com': {
'username': '${PUBLIC_KEY}',
'password': '${PRIVATE_KEY}'
}
}
}
def merge(src, dest):
for key, val in src.items():
if isinstance(val, dict):
node = dest.setdefault(key, {})
merge(val, node)
else:
dest[key] = val
return dest
print(json.dumps(merge(auth, data), indent=4))
"""
if [ -f "$GLOBAL_AUTH" ]; then
mkdir -p "$(dirname "$GLOBAL_AUTH")"
echo "{}" > "$GLOBAL_AUTH"
fi
mv "$GLOBAL_AUTH" "$GLOBAL_AUTH.bak"
python3 -c "$PY3_MERGE_AUTH" > "$GLOBAL_AUTH" < "$GLOBAL_AUTH.bak"
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 -

echo "Success to setup composer auth"
echo "Composer auth has been setup."
10 changes: 6 additions & 4 deletions bin/setup-integration-tests
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ bin/clinotty mysql -h"${MYSQL_INTEGRATION_HOST}" -uroot -p"${MYSQL_ROOT_PASSWORD
bin/cli mysql -uroot -p"${MYSQL_ROOT_PASSWORD}" -h"${MYSQL_INTEGRATION_HOST}" \
-e "GRANT ALL PRIVILEGES ON ${MYSQL_INTEGRATION_DATABASE}.* TO '${MYSQL_INTEGRATION_USER}'@'%';FLUSH PRIVILEGES;"

sed -e "s/'db-host' => 'localhost'/'db-host' => '${MYSQL_INTEGRATION_HOST}'/" \
-e "s/'db-password' => '123123q'/'db-password' => '${MYSQL_ROOT_PASSWORD}'/" \
-e "s/'amqp-host' => 'localhost'/'amqp-host' => 'rabbitmq'/" \
src/${MYSQL_INTEGRATION_CONFIG}.dist > src/${MYSQL_INTEGRATION_CONFIG}
if [[ ! -f "src/${MYSQL_INTEGRATION_CONFIG}" ]]; then
MAGENTO_VERSION=$(bin/magento --version --no-ansi | cut -d" " -f 3)
IFS=. read -r -a MAGENTO_VERSION_SEGMENTS <<< "${MAGENTO_VERSION}"
MAGENTO_MAJOR="${MAGENTO_VERSION_SEGMENTS[0]}.${MAGENTO_VERSION_SEGMENTS[1]}"
cp template/"${MYSQL_INTEGRATION_CONFIG}"."${MAGENTO_MAJOR}".dist src/${MYSQL_INTEGRATION_CONFIG}
fi

bin/copytocontainer ${MYSQL_INTEGRATION_CONFIG}
18 changes: 9 additions & 9 deletions bin/xdebug
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/bin/bash

S=$(bin/cli cat /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini | grep -iGc '^;');
S=$(bin/cli cat /usr/local/etc/php/php.ini | grep -iGc 'xdebug.mode = off');

xdebug_status() {
if [[ $S == 1 ]]; then
echo "Xdebug is disabled."
echo "Xdebug debug mode is disabled."
else
echo "Xdebug is enabled."
echo "Xdebug debug mode is enabled."
fi
}

Expand All @@ -20,23 +20,23 @@ xdebug_toggle() {

xdebug_enable() {
if [[ $S == 1 ]]; then
bin/cli sed -i -e 's/^\;zend_extension/zend_extension/g' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
bin/root sed -i -e 's/^xdebug.mode = off/xdebug.mode = debug/g' /usr/local/etc/php/php.ini
sleep 1
bin/restart phpfpm
echo "Xdebug has been enabled."
echo "Xdebug debug mode has been enabled."
else
echo "Xdebug is already enabled."
echo "Xdebug debug mode is already enabled."
fi
}

xdebug_disable() {
if [[ $S == 0 ]]; then
bin/cli sed -i -e 's/^\zend_extension/;zend_extension/g' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
bin/root sed -i -e 's/^xdebug.mode = debug/xdebug.mode = off/g' /usr/local/etc/php/php.ini
sleep 1
bin/restart phpfpm
echo "Xdebug has been disabled."
echo "Xdebug debug mode has been disabled."
else
echo "Xdebug is already disabled."
echo "Xdebug debug mode is already disabled."
fi
}

Expand Down
4 changes: 2 additions & 2 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Mark Shust's Docker Configuration for Magento
# (https://github.com/markshust/docker-magento)
#
# Version 36.0.1
# Version 37.0.2

version: "3"

Expand All @@ -22,7 +22,7 @@ services:
#- ./src/var/report:/var/www/html/var/report:cached
# To sync your SSH to the container, uncomment the following line:
#- ~/.ssh/id_rsa:/var/www/.ssh/id_rsa:cached
# Linux only: remove the above lines and mount the entire src directory with:
# Linux only: remove the above lines (except nginx.conf line) and mount the entire src directory with:
#- ./src:/var/www/html:cached

phpfpm:
Expand Down
6 changes: 3 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Mark Shust's Docker Configuration for Magento
# (https://github.com/markshust/docker-magento)
#
# Version 36.0.1
# Version 37.0.2

version: "3"

Expand All @@ -21,7 +21,7 @@ services:
- ssldata:/etc/nginx/certs

phpfpm:
image: markoshust/magento-php:7.4-fpm-3
image: markoshust/magento-php:7.4-fpm-5
links:
- db
volumes: *appvolumes
Expand Down Expand Up @@ -57,7 +57,7 @@ services:

# Disabling cron by default as it uses higher CPU, enable if needed
#cron:
# image: markoshust/magento-php:7.4-fpm-3
# image: markoshust/magento-php:7.4-fpm-5
# user: root
# command: /usr/local/bin/cronstart
# tty: true
Expand Down
2 changes: 1 addition & 1 deletion src/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"magento/module-theme-sample-data": "100.4.*",
"magento/module-widget-sample-data": "100.4.*",
"magento/module-wishlist-sample-data": "100.4.*",
"magento/product-community-edition": "2.4.2",
"magento/product-community-edition": "2.4.2-p1",
"magento/sample-data-media": "100.4.*",
"mageplaza/module-smtp": "^1.4",
"rafaelstz/traducao_magento2_pt_br": "dev-master",
Expand Down
Loading

0 comments on commit b4b12a6

Please sign in to comment.