Compare commits
11 Commits
15a30eaa78
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 1bd264478c | |||
| ed6c2ee369 | |||
| bac03305bd | |||
| e5f35243e4 | |||
| 0b25140481 | |||
| 51c4dc0b8b | |||
| 2d56599c73 | |||
| 9c0d583c8d | |||
| bc7443dc86 | |||
| b187f6d342 | |||
| 2c9b6efedc |
18
grav/quick/_settings.sh.example
Normal file
18
grav/quick/_settings.sh.example
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
|
||||||
|
export TMP_DIR=$SCRIPT_DIR/tmp
|
||||||
|
|
||||||
|
DIRS=(
|
||||||
|
cache
|
||||||
|
logs
|
||||||
|
user/config
|
||||||
|
user/data
|
||||||
|
user/accounts
|
||||||
|
user/pages
|
||||||
|
user/themes/quark/images
|
||||||
|
tmp
|
||||||
|
backup
|
||||||
|
images
|
||||||
|
assets
|
||||||
|
)
|
||||||
87
grav/quick/restore-perms.sh.example
Normal file
87
grav/quick/restore-perms.sh.example
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
|
||||||
|
. "${SCRIPT_DIR}/_settings.sh" || {
|
||||||
|
echo "no settings" && exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
export WEB_GID=33
|
||||||
|
export DIRS_MODE=775
|
||||||
|
export FILES_MODE=664
|
||||||
|
|
||||||
|
echo -n "Check sudo permissions... "
|
||||||
|
|
||||||
|
sudo whoami
|
||||||
|
|
||||||
|
[ ! -d "$TMP_DIR" ] && {
|
||||||
|
echo "no tmp dir" && exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
perms() {
|
||||||
|
TARGET=$1
|
||||||
|
|
||||||
|
chmodFromFile() {
|
||||||
|
MODE=$1
|
||||||
|
FILE_LIST_FILE=$2
|
||||||
|
|
||||||
|
# shellcheck disable=SC2046
|
||||||
|
# shellcheck disable=SC2006
|
||||||
|
chmod "$MODE" `cat "$FILE_LIST_FILE"`
|
||||||
|
}
|
||||||
|
|
||||||
|
export -f chmodFromFile
|
||||||
|
|
||||||
|
echo -n "Set correct ownerships for $(basename ${TARGET})... "
|
||||||
|
sudo chown -R $UID:$WEB_GID "${TARGET}"
|
||||||
|
|
||||||
|
if [[ -d "${TARGET}" ]]; then
|
||||||
|
# echo -n "and fixing permissions for these directory... "
|
||||||
|
# echo "Fetching dirs without spaces"
|
||||||
|
find "${TARGET}" -type d -not \( -path *${THEME}/dist* -o -path */node_modules* \) | grep -v ' ' > $TMP_DIR/dirs-without-spaces
|
||||||
|
|
||||||
|
# echo "Splitting dirs by 10000 lines"
|
||||||
|
split -l 10000 $TMP_DIR/dirs-without-spaces $TMP_DIR/dirs-without-spaces-part-
|
||||||
|
|
||||||
|
# echo "Fetching files without spaces"
|
||||||
|
find "${TARGET}" -type f -not \( -path *${THEME}/dist* -o -path */node_modules* \) | grep -v ' ' > $TMP_DIR/files-without-spaces
|
||||||
|
|
||||||
|
# echo "Splitting files at 10000 lines"
|
||||||
|
split -l 10000 $TMP_DIR/files-without-spaces $TMP_DIR/files-without-spaces-part-
|
||||||
|
|
||||||
|
# echo "Fetching dirs with spaces"
|
||||||
|
find "${TARGET}" -type d -not \( -path *${THEME}/dist* -o -path */node_modules* \) | grep ' ' > $TMP_DIR/dirs-with-spaces
|
||||||
|
|
||||||
|
# echo "Fetching files with spaces"
|
||||||
|
find "${TARGET}" -type f -not \( -path *${THEME}/dist* -o -path */node_modules* \) | grep ' ' > $TMP_DIR/files-with-spaces
|
||||||
|
|
||||||
|
# echo "Fixing permissions for dirs"
|
||||||
|
# shellcheck disable=SC2038
|
||||||
|
# shellcheck disable=SC2016
|
||||||
|
find $TMP_DIR/ -maxdepth 1 -type f -name "dirs-without-spaces-part-*" | xargs -I {} bash -c 'chmodFromFile $DIRS_MODE {}'
|
||||||
|
|
||||||
|
# echo "Fixing permissions for files"
|
||||||
|
# shellcheck disable=SC2038
|
||||||
|
# shellcheck disable=SC2016
|
||||||
|
find $TMP_DIR/ -maxdepth 1 -type f -name "files-without-spaces-part-*" | xargs -I {} bash -c 'chmodFromFile $FILES_MODE {}'
|
||||||
|
|
||||||
|
# echo "Fixing permissions for dirs with spaces"
|
||||||
|
cat $TMP_DIR/dirs-with-spaces | xargs -I {} chmod $DIRS_MODE "{}"
|
||||||
|
|
||||||
|
# echo "Fixing permissions for files with spaces"
|
||||||
|
cat $TMP_DIR/files-with-spaces | xargs -I {} chmod $FILES_MODE "{}"
|
||||||
|
|
||||||
|
# echo "Removing temporary files"
|
||||||
|
rm $TMP_DIR/files-*
|
||||||
|
rm $TMP_DIR/dirs-*
|
||||||
|
echo "ok"
|
||||||
|
else
|
||||||
|
echo -n "and fixing permission for this file... "
|
||||||
|
# echo "Fixing permissions"
|
||||||
|
chmod $FILES_MODE "${TARGET}"
|
||||||
|
echo "ok"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
for DIR in "${DIRS[@]}"; do
|
||||||
|
perms "$SCRIPT_DIR/../$DIR"
|
||||||
|
done
|
||||||
@ -1,14 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
||||||
|
|
||||||
export TMP_DIR=$SCRIPT_DIR/tmp
|
|
||||||
|
|
||||||
export PROJECT_NAME=wpstudio
|
|
||||||
export PROJECT_WEB_ROOT="${SCRIPT_DIR}/.."
|
|
||||||
|
|
||||||
export TABLE_PREFIX="wp_"
|
|
||||||
|
|
||||||
export PROD_DOMAIN=wpstudio.ru
|
|
||||||
export LOCAL_DOMAIN=wpstudio.local.wpstudio.ru
|
|
||||||
|
|
||||||
export THEME=nicol
|
|
||||||
1
server/quick/sync-old-prod/.gitignore
vendored
Normal file
1
server/quick/sync-old-prod/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
*.sh
|
||||||
4
server/quick/sync-old-prod/_settings.sh.example
Normal file
4
server/quick/sync-old-prod/_settings.sh.example
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
REMOTE_SSH_USER=site_name
|
||||||
|
REMOTE_SSH_HOST=host_name
|
||||||
|
REMOTE_SSH_PORT=22
|
||||||
41
server/quick/sync-old-prod/sync-database.sh.example
Normal file
41
server/quick/sync-old-prod/sync-database.sh.example
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
|
||||||
|
. $SCRIPT_DIR/_settings.sh || {
|
||||||
|
echo "no settings" && exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
REMOTE_FROM_DATABASE_USERNAME=some_username
|
||||||
|
REMOTE_FROM_DATABASE_PASSWORD=some_password
|
||||||
|
REMOTE_FROM_DATABASE_NAME=some_database
|
||||||
|
|
||||||
|
DATABASE_USERNAME=site_name
|
||||||
|
DATABASE_PASSWORD='password'
|
||||||
|
DATABASE_NAME=site_name
|
||||||
|
|
||||||
|
|
||||||
|
echo -n "SSH connection verify... "
|
||||||
|
ssh $REMOTE_SSH_USER@$REMOTE_SSH_HOST -p $REMOTE_SSH_PORT "whoami"
|
||||||
|
|
||||||
|
if [[ "$?" -ne 0 ]]; then
|
||||||
|
echo "That is not ok... Abort program!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
WITHOUT_DROP_LOCAL_DB=0
|
||||||
|
|
||||||
|
if [[ ! -z "$1" ]]; then
|
||||||
|
WITHOUT_DROP_LOCAL_DB=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $WITHOUT_MAKE_DUMP -ne 1 ]]; then
|
||||||
|
echo -n "Drop and recreate local database... "
|
||||||
|
mariadb -e "DROP DATABASE \`${DATABASE_NAME}\`"
|
||||||
|
mariadb -e "CREATE DATABASE \`${DATABASE_NAME}\`"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -n "Loading database from remote server... "
|
||||||
|
ssh $REMOTE_SSH_USER@$REMOTE_SSH_HOST -p $REMOTE_SSH_PORT \
|
||||||
|
"mysqldump -u $REMOTE_FROM_DATABASE_USERNAME -p$REMOTE_FROM_DATABASE_PASSWORD $REMOTE_FROM_DATABASE_NAME | bzip2 -c" \
|
||||||
|
| pv | bzip2 -cd | mariadb -u $DATABASE_USERNAME -p''"$DATABASE_PASSWORD"'' ${DATABASE_NAME}
|
||||||
|
echo "OK"
|
||||||
14
server/quick/sync-old-prod/sync-uploads.sh.example
Normal file
14
server/quick/sync-old-prod/sync-uploads.sh.example
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
|
||||||
|
. $SCRIPT_DIR/_settings.sh || {
|
||||||
|
echo "no settings" && exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
REMOTE_FROM_DIR_PATH=some_absolute_path_without_end_slash
|
||||||
|
|
||||||
|
DESTINATION_DIR_PATH=/var/www/html/wp-content/uploads
|
||||||
|
|
||||||
|
echo -n "Upload... "
|
||||||
|
rsync -a --info=progress2 -e "ssh -p ${REMOTE_SSH_PORT}" $REMOTE_SSH_USER@$REMOTE_SSH_HOST:$REMOTE_FROM_DIR_PATH/ $DESTINATION_DIR_PATH/
|
||||||
|
echo "OK"
|
||||||
1
winter/quick/.gitignore
vendored
Normal file
1
winter/quick/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
*.sh
|
||||||
8
winter/quick/_settings.sh.example
Normal file
8
winter/quick/_settings.sh.example
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
SETTINGS_SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
|
||||||
|
# exporting variables dot not effect to visibility for other scripts - all variables is visible
|
||||||
|
|
||||||
|
export TMP_DIR=$SETTINGS_SCRIPT_DIR/tmp
|
||||||
|
|
||||||
|
export THEME=demo
|
||||||
29
winter/quick/restore-perms.sh.example
Normal file
29
winter/quick/restore-perms.sh.example
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
|
||||||
|
. "$SCRIPT_DIR/_settings.sh" || {
|
||||||
|
echo "no settings" && exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
APP_DIR="${SCRIPT_DIR}/.."
|
||||||
|
|
||||||
|
PLUGINS=(winter)
|
||||||
|
THEME_DIRS=(layouts pages partials)
|
||||||
|
export WEB_GID=33
|
||||||
|
|
||||||
|
perms() {
|
||||||
|
sudo chown -R $UID:$WEB_GID "$1"
|
||||||
|
|
||||||
|
sudo chmod -R g+rwx "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
perms "${APP_DIR}/storage"
|
||||||
|
perms "${APP_DIR}/bootstrap/cache"
|
||||||
|
|
||||||
|
for DIR in "${THEME_DIRS[@]}"; do
|
||||||
|
perms "${APP_DIR}/themes/$THEME/$DIR"
|
||||||
|
done
|
||||||
|
|
||||||
|
for DIR in "${PLUGINS[@]}"; do
|
||||||
|
perms "${APP_DIR}/plugins/$DIR"
|
||||||
|
done
|
||||||
1
wordpress/quick/.gitignore
vendored
Normal file
1
wordpress/quick/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
*.sh
|
||||||
@ -0,0 +1,50 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
git fetch origin --prune
|
||||||
|
|
||||||
|
export LANG=en_US.UTF-8
|
||||||
|
|
||||||
|
LOCAL_BRANCHES_IN_DEVELOP=( $(git branch --merged develop --format "%(refname:short)") )
|
||||||
|
|
||||||
|
LOCAL_BRANCHES_WITHOUT_UPSTREAM=( $(git branch --format "%(refname:short) %(upstream) %(upstream:track)" | grep -vE "(develop|master)" | awk '{if ($3 == "[gone]" || !$2) print $1;}') )
|
||||||
|
|
||||||
|
if [ ${#LOCAL_BRANCHES_WITHOUT_UPSTREAM[@]} -eq 0 ]; then
|
||||||
|
echo "Нет веток без remote"
|
||||||
|
else
|
||||||
|
LOCAL_BRANCHES_WITHOUT_UPSTREAM_AND_MERGED_INTO_DEVELOP=()
|
||||||
|
|
||||||
|
for BRANCH_WITHOUT_UPSTREAM in "${LOCAL_BRANCHES_WITHOUT_UPSTREAM[@]}"; do
|
||||||
|
for BRANCH_MERGED_IN_DEVELOP in "${LOCAL_BRANCHES_IN_DEVELOP[@]}"; do
|
||||||
|
if [ "$BRANCH_WITHOUT_UPSTREAM" == "$BRANCH_MERGED_IN_DEVELOP" ]; then
|
||||||
|
LOCAL_BRANCHES_WITHOUT_UPSTREAM_AND_MERGED_INTO_DEVELOP+=( "$BRANCH_WITHOUT_UPSTREAM" )
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ ${#LOCAL_BRANCHES_WITHOUT_UPSTREAM_AND_MERGED_INTO_DEVELOP[@]} -ne 0 ]; then
|
||||||
|
echo "Ветки без remote и вмерженные в develop"
|
||||||
|
# echo "${LOCAL_BRANCHES_WITHOUT_UPSTREAM_AND_MERGED_INTO_DEVELOP[@]}" | tr " " "\n"
|
||||||
|
echo "${LOCAL_BRANCHES_WITHOUT_UPSTREAM_AND_MERGED_INTO_DEVELOP[@]}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
LOCAL_BRANCHES_WITHOUT_UPSTREAM_AND_NOT_MERGED_INTO_DEVELOP=()
|
||||||
|
|
||||||
|
for BRANCH_WITHOUT_UPSTREAM in "${LOCAL_BRANCHES_WITHOUT_UPSTREAM[@]}"; do
|
||||||
|
BRANCH_IS_MERGED_INTO_DEVELOP=0
|
||||||
|
for BRANCH_MERGED_IN_DEVELOP in "${LOCAL_BRANCHES_IN_DEVELOP[@]}"; do
|
||||||
|
if [ "$BRANCH_WITHOUT_UPSTREAM" == "$BRANCH_MERGED_IN_DEVELOP" ] ; then
|
||||||
|
BRANCH_IS_MERGED_INTO_DEVELOP=1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ $BRANCH_IS_MERGED_INTO_DEVELOP -eq 0 ]; then
|
||||||
|
LOCAL_BRANCHES_WITHOUT_UPSTREAM_AND_NOT_MERGED_INTO_DEVELOP+=( "$BRANCH_WITHOUT_UPSTREAM" )
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ ${#LOCAL_BRANCHES_WITHOUT_UPSTREAM_AND_NOT_MERGED_INTO_DEVELOP[@]} -ne 0 ]; then
|
||||||
|
echo "Ветки без remote, но еще не вмерженные в develop"
|
||||||
|
# echo "${LOCAL_BRANCHES_WITHOUT_UPSTREAM_AND_NOT_MERGED_INTO_DEVELOP[@]}" | tr " " "\n"
|
||||||
|
echo "${LOCAL_BRANCHES_WITHOUT_UPSTREAM_AND_NOT_MERGED_INTO_DEVELOP[@]}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
31
wordpress/quick/restore-perms-light.sh.example
Normal file
31
wordpress/quick/restore-perms-light.sh.example
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
|
||||||
|
WP_CONTENT_DIRS=(
|
||||||
|
plugins
|
||||||
|
upgrade
|
||||||
|
uploads
|
||||||
|
themes
|
||||||
|
)
|
||||||
|
|
||||||
|
export WEB_GID=33
|
||||||
|
|
||||||
|
perms() {
|
||||||
|
sudo chown -R $UID:$WEB_GID "$1"
|
||||||
|
sudo chmod -R g+rwx "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
permsFile() {
|
||||||
|
sudo chown $UID:$WEB_GID "$1"
|
||||||
|
sudo chmod g+rw "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
for DIR in "${WP_CONTENT_DIRS[@]}"; do
|
||||||
|
DIR="$SCRIPT_DIR/../wp-content/$DIR"
|
||||||
|
|
||||||
|
if [[ -f $DIR ]]; then
|
||||||
|
permsFile "$DIR"
|
||||||
|
else
|
||||||
|
perms "$DIR"
|
||||||
|
fi
|
||||||
|
done
|
||||||
@ -14,19 +14,36 @@ WP_CONTENT_DIRS=(
|
|||||||
)
|
)
|
||||||
|
|
||||||
export WEB_GID=33
|
export WEB_GID=33
|
||||||
|
export DIRS_MODE=775
|
||||||
|
export FILES_MODE=664
|
||||||
|
|
||||||
echo -n "Check sudo permissions... "
|
echo -n "Check sudo permissions... "
|
||||||
|
|
||||||
sudo whoami
|
sudo whoami
|
||||||
|
|
||||||
|
[ ! -d "$TMP_DIR" ] && {
|
||||||
|
echo "no tmp dir" && exit 1
|
||||||
|
}
|
||||||
|
|
||||||
perms() {
|
perms() {
|
||||||
TARGET=$1
|
TARGET=$1
|
||||||
|
|
||||||
|
chmodFromFile() {
|
||||||
|
MODE=$1
|
||||||
|
FILE_LIST_FILE=$2
|
||||||
|
|
||||||
|
# shellcheck disable=SC2046
|
||||||
|
# shellcheck disable=SC2006
|
||||||
|
chmod "$MODE" `cat "$FILE_LIST_FILE"`
|
||||||
|
}
|
||||||
|
|
||||||
|
export -f chmodFromFile
|
||||||
|
|
||||||
echo -n "Set correct ownerships for $(basename ${TARGET})... "
|
echo -n "Set correct ownerships for $(basename ${TARGET})... "
|
||||||
sudo chown -R $UID:$WEB_GID "${TARGET}"
|
sudo chown -R $UID:$WEB_GID "${TARGET}"
|
||||||
|
|
||||||
if [[ -d "${TARGET}" ]]; then
|
if [[ -d "${TARGET}" ]]; then
|
||||||
echo -n "and fixing permission for this directory... "
|
# echo -n "and fixing permissions for these directory... "
|
||||||
# echo "Fetching dirs without spaces"
|
# echo "Fetching dirs without spaces"
|
||||||
find "${TARGET}" -type d -not \( -path *${THEME}/dist* -o -path */node_modules* \) | grep -v ' ' > $TMP_DIR/dirs-without-spaces
|
find "${TARGET}" -type d -not \( -path *${THEME}/dist* -o -path */node_modules* \) | grep -v ' ' > $TMP_DIR/dirs-without-spaces
|
||||||
|
|
||||||
@ -48,18 +65,18 @@ perms() {
|
|||||||
# echo "Fixing permissions for dirs"
|
# echo "Fixing permissions for dirs"
|
||||||
# shellcheck disable=SC2038
|
# shellcheck disable=SC2038
|
||||||
# shellcheck disable=SC2016
|
# shellcheck disable=SC2016
|
||||||
find $TMP_DIR/ -maxdepth 1 -type f -name "dirs-without-spaces-part-*" | xargs -I {} bash -c 'chmod 774 `cat {}`'
|
find $TMP_DIR/ -maxdepth 1 -type f -name "dirs-without-spaces-part-*" | xargs -I {} bash -c 'chmodFromFile $DIRS_MODE {}'
|
||||||
|
|
||||||
# echo "Fixing permissions for files"
|
# echo "Fixing permissions for files"
|
||||||
# shellcheck disable=SC2038
|
# shellcheck disable=SC2038
|
||||||
# shellcheck disable=SC2016
|
# shellcheck disable=SC2016
|
||||||
find $TMP_DIR/ -maxdepth 1 -type f -name "files-without-spaces-part-*" | xargs -I {} bash -c 'chmod 664 `cat {}`'
|
find $TMP_DIR/ -maxdepth 1 -type f -name "files-without-spaces-part-*" | xargs -I {} bash -c 'chmodFromFile $FILES_MODE {}'
|
||||||
|
|
||||||
# echo "Fixing permissions for dirs with spaces"
|
# echo "Fixing permissions for dirs with spaces"
|
||||||
cat $TMP_DIR/dirs-with-spaces | xargs -I {} chmod 775 "{}"
|
cat $TMP_DIR/dirs-with-spaces | xargs -I {} chmod $DIRS_MODE "{}"
|
||||||
|
|
||||||
# echo "Fixing permissions for files with spaces"
|
# echo "Fixing permissions for files with spaces"
|
||||||
cat $TMP_DIR/files-with-spaces | xargs -I {} chmod 664 "{}"
|
cat $TMP_DIR/files-with-spaces | xargs -I {} chmod $FILES_MODE "{}"
|
||||||
|
|
||||||
# echo "Removing temporary files"
|
# echo "Removing temporary files"
|
||||||
rm $TMP_DIR/files-*
|
rm $TMP_DIR/files-*
|
||||||
@ -68,7 +85,7 @@ perms() {
|
|||||||
else
|
else
|
||||||
echo -n "and fixing permission for this file... "
|
echo -n "and fixing permission for this file... "
|
||||||
# echo "Fixing permissions"
|
# echo "Fixing permissions"
|
||||||
chmod 664 "${TARGET}"
|
chmod $FILES_MODE "${TARGET}"
|
||||||
echo "ok"
|
echo "ok"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -77,4 +94,4 @@ for DIR in "${WP_CONTENT_DIRS[@]}"; do
|
|||||||
perms "$SCRIPT_DIR/../wp-content/$DIR"
|
perms "$SCRIPT_DIR/../wp-content/$DIR"
|
||||||
done
|
done
|
||||||
|
|
||||||
perms "$SCRIPT_DIR/../wp-content/index.php"
|
#perms "$SCRIPT_DIR/../wp-content/index.php"
|
||||||
24
wordpress/quick/settings.sh.example
Normal file
24
wordpress/quick/settings.sh.example
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
SETTINGS_SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
|
||||||
|
export TMP_DIR=$SETTINGS_SCRIPT_DIR/tmp
|
||||||
|
|
||||||
|
export PROJECT_NAME=wpstudio
|
||||||
|
export PROJECT_WEB_ROOT="${SETTINGS_SCRIPT_DIR}/.."
|
||||||
|
|
||||||
|
export TABLE_PREFIX="wp_"
|
||||||
|
|
||||||
|
export PROD_DOMAIN=wpstudio.ru
|
||||||
|
export LOCAL_DOMAIN=wpstudio.local.wpstudio.ru
|
||||||
|
|
||||||
|
export THEME=nicol
|
||||||
|
|
||||||
|
export SSH_PORT=22
|
||||||
|
|
||||||
|
export SSH_PROD_USERNAME=wpstudio
|
||||||
|
export SSH_PROD_SERVER=wpstudio.ru
|
||||||
|
|
||||||
|
export PROD_DATABASE_NAME=wpstudio
|
||||||
|
export LOCAL_DATABASE_NAME=wpstudio
|
||||||
|
|
||||||
|
export REMOTE_SITE_DIR=/var/www/html
|
||||||
4
wordpress/quick/sync/.my.cnf.example
Normal file
4
wordpress/quick/sync/.my.cnf.example
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
# Place on remote server to home dir
|
||||||
|
[client]
|
||||||
|
user = wpstudio
|
||||||
|
password = PASSWORD
|
||||||
@ -0,0 +1,24 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
|
||||||
|
. "${SCRIPT_DIR}/../settings.sh" || {
|
||||||
|
echo "no settings" && exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
CONTAINER=$(docker ps | grep mariadb | awk '{print $1}')
|
||||||
|
|
||||||
|
if [[ -z "${CONTAINER}" ]]; then
|
||||||
|
echo "Unable to find container: db"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
MYSQL_CMD="docker exec -i ${CONTAINER} mariadb -u root -p123456"
|
||||||
|
|
||||||
|
echo -n "Drop and recreate ${LOCAL_DATABASE_NAME} database... "
|
||||||
|
bash -c "${MYSQL_CMD} -e 'DROP DATABASE \`${LOCAL_DATABASE_NAME}\`'"
|
||||||
|
bash -c "${MYSQL_CMD} -e 'CREATE DATABASE \`${LOCAL_DATABASE_NAME}\`'"
|
||||||
|
echo "OK"
|
||||||
|
|
||||||
|
echo -n "Importing prod dump data from $SSH_PROD_SERVER ... "
|
||||||
|
ssh -C ${SSH_PROD_USERNAME}@${SSH_PROD_SERVER} "mariadb-dump --defaults-extra-file=/home/${SSH_PROD_USERNAME}/.my.cnf ${PROD_DATABASE_NAME} | sed '1d'" | pv | bash -c "${MYSQL_CMD} ${LOCAL_DATABASE_NAME}"
|
||||||
|
echo "OK"
|
||||||
@ -0,0 +1,27 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
|
||||||
|
. "${SCRIPT_DIR}/../settings.sh" || {
|
||||||
|
echo "no settings" && exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
UPLOAD_DIR="wp-content/uploads"
|
||||||
|
|
||||||
|
SOURCE_UPLOADS_PATH="${REMOTE_SITE_DIR}/${UPLOAD_DIR}"
|
||||||
|
|
||||||
|
DESTINATION_UPLOADS_PATH=$(realpath "${SCRIPT_DIR}/../../${UPLOAD_DIR}")
|
||||||
|
|
||||||
|
if [ -z "$DESTINATION_UPLOADS_PATH" ]; then
|
||||||
|
echo "DESTINATION_UPLOADS_PATH is empty" && exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
CMD="rsync -a --info=progress2 $SSH_PROD_USERNAME@$SSH_PROD_SERVER:$SOURCE_UPLOADS_PATH/ $DESTINATION_UPLOADS_PATH/"
|
||||||
|
|
||||||
|
# shellcheck disable=SC2145
|
||||||
|
echo "Execute: ${CMD}"
|
||||||
|
read -p "Are you sure? " -n 1 -r
|
||||||
|
echo # (optional) move to a new line
|
||||||
|
if [[ $REPLY =~ ^[Yy]$ ]]
|
||||||
|
then
|
||||||
|
/bin/bash -c "${CMD}"
|
||||||
|
fi
|
||||||
2
wordpress/quick/tmp/.gitignore
vendored
Normal file
2
wordpress/quick/tmp/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
*
|
||||||
|
!.gitignore
|
||||||
2
wordpress/wp-content/upgrade/.gitignore
vendored
Normal file
2
wordpress/wp-content/upgrade/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
*
|
||||||
|
!.gitignore
|
||||||
2
wordpress/wp-content/uploads/.gitignore
vendored
Normal file
2
wordpress/wp-content/uploads/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
*
|
||||||
|
!.gitignore
|
||||||
Reference in New Issue
Block a user