Command line interface for accessing the Open Web Index shards and slices.
owi-cli docs source docker.md
3.0 kB
Markdown
at commit af53accb

Docker #

Building the Docker Image #

To build the Docker image locally:

# Build the image
docker build -t owilix .

# Build with a specific tag
docker build -t owilix:latest .

Using Docker #

Once the image is built, you can use OWILIX commands through Docker instead of installing it locally.

Basic Usage #

Replace owilix commands with docker run --rm -it owilix:

# Instead of: owilix --help
# Test if 
docker run --rm -it owilix --help

# Instead of: owilix remote ls
docker run --rm -it owilix remote ls

# Instead of: owilix remote doctor
docker run --rm -it owilix remote doctor

Note:

With Persistant Configuration and Data Persistence #

owilix stores its configuration files and the indices under ~/.owi. since docker executions do not persist the configuration file, you need to expose the volume for data persistency. Otherwise, every execution would require you to login and accept the license (except for owilix --help)

In general, run docker run -v ~/.owi:/home/owi/.owi --rm -it owilix <ARGS> to have the same behaviour as if you would run it without docker.

Some examples on using a directory local configuration directory: `

# Create directories for config and data
mkdir -p ./config ./data

# Run with mounted volumes
docker run --rm -it \
  -v $(pwd)/config:/home/owi/.owi \
  owilix remote ls all

# Pull data with persistence
docker run --rm -it \
  -v $(pwd)/config:/home/owi/.owi \
  owilix remote pull lrz:latest/access=public

Using a separate data dictionary. #

You can also use a separate folder where the datasets are stored (default under ~/.owi/) The docker images exposes a /data path therefore. However, you also need to change the configuration of the local repository that the /data is used.

so change owilix.cfg in your configuration directory as follows:

    local:
      options:
        path: /data/{access}
        async: True 
      repository: file

Afterwards, you need to mount also the data directory when running docker:

# Create directories for config and data
mkdir -p ./config ./data

# Run with mounted volumes
docker run --rm -it \
  -v $(pwd)/config:/home/owi/.owi \
  -v $(pwd)/data:/data \
  owilix remote ls all

# Pull data with persistence
docker run --rm -it \
  -v $(pwd)/config:/home/owi/.owi \
  -v $(pwd)/data:/data \
  owilix remote pull lrz:latest/access=public

HTTP API Preview #

The Docker image installs the optional HTTP dependencies by default. The HTTP API is a preview local service in v5.5.0; do not publish it on a public or shared network without an external access-control layer.

Run it bound to the local host:

docker run --rm -it \
  -p 127.0.0.1:8080:8080 \
  -v ~/.owi:/home/owi/.owi \
  -v $(pwd)/data:/data \
  owilix http serve --host 0.0.0.0 --port 8080

The compose file docker-compose/docker-compose-http.yml also publishes the container only on 127.0.0.1:8080 by default.