crayden
crayden

Reputation: 2270

How to run Bitnami Drupal container with separate database server

This Bitnami Drupal Docker image suggests running the container using the Docker compose file seen below. Is it possible to configure this container to use a separate database server hosted on a cloud platform such as Azure?

The Drupal website runs fine at localhost using the original docker-compose file from Github. But when modifying docker-compose.yml to use a local SQL database (below), localhost does not return anything. The local database is running using XAMPP for testing the second file, but strangely enough nothing is returned at all at localhost.

Technically XAMPP is using MySQL instead of MariaDB, not sure if that makes a difference.

docker-compose.yml - Original

version: '2'

services:
  mariadb:
    image: 'bitnami/mariadb:10.3'
    environment:
      - ALLOW_EMPTY_PASSWORD=yes
      - MARIADB_USER=bn_drupal
      - MARIADB_DATABASE=bitnami_drupal
    volumes:
      - 'mariadb_data:/bitnami'
  drupal:
    image: 'bitnami/drupal:8'
    environment:
      - MARIADB_HOST=mariadb
      - MARIADB_PORT_NUMBER=3306
      - DRUPAL_DATABASE_USER=bn_drupal
      - DRUPAL_DATABASE_NAME=bitnami_drupal
      - ALLOW_EMPTY_PASSWORD=yes
    ports:
      - '80:80'
      - '443:443'
    volumes:
      - 'drupal_data:/bitnami'
    depends_on:
      - mariadb
volumes:
  mariadb_data:
    driver: local
  drupal_data:
    driver: local

docker-compose.yml - Modified

version: '2'

services:
  drupal:
    image: 'bitnami/drupal:8'
    environment:
      - MARIADB_HOST=localhost
      - MARIADB_PORT_NUMBER=3306
      - DRUPAL_DATABASE_NAME=docker
      - DRUPAL_DATABASE_USER=root
      - ALLOW_EMPTY_PASSWORD=yes
    ports:
      - '80:80'
      - '443:443'
    volumes:
      - 'drupal_data:/bitnami'
volumes:
  drupal_data:
    driver: local

Upvotes: 0

Views: 556

Answers (1)

user10430436
user10430436

Reputation:

Bitnami developer here. The Bitnami Drupal container supports the below environment variables for configuring the MySQL database:

  • DRUPAL_DATABASE_NAME
  • DRUPAL_DATABASE_USER
  • DRUPAL_DATABASE_PASSWORD
  • MARIADB_HOST
  • MARIADB_PORT_NUMBER

An example set of values is shown below for a "mydatabase" RDS database:

- DRUPAL_DATABASE_NAME=mydatabase
- DRUPAL_DATABASE_USER=username
- DRUPAL_DATABASE_PASSWORD=password123
- MARIADB_HOST=mydatabase.asdfg.us-east-1.rds.amazonaws.com
- MARIADB_PORT_NUMBER=3306

Note that if you are going to use an external database, SSL connections are not yet supported, so you must secure it on your side (i.e. by checking that the database is not remotely accessible on the internet).

If you find any issues, feel free to create a new GitHub issue and we'll be glad to help you there.

Upvotes: 2

Related Questions