diff --git a/Makefile b/Makefile index 145fdda1..cfe39e00 100644 --- a/Makefile +++ b/Makefile @@ -279,7 +279,7 @@ setup-rust-android-targets: aarch64-linux-android run-wp-cli-command: - @docker exec wordpress /bin/bash -c "wp --allow-root $(ARGS)" + @docker exec --user www-data wordpress /bin/bash -c "wp $(ARGS)" help: @printf "%-40s %s\n" "Target" "Description" diff --git a/scripts/setup-test-site.sh b/scripts/setup-test-site.sh index df410d0d..f4be04a9 100755 --- a/scripts/setup-test-site.sh +++ b/scripts/setup-test-site.sh @@ -12,6 +12,8 @@ set -e # be any weird permissions issues) su -s /bin/bash www-data +wp package install wp-cli/restful + ## Wait for the DB to be ready before attempting install – Docker can do this for us, but we get way better ## diagnostic information from `wp db check`, whereas if `wp core install` fails it won't tell us about issues ## like incompatible SSL cipher suites (which is a problem in the WP 5.7 image when used with MySQL 8+) diff --git a/scripts/start-wp-api-integration-tests-backend.sh b/scripts/start-wp-api-integration-tests-backend.sh index 76a350a4..02611097 100755 --- a/scripts/start-wp-api-integration-tests-backend.sh +++ b/scripts/start-wp-api-integration-tests-backend.sh @@ -4,4 +4,6 @@ cd /app cargo build --release -p wp_api_integration_tests_backend + +su -s /bin/bash www-data nohup ./target/release/wp_api_integration_tests_backend > ./target/release/wp_api_integration_tests_backend.log & diff --git a/wordpress.Dockerfile b/wordpress.Dockerfile index dd3cf53c..90f67021 100644 --- a/wordpress.Dockerfile +++ b/wordpress.Dockerfile @@ -13,9 +13,6 @@ RUN mkdir -p /var/www/.wp-cli ENV PATH="/root/.cargo/bin:${PATH}" RUN chown -R www-data:www-data /var/www/.wp-cli/ -# Run this command as root user since that's what the Docker will use when we run --http=http://localhost commands -RUN wp --allow-root package install wp-cli/restful - # Setup Rust RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y RUN rustup target add x86_64-linux-android i686-linux-android armv7-linux-androideabi aarch64-linux-android diff --git a/wp_cli/src/lib.rs b/wp_cli/src/lib.rs index 828ce5b7..3dbfdf7b 100644 --- a/wp_cli/src/lib.rs +++ b/wp_cli/src/lib.rs @@ -12,8 +12,7 @@ where S: AsRef, { let mut c = Command::new("wp"); - c.arg("--allow-root") - .arg("--http=http://localhost") + c.arg("--http=http://localhost") .arg("--path=/var/www/html") .arg("--format=json") .args(args);