refine and document prod flow
This commit is contained in:
parent
22f36c7828
commit
5461aa9f3f
12
Makefile
12
Makefile
|
@ -1,6 +1,6 @@
|
||||||
DOCKER ?= docker
|
DOCKER ?= docker
|
||||||
COMPOSE ?= docker compose
|
COMPOSE ?= docker compose
|
||||||
PUBLIC_URL ?= https://askar.abbiamoundominio.org
|
PUBLIC_URL ?= https://askar-association-ps.org
|
||||||
TMPDB_CONN = --host=127.0.0.1 --port=3307 --user=root --password=toor --ssl-verify-server-cert=FALSE
|
TMPDB_CONN = --host=127.0.0.1 --port=3307 --user=root --password=toor --ssl-verify-server-cert=FALSE
|
||||||
DUMP_CONN = -h 127.0.0.1 -P 3306 --user root --password=toor --ssl-verify-server-cert=FALSE
|
DUMP_CONN = -h 127.0.0.1 -P 3306 --user root --password=toor --ssl-verify-server-cert=FALSE
|
||||||
VERSIONED_DUMP = ./assets/db/dump.sql
|
VERSIONED_DUMP = ./assets/db/dump.sql
|
||||||
|
@ -66,18 +66,18 @@ tmpdb-do-dump:
|
||||||
|
|
||||||
prepare-db: tmpdb-start tmpdb-do-dump tmpdb-stop
|
prepare-db: tmpdb-start tmpdb-do-dump tmpdb-stop
|
||||||
|
|
||||||
prepare-%:
|
_prepare-%:
|
||||||
tar czvf ./out/$*.tar.gz -C ./assets/wordpress/wp-content/$*
|
tar -C ./assets/wordpress/wp-content/ ./$* -czvf ./out/$*.tar.gz
|
||||||
|
|
||||||
prepare-data: prepare-uploads prepare-plugins
|
prepare-data: _prepare-uploads _prepare-plugins
|
||||||
|
|
||||||
prepare-export: prepare-db prepare-data
|
prepare-export: prepare-db prepare-data
|
||||||
|
|
||||||
push-db:
|
push-db:
|
||||||
cat $(PROD_DUMP) | ssh $(REMOTE_DB_HOST) mysql --user $(REMOTE_DB_USER) --password $$(age -d ./assets/admin.pass.age) $(REMOTE_DB_DATABASE)
|
cat $(PROD_DUMP) | ssh $(REMOTE_DB_HOST) mysql --user=$(REMOTE_DB_USER) --password=\'$$(age -d ./assets/db.prod.pass.age)\' $(REMOTE_DB_DATABASE)
|
||||||
|
|
||||||
_push-%:
|
_push-%:
|
||||||
cat ./out/$*.tar.gz | ssh $(REMOTE_WEB_HOST) tar zxvf -C $(REMOTE_WEB_ROOT) -
|
cat ./out/$*.tar.gz | ssh $(REMOTE_WEB_HOST) tar -C $(REMOTE_WEB_ROOT) -zxvf -
|
||||||
|
|
||||||
push-website: _push-uploads _push-plugins
|
push-website: _push-uploads _push-plugins
|
||||||
|
|
||||||
|
|
57
README.md
57
README.md
|
@ -34,3 +34,60 @@ The website will be a Wordpress with some customization. It will have the follow
|
||||||
## Dev
|
## Dev
|
||||||
|
|
||||||
We use GNU make + docker
|
We use GNU make + docker
|
||||||
|
|
||||||
|
Set the environment variables as appropriate
|
||||||
|
|
||||||
|
```
|
||||||
|
export REMOTE_WEB_HOST=root@amelia.abbiamoundominio.org
|
||||||
|
export REMOTE_WEB_ROOT=/var/www/askar
|
||||||
|
export REMOTE_DB_HOST=root@comandantaramona.abbiamoundominio.org
|
||||||
|
export REMOTE_DB_USER=wordpress_askar
|
||||||
|
export REMOTE_DB_DATABASE=wordpress_askar
|
||||||
|
export PUBLIC_URL=https://askar-association-ps.org
|
||||||
|
```
|
||||||
|
|
||||||
|
### Pull content from production site
|
||||||
|
|
||||||
|
Pull the content (uploads+plugins)
|
||||||
|
|
||||||
|
```
|
||||||
|
make pull-website
|
||||||
|
```
|
||||||
|
|
||||||
|
Dump the remote db and pull it
|
||||||
|
|
||||||
|
```
|
||||||
|
make pull-db
|
||||||
|
```
|
||||||
|
|
||||||
|
### Push to production
|
||||||
|
|
||||||
|
Prepare the local content to be pushed (note that the following requires the dev site to be running with `make dev-run`):
|
||||||
|
|
||||||
|
```
|
||||||
|
make prepare
|
||||||
|
```
|
||||||
|
|
||||||
|
Stop the remote website
|
||||||
|
|
||||||
|
```
|
||||||
|
ssh ${REMOTE_WEB_HOST} docker stop wordpress_askar
|
||||||
|
```
|
||||||
|
|
||||||
|
Push the database
|
||||||
|
|
||||||
|
```
|
||||||
|
make push-db
|
||||||
|
```
|
||||||
|
|
||||||
|
Push the website content
|
||||||
|
|
||||||
|
```
|
||||||
|
make push-website
|
||||||
|
```
|
||||||
|
|
||||||
|
Restart the website
|
||||||
|
|
||||||
|
```
|
||||||
|
ssh ${REMOTE_WEB_HOST} ./ wordpress_askar.sh
|
||||||
|
```
|
||||||
|
|
6
assets/db.prod.pass.age
Normal file
6
assets/db.prod.pass.age
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
age-encryption.org/v1
|
||||||
|
-> scrypt 6QrVQqHCz74QP99Wdncdlg 18
|
||||||
|
6pKNpuQEpUOPQRo/EBndnQS6SiX5Vk5SarrCQyQV76I
|
||||||
|
--- 3HNXyrypprIaex+N5i6H9aqV/r38nYg2jYj+aG4xShA
|
||||||
|
öÞ–³ú¥öhrè’-í
|
||||||
|
$jYÿŸ¹õ"Æù<C386>±MRÀ¯7‰áƵãùöKÈ<p‹ŽÇ_Á¦Û
|
Loading…
Reference in New Issue
Block a user