This guide provides step-by-step instructions on how to connect MinIO Single-Node Single-Drive setup to an Oxla database using a Docker container.

Starting MinIO Service

If MinIO is not installed on your machine, you can download and install it by referring to the instructions provided in the MinIO Single-Node Single-Drive documentation.

Once that is done, you can start the MinIO service by running this command:

sudo systemctl start minio.service

Accessing MinIO console

To access the MinIO console, navigate to the localhost:9001 URL in your web browser. Once there, use your MinIO credentials to log in.

Creating Access Keys

After logging into the MinIO console, navigate to the Access Keys > Create access key tab. Here, you have the option to either let MinIO auto-generate access and secret keys or specify custom values yourself. Once you’ve entered all the necessary details, proceed by clicking the Create button to save the changes. It’s crucial to save the generated credentials for later use.

Creating a Bucket

In the MinIO console, click Buckets > Create Bucket tab. Next, provide a unique name for your bucket, such as “oxla-bucket” and then click the Create button to finalize the creation of your new bucket.

Ensure that the object storage bucket directory is either completely empty or contains only files in the Oxla format.

Running Oxla Docker Container

  1. Open your terminal
  2. Pull and run the Oxla Docker container using the following command:
        docker run \
            -e STORAGE__S3__HTTP=http \
            -e STORAGE__S3__ENDPOINT=http://127.0.0.1:9000 \
            -e OXLA_HOME=s3://{MINIO_BUCKET_NAME} \
            -e AWS_ACCESS_KEY_ID={MINIO_ACCESS_KEY} \
            -e AWS_SECRET_ACCESS_KEY={MINIO_SECRET_KEY} \
            --network host \
            public.ecr.aws/oxla/release:latest

Replace the following placeholders with your actual values:

  • MINIO_BUCKET_NAME: desired name for your bucket (e.g. “oxla-bucket/sample”)
  • MINIO_ACCESS_KEY: your MinIO access key
  • MINIO_SECRET_KEY: your MinIO secret key

Example

Let’s assume that you want to create a “film” table in your Oxla database that stores metadata about films in a MinIO bucket. To query this table, you can use the psql application, but first you’ll need to go through Oxla’s access control:

psql -h localhost -U oxla oxla
“oxla” is a default username and password for Oxla’s superuser

For the needs of this section, we’re going to use a simplified version of the film table from the Pagila database, containing only the title, length and rating columns. The complete schema for the film table can be found on the Pagila database website.

DROP TABLE IF EXISTS film;
CREATE TABLE film (
  title text NOT NULL,
  rating text,
  length int
);
INSERT INTO film(title, length, rating) VALUES
  ('ATTRACTION NEWTON', 83, 'PG-13'),
  ('CHRISTMAS MOONSHINE', 150, 'NC-17'),
  ('DANGEROUS UPTOWN', 121, 'PG'),
  ('KILL BROTHERHOOD', 54, 'G'),
  ('HALLOWEEN NUTS', 47, 'PG-13'),
  ('HOURS RAGE', 122, 'NC-17'),
  ('PIANIST OUTFIELD', 136, 'NC-17'),
  ('PICKUP DRIVING', 77, 'G'),
  ('INDEPENDENCE HOTEL', 157, 'NC-17'),
  ('PRIVATE DROP', 106, 'PG'),
  ('SAINTS BRIDE', 125, 'G'),
  ('FOREVER CANDIDATE', 131, 'NC-17'),
  ('MILLION ACE', 142, 'PG-13'),
  ('SLEEPY JAPANESE', 137, 'PG'),
  ('WRATH MILE', 176, 'NC-17'),
  ('YOUTH KICK', 179, 'NC-17'),
  ('CLOCKWORK PARADISE', 143, 'PG-13');
SELECT * FROM film;

Running the query above will return all rows from your film table that are stored in your MinIO bucket:

        title        | rating | length 
---------------------+--------+--------
 ATTRACTION NEWTON   | PG-13  |     83
 CHRISTMAS MOONSHINE | NC-17  |    150
 DANGEROUS UPTOWN    | PG     |    121
 KILL BROTHERHOOD    | G      |     54
 HALLOWEEN NUTS      | PG-13  |     47
 HOURS RAGE          | NC-17  |    122
 PIANIST OUTFIELD    | NC-17  |    136
 PICKUP DRIVING      | G      |     77
 INDEPENDENCE HOTEL  | NC-17  |    157
 PRIVATE DROP        | PG     |    106
 SAINTS BRIDE        | G      |    125
 FOREVER CANDIDATE   | NC-17  |    131
 MILLION ACE         | PG-13  |    142
 SLEEPY JAPANESE     | PG     |    137
 WRATH MILE          | NC-17  |    176
 YOUTH KICK          | NC-17  |    179
 CLOCKWORK PARADISE  | PG-13  |    143
(17 rows)

Additional Resources

For more information on Oxla’s environment variables check out the Configuration file section.