10up / wp-local-docker-v2

ARCHIVED: A simple Docker based development environment for WordPress.
MIT License
484 stars 81 forks source link

10up/snapshots needs access to AWS credentials on the host computer #352

Closed benlk closed 11 months ago

benlk commented 11 months ago

Is your enhancement related to a problem? Please describe.

10up/snapshots requires AWS credentials to be located in a file at ~/.aws/credentials. For Local WP and similar tools where wp-cli runs from the host filesystem, instead of inside the container, this works well.

WP Local Docker runs its wp-cli command from within the Docker container, as the user www-data, whose home is /home/www-data within the container.

10up/snapshots' docs say:

Depending on your setup, you may need to create the ~/.aws directory and the credentials file inside of your local environment.

For wp local docker users, this process requires:

  1. Put the credentials in wp-content/
  2. 10updocker shell
  3. mkdir -p ~/.aws
  4. cp wp-content/credentials ~/.aws

A better solution would be: automatically mount the host user's ~/.aws at /home/www-data/.aws/

Designs

No response

Describe alternatives you've considered

I could try to figure out how to put the AWS creds as environment variables in Docker, I guess? Auto-mounting seems simpler.

Code of Conduct

darylldoyle commented 11 months ago

@benlk the ~/.aws directory is already auto-mounted for environments created since the update to V4 of wp-local-docker-v2. See: https://github.com/10up/wp-local-docker-v2/blob/6a1e7a252e4ac94d371bc78d5521df28a145934d/src/commands/create/make-docker-compose.js#L94 and https://github.com/10up/wp-local-docker-v2/blob/6a1e7a252e4ac94d371bc78d5521df28a145934d/src/commands/create/make-docker-compose.js#L108

It's also mentioned as part of the migration guide that should be consulted when updating to V4.X.X.

https://github.com/10up/wp-local-docker-v2/blob/6a1e7a252e4ac94d371bc78d5521df28a145934d/README.md?plain=1#L892-L902

benlk commented 11 months ago

I must have missed that docker-compose.yml line when I was updating my environments. Thanks!

benlk commented 11 months ago

Found the issue: I put that line in the wrong spot in my docker-compose.yml, under nginx instead of phpfpm.