add import/export utilities

This commit is contained in:
sfigato 2024-07-20 00:17:18 +02:00
parent 8c2f5daa09
commit fbc4ae2c7a

View File

@ -47,3 +47,26 @@ tmpdb-do-dump:
mariadb-dump --default-character-set=binary --hex-blob $(TMPDB_CONN) askar | grep -v -E '^/\*' > $(PROD_DUMP) mariadb-dump --default-character-set=binary --hex-blob $(TMPDB_CONN) askar | grep -v -E '^/\*' > $(PROD_DUMP)
prepare-db: tmpdb-start tmpdb-do-dump tmpdb-stop prepare-db: tmpdb-start tmpdb-do-dump tmpdb-stop
prepare-%:
tar czvf ./out/$*.tar.gz -C ./assets/wordpress/wp-content/$*
prepare-data: prepare-uploads prepare-plugins
prepare-export: prepare-db prepare-data
push-db:
cat $(PROD_DUMP) | ssh $(REMOTE_DB_HOST) mysql --user $(REMOTE_DB_USER) --password $$(age -d ./assets/admin.pass.age) $(REMOTE_DB_DATABASE)
_push-%:
cat ./out/$*.tar.gz | ssh $(REMOTE_WEB_HOST) tar zxvf -C $(REMOTE_WEB_ROOT) -
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
_pull-%:
ssh $(REMOTE_WEB_HOST) tar czvf - -C $(REMOTE_WEB_ROOT) $* > ./out/remote.$*.tar.gz
pull-website: _pull-uploads _pull-plugins