-
Notifications
You must be signed in to change notification settings - Fork 22
Bring Magento template up-to-date #18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -18,15 +18,15 @@ cd "${WARDEN_ENV_PATH}" | |||
|
||||
## configure command defaults | ||||
WARDEN_WEB_ROOT="$(echo "${WARDEN_WEB_ROOT:-/}" | sed 's#^/#./#')" | ||||
REQUIRED_FILES=("${WARDEN_WEB_ROOT}/auth.json") | ||||
REQUIRED_FILES=() | ||||
DB_DUMP="${DB_DUMP:-./backfill/magento-db.sql.gz}" | ||||
DB_IMPORT=1 | ||||
CLEAN_INSTALL= | ||||
AUTO_PULL=1 | ||||
META_PACKAGE="magento/project-community-edition" | ||||
META_VERSION="" | ||||
URL_FRONT="https://${TRAEFIK_SUBDOMAIN}.${TRAEFIK_DOMAIN}/" | ||||
URL_ADMIN="https://${TRAEFIK_SUBDOMAIN}.${TRAEFIK_DOMAIN}/backend/" | ||||
URL_ADMIN="https://${TRAEFIK_SUBDOMAIN}.${TRAEFIK_DOMAIN}/admin/" | ||||
navarr marked this conversation as resolved.
Show resolved
Hide resolved
|
||||
|
||||
## argument parsing | ||||
## parse arguments | ||||
|
@@ -161,19 +161,40 @@ else | |||
fi | ||||
warden env up -d | ||||
|
||||
# If neither global nor local exists, prompt for creds | ||||
if [[ ! -f "${WARDEN_WEB_ROOT}/auth.json" ]]; then | ||||
# Prompt for creds | ||||
read -p "No existing composer credentials were found. Would you like to configure them? [y/N] " willManuallyInputCreds | ||||
if [[ "$willManuallyInputCreds" =~ ^([yY][eE][sS]|[yY1])$ ]]; then | ||||
read -p "Public Key: " composerPublicKey | ||||
read -p "Private Key: " composerPrivateKey | ||||
|
||||
hadToCreateComposerJson=0 | ||||
if [[ ! -f "${WARDEN_WEB_ROOT}/composer.json" ]]; then | ||||
hadToCreateComposerJson=1 | ||||
# Temporary workaround for auth requiring composer.json file | ||||
echo "{}" > "${WARDEN_WEB_ROOT}/composer.json" | ||||
sleep 1 # Give a second to sync | ||||
fi | ||||
warden env exec -T php-fpm composer config http-basic.repo.magento.com "$composerPublicKey" "$composerPrivateKey" | ||||
if [[ ${hadToCreateComposerJson} == 1 ]]; then | ||||
rm ${WARDEN_WEB_ROOT}/composer.json | ||||
sleep 1 # Give a second to sync | ||||
fi | ||||
fi | ||||
fi | ||||
|
||||
## wait for mariadb to start listening for connections | ||||
warden shell -c "while ! nc -z db 3306 </dev/null; do sleep 2; done" | ||||
|
||||
if [[ ${CLEAN_INSTALL} ]] && [[ ! -f "${WARDEN_WEB_ROOT}/composer.json" ]]; then | ||||
:: Installing meta-package | ||||
warden env exec -T php-fpm composer create-project -q --no-interaction --prefer-dist --no-install \ | ||||
--repository-url=https://repo.magento.com/ "${META_PACKAGE}" /tmp/create-project "${META_VERSION}" | ||||
# Was having a weird issue here where auth.json just would not work, kept getting 404. COMPOSER_AUTH export is workaround | ||||
warden env exec -T php-fpm /bin/bash -c "export COMPOSER_AUTH=\"\$(cat auth.json)\" && composer create-project -q --no-interaction --prefer-dist --no-install --repository=https://repo.magento.com/ \"${META_PACKAGE}\" /tmp/create-project \"${META_VERSION}\"" | ||||
warden env exec -T php-fpm rsync -a /tmp/create-project/ /var/www/html/ | ||||
fi | ||||
|
||||
:: Installing dependencies | ||||
warden env exec -T php-fpm bash \ | ||||
-c '[[ $(composer -V | cut -d\ -f3 | cut -d. -f1) == 2 ]] || composer global require hirak/prestissimo' | ||||
warden env exec -T php-fpm composer install | ||||
|
||||
## import database only if --skip-db-import is not specified | ||||
|
@@ -218,7 +239,7 @@ elif [[ ${CLEAN_INSTALL} ]]; then | |||
|
||||
INSTALL_FLAGS="${INSTALL_FLAGS} \ | ||||
--cleanup-database \ | ||||
--backend-frontname=backend \ | ||||
--backend-frontname=admin \ | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should probably pair with an issue in the docs repo to update the references to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also requires update to line 29
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should update this repo's readme.md table for AdminURLs all reference backend as well. |
||||
--db-host=db \ | ||||
--db-name=magento \ | ||||
--db-user=magento \ | ||||
|
@@ -278,7 +299,7 @@ OTPAUTH_QRI= | |||
if test $(version $(warden env exec -T php-fpm bin/magento -V | awk '{print $3}')) -ge $(version 2.4.0); then | ||||
TFA_SECRET=$(warden env exec -T php-fpm pwgen -A1 128) | ||||
TFA_SECRET=$( | ||||
warden env exec -T php-fpm python -c "import base64; print base64.b32encode('${TFA_SECRET}')" | sed 's/=*$//' | ||||
warden env exec -T php-fpm python3 -c "import base64; print(base64.b32encode(bytearray('${TFA_SECRET}', 'ascii')).decode('utf-8'))" | sed 's/=*$//' | ||||
) | ||||
OTPAUTH_URL=$(printf "otpauth://totp/%s%%3Alocaladmin%%40example.com?issuer=%s&secret=%s" \ | ||||
"${TRAEFIK_SUBDOMAIN}.${TRAEFIK_DOMAIN}" "${TRAEFIK_SUBDOMAIN}.${TRAEFIK_DOMAIN}" "${TFA_SECRET}" | ||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will be nice if the script automatic check the .env file and identify if it set elasticsearch or opensearch as search engine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add elasticsearch setup parameters to INSTALL_FLAGS