-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Fix wp-env docker-compose config with explicit users and passwords #29770
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -176,26 +176,41 @@ module.exports = function buildDockerComposeConfig( config ) { | |
| image: 'mariadb', | ||
| ports: [ '3306' ], | ||
| environment: { | ||
| MYSQL_ALLOW_EMPTY_PASSWORD: 'yes', | ||
| MYSQL_ROOT_PASSWORD: 'password', | ||
| MYSQL_DATABASE: 'wordpress', | ||
| }, | ||
| volumes: [ 'mysql:/var/lib/mysql' ], | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The volume for the The
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think restarting the environment doesn't mean losing data, destroying the environment means that and for a dev environment, I think that's totally acceptable.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Regardless, I restored volumes to see if it solves the permission issues |
||
| }, | ||
| 'tests-mysql': { | ||
| image: 'mariadb', | ||
| ports: [ '3306' ], | ||
| environment: { | ||
| MYSQL_ROOT_PASSWORD: 'password', | ||
| MYSQL_DATABASE: 'tests-wordpress', | ||
| }, | ||
| volumes: [ 'mysql-test:/var/lib/mysql' ], | ||
| }, | ||
| wordpress: { | ||
| build: '.', | ||
| depends_on: [ 'mysql' ], | ||
| image: developmentWpImage, | ||
| ports: [ developmentPorts ], | ||
| environment: { | ||
| WORDPRESS_DB_NAME: 'wordpress', | ||
| WORDPRESS_DB_USER: 'root', | ||
| WORDPRESS_DB_PASSWORD: 'password', | ||
| }, | ||
| volumes: developmentMounts, | ||
| }, | ||
| 'tests-wordpress': { | ||
| depends_on: [ 'mysql' ], | ||
| depends_on: [ 'tests-mysql' ], | ||
| image: testsWpImage, | ||
| ports: [ testsPorts ], | ||
| environment: { | ||
| WORDPRESS_DB_NAME: 'tests-wordpress', | ||
| WORDPRESS_DB_USER: 'root', | ||
| WORDPRESS_DB_PASSWORD: 'password', | ||
| WORDPRESS_DB_HOST: 'tests-mysql', | ||
| }, | ||
| volumes: testsMounts, | ||
| }, | ||
|
|
@@ -204,12 +219,23 @@ module.exports = function buildDockerComposeConfig( config ) { | |
| image: developmentWpCliImage, | ||
| volumes: developmentMounts, | ||
| user: cliUser, | ||
| environment: { | ||
| WORDPRESS_DB_NAME: 'wordpress', | ||
| WORDPRESS_DB_USER: 'root', | ||
| WORDPRESS_DB_PASSWORD: 'password', | ||
| }, | ||
| }, | ||
| 'tests-cli': { | ||
| depends_on: [ 'tests-wordpress' ], | ||
| image: testsWpCliImage, | ||
| volumes: testsMounts, | ||
| user: cliUser, | ||
| environment: { | ||
| WORDPRESS_DB_NAME: 'tests-wordpress', | ||
| WORDPRESS_DB_USER: 'root', | ||
| WORDPRESS_DB_PASSWORD: 'password', | ||
| WORDPRESS_DB_HOST: 'tests-mysql', | ||
| }, | ||
| }, | ||
| composer: { | ||
| image: 'composer', | ||
|
|
@@ -235,6 +261,7 @@ module.exports = function buildDockerComposeConfig( config ) { | |
| ...( ! config.coreSource && { wordpress: {} } ), | ||
| ...( ! config.coreSource && { 'tests-wordpress': {} } ), | ||
| mysql: {}, | ||
| 'mysql-test': {}, | ||
| 'phpunit-uploads': {}, | ||
| }, | ||
| }; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Setting the database here, makes sure the container creates it (which was done previously in the wordpress image)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is also why we need a separate container for the database of the tests env.