Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 29 additions & 2 deletions packages/env/lib/build-docker-compose-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Copy link
Contributor Author

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)

Copy link
Contributor Author

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.

},
volumes: [ 'mysql:/var/lib/mysql' ],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The volume for the mysql container should be retained. Removing this means any restart of the environment loses any existing data.

The clean command exists to wipe databases on the dev environment when needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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,
},
Expand All @@ -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',
Expand All @@ -235,6 +261,7 @@ module.exports = function buildDockerComposeConfig( config ) {
...( ! config.coreSource && { wordpress: {} } ),
...( ! config.coreSource && { 'tests-wordpress': {} } ),
mysql: {},
'mysql-test': {},
'phpunit-uploads': {},
},
};
Expand Down