Docker Installation

How to install OpenDataBio with Docker

The easiest way to install and run OpenDataBio is using Docker and the docker configuration files provided, which contain all the needed configurations to run ODB. Uses nginx and mysql, and supervisor for queues

Docker files

laraverl-app/
----docker/*
----./env.docker
----docker-compose.yml
----Dockerfile
----Makefile

These are adapted from this link, where you find a production setting as well.

Installation


Download OpenDataBio
  1. Make sure you have Docker and Docker-compose installed in your system;
##ubuntu
docker --version
sudo apt update
sudo apt install docker 
sudo apt install docker-compose-plugin
  1. Check if your user is in the docker group created during docker installation;
getent group docker
# If not in the list, add it
# Add the docker group if it does not exist
sudo groupadd docker
# Add the currently logged-in user to the docker group
sudo gpasswd -a $USER docker
# Restart the Docker service
sudo service docker restart
  1. Download or clone the OpenDataBio in your machine;
  2. Make sure your user is the owner of the opendatabio folder created and contents, else change ownership and group recursively to your user
  3. Enter the opendatabio directory
  4. Create and adjust configuration environment file .env.
  1. To install locally for development just adjust the following variables in the Dockerfile, which are needed to map the files owners to a docker user;
    1. UID the numeric user your are logged in and which is the owner of all files and directories in the opendatabio directory.
    2. GDI the numeric group the user belongs, usually same as UID.
#current user 
id -u  #if UID=1000 do not need to adjust
#current user group
id -g  #if GDI=1000 do not need to adjust
  1. File Makefile contains shortcuts to the docker-compose commands used to build the services configured in the docker-compose.yml and auxiliary files in the docker folder.
  2. Build the docker containers using the shortcuts (read the Makefile to undersand the commands)
make build
  1. Start the implemented docker Services
make start
  1. See the containers and try log into the laravel container
docker ps
make ssh #to enter the container shell
make ssh-mysql #to enter the mysql container, where you may access the database shell using `mysql -uroot -p` or use the laravel user
  1. Generate the APP_KEY
make key-generate
  1. Install composer dependencies
make composer-install
  1. Migrate the database
make migrate
  1. Seed the Locations and Taxons tables with seed data:
make seed-odb
  1. If worked, then Opendatabio will be available in your browser http::/localhost:8081.
  2. Login with superuser admin@example.org and password password1
  3. The database will be available with phpmyadmin at http://localhost:8082/
  4. Additional configurations in these files are required for a production environment and deployment;

Data persistence

The docker images may be deleted without loosing any data. The mysql tables are stored in a volume. You may change to a local path bind.

docker volume list

Using

The Makefile file contains the following commands to interact with the docker containers and odb.

Commands to build and create the app

  1. make build - build containers
  2. make key-generate - generate the app key and adds to .env
  3. make composer-install - install php dependencie
  4. make composer-update - update php dependencies
  5. make composer-dump-autoload - execute composer dump-autoload within container
  6. make migrate - create or update the database
  7. make drop-migrate - delete and recreate the database
  8. make seed-odb - seed the database with locations and taxons

Commands to access the docker containers

  1. make start - start all containers
  2. make stop - stop all containers
  3. make restart - restart all containers
  4. make ssh - enter the main laravel app container
  5. make ssh-mysql - enter the mysql container, so you may the log to the database using mysql -uUSER -pPWD
  6. make mysql - enter the docker mysql console
  7. make ssh-nginx - enter the nginx container
  8. make ssh-supervisord - enter the supervisord container

Maintenance commands

  1. make optimize - clean caches and log files
  2. make info - show app info
  3. make logs - show laravel logs
  4. make logs-mysql - show mysql logs
  5. make logs-nginx - show nginx logs
  6. make logs-supervisord - show supervisor logs

Deleting & rebuilding

If you have issues and changed the docker files, you may need to rebuild:

#delete all images without loosing data
make stop  #first stop all
docker system prune -a  #and accepts Yes
make build
make start
Last modified June 8, 2025: Added examples and Media apis (8232be9)