1) Configure port forwarding into the database container.


In order to make MariaDB accessible from the outside, we have to inform Docker about this. For this purpose we create a new file under /opt/otobo-docker/docker-compose/otobo-opendb.yml with the following content:

version: '3.3'

services:

# open port 3307 for external access to the database

  db:

    # Per default this port is not exposed to the outside world.

    # One can use 'docker-compose exec -it db mysql ...' when access to the database is needed.

    # But for development it can be useful to expose the port 3306. E.g. when a graphical client

    # like MySQL Workbench or DBeaver is used. Uncomment the following lines for making MariaDB available

    # on port 3307 on the Docker host. A non-standard port is chosen here, because 3306 is # often already used on the Docker host.

    # often already used on the Docker host.

     ports:

       - "3307:3306"



Attention! In .yml files the correct indentation is important, therefore the file is also in the appendix of this FAQ article. In our example we open port 3307 to the outside, but it can of course also be 3306 or any other free port.

 

1.1) Add the configuration file to the .env file 

Afterwards please add the new configuration file to /opt/otobo-docker/.env by adding the new file separated by a ":" to the end:


# COMPOSE_FILE=docker-compose/otobo-base.yml:docker-compose/otobo-override-https.yml

COMPOSE_FILE=docker-compose/otobo-base.yml:docker-compose/otobo-override-https.yml:docker-compose/otobo-opendb.yml


 

2) Inform Docker about the changes

Please deploy the changes as the user who also started the Docker containers (we assume the user "root" in this example):

user> sudo -i
...
root> cd /opt/otobo-docker
root> docker-compose up -d

 

3) Create a read only database user

Now we can log into MariaDB and create a new user:

root> docker exec -it otobo_web_1 mysql -uroot -pxxxx otobo

The database root password for the above command can be found in the file "/opt/otobo-docker/.env".