Skip to content

Commit

Permalink
Add new binary command
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolas Verhoye committed Oct 17, 2023
1 parent ed64164 commit 01d553c
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ mkdir -p ~/Sites/magento
cd $_

# Download the Docker Compose template:
curl -s https://raw.githubusercontent.com/markshust/docker-magento/master/lib/template | bash
curl -s https://raw.githubusercontent.com/nverhoye/docker-magento/master/lib/template | bash

# Download the version of Magento you want to use with:
bin/download 2.4.6-p2 community
Expand Down
37 changes: 37 additions & 0 deletions compose/bin/copydbfromprod
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash
# exit when any command fails
set -e
# shellcheck source=../env/db.env
source env/db.env
#shellcheck source=../env/magento.env
source env/magento.env

DUMP_FILENAME='dump.prd.sql'

echo "[1/8] Download production database"
magento-cloud db:dump -e production -p byjboicjj3sfg -r database -f $DUMP_FILENAME

echo "[2/8] Rewrite TRIGGER CREATION"
sed -i -- 's/\/\*!50003 CREATE\*\/ \/\*!50017 DEFINER=`byjboicjj3sfg`@`%`\*\/ \/\*!50003/CREATE/g' $DUMP_FILENAME
sed -i -- 's/END \*\/;;/END ;;/g' $DUMP_FILENAME

echo "[3/8] Replace byjboicjj3sfg reference name in dump"
sed -i -- 's/byjboicjj3sfg/magento/g' $DUMP_FILENAME
sed -i -- 's/CURRENT_USER/`magento`@`%`/g' $DUMP_FILENAME

echo "[4/8] Push dump file to container"
mv dump.prd.sql src
bin/copytocontainer $DUMP_FILENAME

echo "[5/8] Import database into container"
bin/n98-magerun2 db:import $DUMP_FILENAME --drop

echo "[6/8] Fix patch_list table (weird AmastyGroupedOptions issue)"
bin/n98-magerun2 db:query 'INSERT INTO patch_list (patch_name) VALUES ("Amasty\\GroupedOptions\\Setup\\Patch\\DeclarativeSchemaApplyBefore\\RenameTables");'

echo "[7/8] Set developer mode"
bin/magento deploy:mode:set developer
bin/magento security:recaptcha:disable-for-user-login

echo "[8/8] Set local configurations"
bin/magento app:config:import -n
2 changes: 1 addition & 1 deletion lib/template
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
git init -qqq
git remote add origin https://github.com/markshust/docker-magento
git remote add origin https://github.com/nverhoye/docker-magento
git fetch origin -qqq
git checkout origin/master -- compose
mv compose/* ./
Expand Down

0 comments on commit 01d553c

Please sign in to comment.