From 997707189e46b1defce3b5f1940fe88db2b99de3 Mon Sep 17 00:00:00 2001 From: 3wc <3wc.git@doesthisthing.work> Date: Mon, 14 Dec 2020 12:31:17 +0200 Subject: [PATCH] Add custom abra command to run WP-CLI Closes #2 --- README.md | 7 +++++++ abra-commands.sh | 11 +++++++++++ 2 files changed, 18 insertions(+) create mode 100644 abra-commands.sh diff --git a/README.md b/README.md index 0dd153f..e09fa64 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,13 @@ Coöp Cloud + [Wordpress](https://wordpress.org) = 🥳 8. `abra app YOURAPPDOMAIN run app chown www-data:www-data /var/www/html/wp-content` to fix file permissions (see #3) +## Running WP-CLI + +`abra app YOURAPPDOMAIN wp 'core check-update --major'` + +(the WP-CLI arguments need to be quoted, because of how `abra` handles +command-line arguments) + ## Network (Multi-site) _(Only tested using subdomains)_ diff --git a/abra-commands.sh b/abra-commands.sh new file mode 100644 index 0000000..72e427a --- /dev/null +++ b/abra-commands.sh @@ -0,0 +1,11 @@ +sub_wp() { + load_instance + load_instance_env + CONTAINER=$(docker container ls -f "Name=${STACK_NAME}_app" --format '{{ .ID }}') + if [ -z "$CONTAINER" ]; then + error "Can't find a container for ${STACK_NAME}_app" + exit + fi + # shellcheck disable=SC2154,SC2086 + docker run -it --volumes-from "$CONTAINER" --network "container:$CONTAINER" wordpress:cli wp $abra__arg_ +}