Skip to content

Commit

Permalink
add fix
Browse files Browse the repository at this point in the history
  • Loading branch information
bagart committed Feb 16, 2019
1 parent b1480a4 commit 0fc6778
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 21 deletions.
22 changes: 3 additions & 19 deletions .laradock/rebuild.sh
Original file line number Diff line number Diff line change
@@ -1,29 +1,13 @@
#! /bin/bash
. "`dirname $0`/init.sh"
echo "---------- Laradock rebuild: $LARADOCKENV_PROJECT_NAME ----------"
echo "---------- Laradock rebuild $1 $2 $3: $LARADOCKENV_PROJECT_NAME ----------"

LaraDock_DBG=1;
if [[ "$1" == "--silence" || "$2" == "--silence" ]]; then
if [[ "$1" == "--silence" || "$2" == "--silence" || "$3" == "--silence" ]]; then
LaraDock_DBG=0;
fi
LaraDock_STOP=1;
if [[ "$1" == "--stopped" || "$2" == "--stopped" ]]; then
LaraDock_STOP=0;
fi

cd $LARADOCK_PATH
if [[ "$LaraDock_STOP" == "1" ]]; then
docker-compose stop
fi
docker-compose rm -f
rm -rf .data
LaraDock_PARAM='cat'
if [[ "$LaraDock_DBG" == "0" ]]; then
LaraDock_PARAM='grep -v ^\s---'
fi
echo ---------- rebuild: $LARADOCK_PROJECT_SERVICES ----------
docker-compose build --pull $LARADOCK_PROJECT_SERVICES | $LaraDock_PARAM
cd $PROJECT_PATH
$LARADOCKENV_PATH/.laradock/rebuild_containers.sh $1 $2 $3

$LARADOCKENV_PATH/up.sh -
$LARADOCKENV_PATH/app/install-db-seed.sh
Expand Down
40 changes: 40 additions & 0 deletions .laradock/rebuild_containers.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#! /bin/bash
. "`dirname $0`/init.sh"
echo "---------- Laradock rebuild: $LARADOCKENV_PROJECT_NAME ----------"

LaraDock_DBG=1;
if [[ "$1" == "--silence" || "$2" == "--silence" || "$3" == "--silence" ]]; then
LaraDock_DBG=0;
fi

LaraDock_STOP=1;
if [[ "$1" == "--stopped" || "$2" == "--stopped" || "$3" == "--stopped" ]]; then
LaraDock_STOP=0;
fi

LaraDock_FIX=0;
if [[ "$1" == "--fix" || "$2" == "--fix" || "$3" == "--fix" ]]; then
LaraDock_FIX=1;
fi

cd $LARADOCK_PATH
if [[ "$LaraDock_STOP" == "1" ]]; then
docker-compose stop
fi
docker-compose rm -f
rm -rf .data

LaraDock_PARAM='cat'
if [[ "$LaraDock_DBG" == "0" ]]; then
LaraDock_PARAM='grep -v ^\s---'
fi

LaraDockEnv_BUILD_PARAM=''
if [[ "$LaraDock_FIX" == "1" ]]; then
# VERY SLOW
LaraDockEnv_BUILD_PARAM=' --no-cache '
fi

echo ---------- rebuild$LaraDockEnv_BUILD_PARAM: $LARADOCK_PROJECT_SERVICES ----------
docker-compose build $LaraDockEnv_BUILD_PARAM --pull $LARADOCK_PROJECT_SERVICES | $LaraDock_PARAM
cd $PROJECT_PATH
4 changes: 4 additions & 0 deletions fix.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#! /bin/bash
. `dirname $0`/.laradock/init.sh

$LARADOCKENV_PATH/.laradock/rebuild.sh --fix
3 changes: 2 additions & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ echo "---------- Laradock Install: $LARADOCKENV_PROJECT_NAME ----------"
$LARADOCKENV_PATH/.laradock/upgrade.sh
$LARADOCKENV_PATH/.laradock/dotenv_rebuild.sh
$LARADOCKENV_PATH/.laradock/customize.sh
$LARADOCKENV_PATH/.laradock/rebuild.sh --silence --stopped

$LARADOCKENV_PATH/.laradock/rebuild.sh --silence --stopped $1
14 changes: 13 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@ Laradock ENV is a wrapper with command tools for build AND management of [Larado
- Start Laradock
- Build backend with php composer and artisan DB (migration and seed)

`./fix.sh` - Fix most of problems with any containers
- stop, rm, pull, rebuild without cache
- very slow
Benchmark: .laradock/rebuild_containers.sh, run two times
* windows:
- `time laradock/.laradock/rebuild_containers.sh`: 28 -> 15 sec
- `time laradock/.laradock/rebuild_containers.sh`: 9m 2sec
* windows --fix: 28sec

`./conn.sh $service` - Connect to Laradock service terminal by name
`./conn.sh workspace` - Connect to workspace terminal with laradock user
`./conn.sh workspace root` - Connect to workspace terminal with root user
Expand All @@ -35,6 +44,7 @@ Laradock ENV is a wrapper with command tools for build AND management of [Larado
`./app/purge-postgres.sh` - Purge Postgres DB
`./app/purge-beanstalkd.sh` - Purge BeanstalkD with consistent storage

`.laradock/*.sh` - Laradock Env internal utils
`.laradock/uninstall.sh` - Laradock uninstall with container purge

# Structure
Expand All @@ -55,7 +65,8 @@ Important: You can change "Laradock ENV" path with `.env` config
│ │ ├── .laradock # Laradock_env internal utils
│ │ │ ├── customize.sh # Example with customize laradock. Not used in this package
│ │ │ ├── env.sh # Prepare env
│ │ │ ├── rebuild.sh # Rebuild all containers and prepare DB migration with seed
│ │ │ ├── rebuild.sh # Renew all containers and prepare APP (migration, seeds)
│ │ │ ├── rebuild_containers.sh # Renew all containers
│ │ │ ├── uninstall.sh # Uninstall Laradock and remove containers and DB state
│ │ │ └── upgrade.sh # Upgrade Laradock or load actual version
│ │ ├── app # Laradock command for application
Expand All @@ -65,6 +76,7 @@ Important: You can change "Laradock ENV" path with `.env` config
│ │ ├── conn # Connect to containera
│ │ │ └── *.sh # Connection with different containers terminal
│ │ │ └── workspace.sh # Application workspace bash
│ │ ├── fix.sh # Fix most of problems with any containers
│ │ ├── install.sh # Prepare last laradock version
│ │ ├── LICENSE # MIT LICENSE
│ │ ├── logs.sh # Laradock Logs
Expand Down

0 comments on commit 0fc6778

Please sign in to comment.