Browse Source

* helper script use container-like launch logic

master
Alexander Demidov 4 years ago
parent
commit
57ebccad04
  1. 11
      bash/dump.sh
  2. 11
      bash/enter-to-workspace.sh
  3. 10
      bash/mysql.sh
  4. 10
      bash/restart-nginx.sh

11
bash/dump.sh

@ -1,4 +1,9 @@
#!/bin/bash
cd $HOME/structure
dbId=$(docker ps -q --filter name=db)
docker exec $dbId mysqldump -u root -p123456 $1 | pv > $2
CONTAINER=$(docker ps | grep db | awk '{print $1}')
if [[ -z "${CONTAINER}" ]]; then
echo "Unable to find container: db"
exit 1
fi
docker exec -ti ${CONTAINER} mysqldump -u root -p123456 $1 | pv > $2

11
bash/enter-to-workspace.sh

@ -1,16 +1,13 @@
#!/bin/bash
DIR="$(realpath $(dirname "$(readlink -f "$0")")/..)"
PHP_VERSION=$1 # Without dot
if [[ -z "${PHP_VERSION}" ]]; then PHP_VERSION=74; fi
# Grab full name of php-fpm container
WORKSPACE_CONTAINER=$(docker ps | grep workspace${PHP_VERSION} | awk '{print $1}')
CONTAINER=$(docker ps | grep workspace${PHP_VERSION} | awk '{print $1}')
if [[ -z "${WORKSPACE_CONTAINER}" ]]; then
echo "Unable to find workspace container: workspace${PHP_VERSION}"
if [[ -z "${CONTAINER}" ]]; then
echo "Unable to find container: workspace${PHP_VERSION}"
exit 1
fi
docker exec -ti ${WORKSPACE_CONTAINER} su laradock
docker exec -ti ${CONTAINER} su laradock

10
bash/mysql.sh

@ -1,3 +1,9 @@
#!/bin/bash
cd $HOME/structure
docker-compose exec db bash -c 'LANG=ru_RU.UTF-8 mysql -u root -p123456'
CONTAINER=$(docker ps | grep db | awk '{print $1}')
if [[ -z "${CONTAINER}" ]]; then
echo "Unable to find container: db"
exit 1
fi
docker exec -ti ${CONTAINER} bash -c 'LANG=ru_RU.UTF-8 mysql -u root -p123456'

10
bash/restart-nginx.sh

@ -1,3 +1,9 @@
#!/bin/bash
cd $HOME/structure
docker-compose exec web nginx -s reload
CONTAINER=$(docker ps | grep nginx | awk '{print $1}')
if [[ -z "${CONTAINER}" ]]; then
echo "Unable to find container: nginx"
exit 1
fi
docker exec -ti ${CONTAINER} nginx -s reload
Loading…
Cancel
Save