Skip to content

Docker container for ROMI databaseLink

Important

An existing local database directory is required, it will be mounted at container startup. To see how to create a local database directory, look here.

Use pre-built docker imageLink

Assuming you have a valid ROMI database directory under /data/ROMI/DB, you can easily download and start the pre-built plantdb docker image with:

export ROMI_DB=/data/ROMI/DB
docker run -it -p 5000:5000 \
  -v $ROMI_DB:/myapp/db \
  roboticsmicrofarms/plantdb:latest

You should be able to access it here: http://localhost:5000/

Note

-v $ROMI_DB:/myapp/db performs a bind mount to enable access to the local database by the docker image. See the official documentation.

Build docker imageLink

We provide a convenience bash script to ease the build of plantdb docker image. You can choose to use this script OR to "manually" call the docker build command.

Provided convenience build.sh scriptLink

To build the image with the provided build script, from the plantdb/docker directory:

./build.sh

You can also pass some options, use ./build.sh -h to get more details about usage, options and default values.

Manually call the docker build commandLink

To build the image, from the plantdb root directory:

export VTAG="latest"
docker build -t roboticsmicrofarms/plantdb:$VTAG .

You can use the following optional arguments:

  • --build-arg USER_NAME=<user>: change the default user in container;
  • --build-arg PLANTDB_BRANCH=<git_branch>: change the cloned git branch from plantdb.

Publish docker imageLink

Push it on docker hub:

docker push roboticsmicrofarms/plantdb:$VTAG

This requires a valid account & token on dockerhub!

UsageLink

RequirementsLink

To run it, you need to have a valid local ROMI database, look here for instructions and here for an example database.

Starting the plantdb docker imageLink

Provided run.sh scriptLink

To start the container with the provided run script in plantdb/docker, use:

./run.sh

You can also pass some options, use ./run.sh -h to get more details about usage and options.

ManuallyLink

Assuming you extracted it in your home folder (/home/$USER/integration_tests), you can start the plantdb docker image with:

docker run -it -p 5000:5000 -v /home/$USER/integration_tests:/myapp/db plantdb:$VTAG

In both cases, you should see something like:

n scans = 2
 * Serving Flask app "romi_scanner_rest_api" (lazy loading)
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: off
 * Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)

Tip

-v /home/$USER/integration_tests:/myapp/db performs a bind mount to enable access to the local database by the docker image. See the official Docker documentation.

Accessing the REST APILink

Once it's up, you should be able to access the REST API here: http://localhost:5000/

To access the REST API, open your favorite browser and use URLs to access:

You should see JSON formatted text.