Working sync-from-live
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
a9b655e04f
commit
2e30e12488
@ -2,6 +2,10 @@
|
|||||||
# REQUIRED SETTINGS (you will need these) #
|
# REQUIRED SETTINGS (you will need these) #
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
|
# run `make fetch_db_info` to find these out
|
||||||
|
DB_USER=
|
||||||
|
DB_PASSWORD=
|
||||||
|
DB_NAME=
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
# COMMON SETTINGS (you may need these) #
|
# COMMON SETTINGS (you may need these) #
|
||||||
@ -37,5 +41,10 @@ PROJECT_NAME=mont58
|
|||||||
# Site URL, also just needs to be set once per project
|
# Site URL, also just needs to be set once per project
|
||||||
SITE_URL=mont58-staging.smol-wp.autonomic.zone
|
SITE_URL=mont58-staging.smol-wp.autonomic.zone
|
||||||
|
|
||||||
|
SSH_USER=autonomic
|
||||||
|
SSH_HOST=web1.mont58coffee.com
|
||||||
|
SSH_PATH=/var/www/production.mont58coffee.com/web/
|
||||||
|
SSH_PORT=22
|
||||||
|
|
||||||
# Multi-site config
|
# Multi-site config
|
||||||
#WORDPRESS_CONFIG_EXTRA="define('MULTISITE', true); define('SUBDOMAIN_INSTALL', true); define('DOMAIN_CURRENT_SITE', 'frms.localhost'); define('PATH_CURRENT_SITE', '/'); define('SITE_ID_CURRENT_SITE', 1); define('BLOG_ID_CURRENT_SITE', 1); define('SUNRISE', true);"
|
#WORDPRESS_CONFIG_EXTRA="define('MULTISITE', true); define('SUBDOMAIN_INSTALL', true); define('DOMAIN_CURRENT_SITE', 'frms.localhost'); define('PATH_CURRENT_SITE', '/'); define('SITE_ID_CURRENT_SITE', 1); define('BLOG_ID_CURRENT_SITE', 1); define('SUNRISE', true);"
|
||||||
|
@ -22,12 +22,14 @@ services:
|
|||||||
- WORDPRESS_DB_NAME=wordpress
|
- WORDPRESS_DB_NAME=wordpress
|
||||||
- WORDPRESS_CONFIG_EXTRA=${WORDPRESS_CONFIG_EXTRA}
|
- WORDPRESS_CONFIG_EXTRA=${WORDPRESS_CONFIG_EXTRA}
|
||||||
- WORDPRESS_DEBUG=${WORDPRESS_DEBUG}
|
- WORDPRESS_DEBUG=${WORDPRESS_DEBUG}
|
||||||
|
- WORDPRESS_TABLE_PREFIX=kM7KXt7HQ_
|
||||||
- PHP_EXTENSIONS=calendar
|
- PHP_EXTENSIONS=calendar
|
||||||
- PAGER=more
|
- PAGER=more
|
||||||
container_name: "${PROJECT_NAME}_wordpress"
|
container_name: "${PROJECT_NAME}_wordpress"
|
||||||
|
|
||||||
db:
|
db:
|
||||||
image: "mariadb:10.6"
|
image: "mariadb:10.6"
|
||||||
|
command: --innodb-buffer-pool-size=10G
|
||||||
volumes:
|
volumes:
|
||||||
- "${MARIADB_VOLUME:-mariadb}:/var/lib/mysql"
|
- "${MARIADB_VOLUME:-mariadb}:/var/lib/mysql"
|
||||||
networks:
|
networks:
|
||||||
|
@ -8,6 +8,8 @@ if [ -n "$PHP_EXTENSIONS" ]; then
|
|||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo 'memory_limit = 2048M' >> /usr/local/etc/php/conf.d/docker-php-memlimit.ini;
|
||||||
|
|
||||||
if ! id -u "user" >/dev/null ; then
|
if ! id -u "user" >/dev/null ; then
|
||||||
useradd -u 1000 -m user
|
useradd -u 1000 -m user
|
||||||
mkdir /var/www/html/vendor
|
mkdir /var/www/html/vendor
|
||||||
|
55
makefile
55
makefile
@ -109,14 +109,53 @@ uploads_load:
|
|||||||
## Sync wp-content from site
|
## Sync wp-content from site
|
||||||
uploads_pull: uploads_fetch uploads_load
|
uploads_pull: uploads_fetch uploads_load
|
||||||
|
|
||||||
|
fetch_db_info:
|
||||||
|
ssh -p$(SSH_PORT) $(SSH_USER)@$(SSH_HOST) grep DB $(SSH_PATH)/wp-config.php
|
||||||
|
|
||||||
## Download database from dev site
|
## Download database from dev site
|
||||||
db_fetch:
|
db_fetch:
|
||||||
$(ABRA) app run $(SITE_URL) db bash -c 'mariadb-dump -u root -p"$$(cat /run/secrets/db_root_password)" wordpress' | gzip > data/dbdump.sql.gz
|
ssh -p$(SSH_PORT) autonomic@web1.mont58coffee.com mysqldump -u $(DB_USER) -p$(DB_PASSWORD) "$(DB_NAME)" | gzip > data/dbdump.sql.gz
|
||||||
|
|
||||||
## Load latest database from ~/.abra/backups
|
## Load latest database from ~/.abra/backups
|
||||||
db_load:
|
db_load:
|
||||||
zcat data/dbdump.sql.gz | $(_DOCKER_COMPOSE) exec -T db mysql -u wordpress -pwordpress wordpress
|
zcat data/dbdump.sql.gz | $(_DOCKER_COMPOSE) exec -T db mysql -u wordpress -pwordpress wordpress
|
||||||
|
|
||||||
|
db_pull: db_fetch db_load fix_url
|
||||||
|
|
||||||
|
define SQL_HEADER
|
||||||
|
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||||
|
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||||
|
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||||
|
/*!40101 SET NAMES utf8mb4 */;
|
||||||
|
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
|
||||||
|
/*!40103 SET TIME_ZONE='+00:00' */;
|
||||||
|
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
||||||
|
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
||||||
|
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
|
||||||
|
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
|
||||||
|
endef
|
||||||
|
export SQL_HEADER
|
||||||
|
|
||||||
|
define SQL_FOOTER
|
||||||
|
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
|
||||||
|
|
||||||
|
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
||||||
|
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
||||||
|
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
|
||||||
|
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||||
|
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||||
|
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||||
|
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||||
|
endef
|
||||||
|
export SQL_FOOTER
|
||||||
|
|
||||||
|
db_convert:
|
||||||
|
gunzip data/database.sql.gz
|
||||||
|
sed -i -e 's/SERVMASK_PREFIX/wp/g' -e 's/,0x,/,0,/g' data/database.sql
|
||||||
|
echo "$$SQL_HEADER" | cat - data/database.sql > data/database_wrapped.sql
|
||||||
|
echo "$$SQL_FOOTER" >> data/database_wrapped.sql
|
||||||
|
mv data/database_wrapped.sql data/database.sql
|
||||||
|
|
||||||
## Replace site URL
|
## Replace site URL
|
||||||
fix_url:
|
fix_url:
|
||||||
$(_DOCKER_COMPOSE) exec -u user wordpress wp --url=https://$(SITE_URL) search-replace --all-tables-with-prefix 'https://$(SITE_URL)' 'http://$(PROJECT_NAME).localhost'
|
$(_DOCKER_COMPOSE) exec -u user wordpress wp --url=https://$(SITE_URL) search-replace --all-tables-with-prefix 'https://$(SITE_URL)' 'http://$(PROJECT_NAME).localhost'
|
||||||
@ -125,18 +164,8 @@ fix_url:
|
|||||||
set_local_password:
|
set_local_password:
|
||||||
$(_DOCKER_COMPOSE) exec -u user wordpress wp user update $(USERNAME) --user_pass=password
|
$(_DOCKER_COMPOSE) exec -u user wordpress wp user update $(USERNAME) --user_pass=password
|
||||||
|
|
||||||
db_pull: db_fetch db_load fix_url
|
plugins_pull:
|
||||||
|
rsync -Pavz -e 'ssh -p$(SSH_PORT)' $(SSH_USER)@$(SSH_HOST):$(SSH_PATH)/wp-content/plugins/ wp-content/plugins/
|
||||||
## Download wp-content files from site
|
|
||||||
plugins_fetch:
|
|
||||||
$(ABRA) app run --no-tty $(SITE_URL) app tar --owner=0 --group=0 --no-same-owner --no-same-permissions -czf- /var/www/html/wp-content/plugins/ > data/plugins.tar.gz
|
|
||||||
|
|
||||||
## Load latest plugins from data/plugins.tar.gz
|
|
||||||
plugins_load:
|
|
||||||
tar -C wp-content --strip-components=4 -xzf data/plugins.tar.gz
|
|
||||||
|
|
||||||
## Sync plugins from site
|
|
||||||
plugins_pull: plugins_fetch plugins_load
|
|
||||||
|
|
||||||
## Download parent theme from site
|
## Download parent theme from site
|
||||||
theme_fetch:
|
theme_fetch:
|
||||||
|
Loading…
Reference in New Issue
Block a user