Frojd-Bedrock icon indicating copy to clipboard operation
Frojd-Bedrock copied to clipboard

WP cli fail due when running as root

Open martinjobb opened this issue 3 years ago • 1 comments

These commands fails with YIKES! It looks like you're running this as root.

- name: Flush permalinks
  shell: chdir="{{ ansistrano_release_path.stdout }}"
    wp rewrite flush

- name: Flush cache
  shell: chdir="{{ ansistrano_release_path.stdout }}"
    wp cache flush

in after-symlink.yml.

I suggest either to add --allow-root or the soulution below.

- name: Flush permalinks
  shell: chdir="{{ ansistrano_release_path.stdout }}"
    runuser -u www-data -- wp rewrite flush

- name: Flush cache
  shell: chdir="{{ ansistrano_release_path.stdout }}"
    runuser -u www-data -- wp cache flush

martinjobb avatar May 24 '21 08:05 martinjobb

"--allow-root" was removed in the commit 28a6a8e3f11b694e6427ee3fe2a6105fc5a45046, since the deploy-user is used instead of root on deploy. I think if any changes are needed for the deployment in a specific project then this can be done manually. @mikaelengstrom do you have any input on the change?

saraojelind avatar Jun 15 '21 10:06 saraojelind