implement import mechanism
This commit is contained in:
parent
711629fea8
commit
c058e7ab05
23
Makefile
23
Makefile
|
@ -6,10 +6,16 @@ DUMP_CONN = -h 127.0.0.1 -P 3306 --user root --password=toor --ssl-verify-server
|
|||
VERSIONED_DUMP = ./assets/db/dump.sql
|
||||
TMP_PROD_DUMP = ./out/db.tmp.sql
|
||||
PROD_DUMP = ./out/dump.sql
|
||||
REMOTE_DB_DUMP = ./out/remote.dump.sql
|
||||
WWW_USER ?= 33
|
||||
WWW_GROUP ?= 33
|
||||
|
||||
dev-run:
|
||||
$(COMPOSE) up
|
||||
|
||||
dev-run-db:
|
||||
$(COMPOSE) run --rm db
|
||||
|
||||
dev-stop:
|
||||
$(COMPOSE) down
|
||||
|
||||
|
@ -19,6 +25,18 @@ dev-clean:
|
|||
dev-dump:
|
||||
mariadb-dump $(DUMP_CONN) askar > $(VERSIONED_DUMP)
|
||||
|
||||
dev-import-db:
|
||||
cat $(REMOTE_DB_DUMP) |\
|
||||
sed -e 's;$(PUBLIC_URL);http://localhost:8080;g' |\
|
||||
grep -v -E '^/\*' |\
|
||||
(echo "SET sql_mode = '';" && cat) > ./assets/db/dump.sql
|
||||
|
||||
dev-import-website:
|
||||
sudo tar zxvf ./out/remote.uploads.tar.gz -C ./assets/wordpress/wp-content/
|
||||
sudo tar zxvf ./out/remote.plugins.tar.gz -C ./assets/wordpress/wp-content/
|
||||
sudo chown $(WWW_USER):$(WWW_GROUP) -R ./assets/wordpress/wp-content/
|
||||
|
||||
|
||||
./out:
|
||||
mkdir ./out
|
||||
|
||||
|
@ -64,9 +82,12 @@ _push-%:
|
|||
push-website: _push-uploads _push-plugins
|
||||
|
||||
pull-db:
|
||||
ssh $(REMOTE_DB_HOST) mysqldump --user $(REMOTE_DB_USER) --password $$(age -d ./assets/admin.pass.age) $(REMOTE_DB_DATABASE) > ./out/remote.dump.sql
|
||||
ssh $(REMOTE_DB_HOST) mysqldump $(REMOTE_DB_DATABASE) > $(REMOTE_DB_DUMP)
|
||||
|
||||
_pull-%:
|
||||
ssh $(REMOTE_WEB_HOST) tar czvf - -C $(REMOTE_WEB_ROOT) $* > ./out/remote.$*.tar.gz
|
||||
|
||||
pull-website: _pull-uploads _pull-plugins
|
||||
|
||||
clean:
|
||||
rm ./out/*
|
||||
|
|
|
@ -23,6 +23,7 @@ services:
|
|||
MYSQL_PASSWORD: askar
|
||||
MYSQL_ROOT_PASSWORD: toor
|
||||
volumes:
|
||||
- ./assets/db/dump.sql:/docker-entrypoint-initdb.d/db.sql
|
||||
- db:/var/lib/mysql
|
||||
|
||||
volumes:
|
||||
|
|
Loading…
Reference in New Issue
Block a user