Closed ChristopheCaron closed 5 years ago
Something like this should work.
mariadb:
image: wodby/mariadb:$MARIADB_TAG
container_name: "${PROJECT_NAME}_mariadb"
stop_grace_period: 30s
environment:
MYSQL_ROOT_PASSWORD: $DB_ROOT_PASSWORD
MYSQL_DATABASE: $DB_NAME
MYSQL_USER: $DB_USER
MYSQL_PASSWORD: $DB_PASSWORD
volumes:
- ./mariadb-init:/docker-entrypoint-initdb.d # Place init .sql file(s) here.
mariadb2:
image: wodby/mariadb:$MARIADB_TAG
container_name: "${PROJECT_NAME}_mariadb2"
stop_grace_period: 30s
environment:
MYSQL_ROOT_PASSWORD: $DB_ROOT_PASSWORD
MYSQL_DATABASE: $DB_NAME
MYSQL_USER: $DB_USER
MYSQL_PASSWORD: $DB_PASSWORD
volumes:
- ./mariadb-init2:/docker-entrypoint-initdb.d # Place init .sql file(s) here.
....
apache:
image: wodby/php-apache:$APACHE_TAG
container_name: "${PROJECT_NAME}_apache"
depends_on:
- php
environment:
APACHE_LOG_LEVEL: debug
APACHE_BACKEND_HOST: php
APACHE_SERVER_ROOT: /var/www/html/web
volumes:
- ./:/var/www/html:cached # User-guided caching
labels:
- 'traefik.backend=apache'
- 'traefik.port=80'
- 'traefik.frontend.rule=Host:domain1.docker.localhost,domain2.docker.localhost'
``
Thanks I will test your configuration, for the second mariaDb I have just to replace the host in the settings.php Right ? It's impossible de setup the two databases in the same container ? ( To see the two in pma)
Right settings.php would have
$databases = array (
'default' =>
array (
'default' =>
array (
'database' => 'drupal',
'username' => 'drupal',
'password' => 'drupal',
'host' => 'mariadb',
'port' => '',
'driver' => 'mysql',
'prefix' => '',
),
),
);
and
$databases = array (
'default' =>
array (
'default' =>
array (
'database' => 'drupal',
'username' => 'drupal',
'password' => 'drupal',
'host' => 'mariadb2',
'port' => '',
'driver' => 'mysql',
'prefix' => '',
),
),
);
You can manually add a DB via Adminer or PMA, but you loose some of the automation. The above method allows you to autoload the database if you store your latest backup in the folders ./mariadb-init
and ./mariadb-init2
This protects from container rebuilds.
PS. GitHub should be used for issue tracking. You might look in to moving https://wodby-community.slack.com for general help.
Edit on the first post, the second container name should change too.
container_name: "${PROJECT_NAME}_mariadb"
container_name: "${PROJECT_NAME}_mariadb2"
Codebase mounted codebase
Describe your issue In your documentation, I saw the configuration to share a docker4drupal for two instances in two projects dir by treafik, but in my case I would like to set up this
How can I set up this configuration ?
Thanks