Skip to content

Standalone PostgreSQL measurement database with MiniO-backend storage for experiment data and results.

Notifications You must be signed in to change notification settings

andncl/arbok_database

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

9 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ§ͺ PostgreSQL + MinIO Measurement Database (Nix Flake)

A reproducible development environment providing a PostgreSQL measurement database with MinIO object storage, designed for local experiments and data-driven workflows.


Overview

This flake sets up:

  • 🐘 PostgreSQL 15 β€” local database instance for structured measurement data
  • πŸͺ£ MinIO β€” lightweight, S3-compatible object storage
  • 🧩 Automatic initialization of postgresql.conf and pg_hba.conf from external files
  • πŸ’Ύ Persistent local data directories under ./data/

🧱 Directory Structure

arbok_database/
β”œβ”€β”€ flake.nix
β”œβ”€β”€ config/
β”‚   β”œβ”€β”€ postgresql.conf       # Custom PostgreSQL configuration template
β”‚   └── pg_hba.conf           # Host-based authentication config
β”œβ”€β”€ data/                     # Created automatically by shellHook
β”‚   β”œβ”€β”€ pgdata/               # PostgreSQL data directory (after initdb)
β”‚   β”œβ”€β”€ pgsock/               # UNIX socket directory for PostgreSQL
β”‚   └── minio/                # MinIO data storage root
└── minio.log                 # Runtime log written when MinIO starts

βš™οΈ Getting Started

1️⃣ Enter the dev shell

nix develop

### Start/Stop PostgreSQL
pg_ctl -D "$PGDATA" -o "-k $PGSOCKET" -l logfile start
pg_ctl -D "$PGDATA" -o "-k $PGSOCKET" stopi

Start/Stop MinIO

MinIO starts automatically when entering the shell. You can stop it manually using:

stopminio

Connect via SQLAlchemy

Example pythin connection using TCP:

from sqlalchemy import create_engine

engine = create_engine("postgresql+psycopg2://localhost:5432/postgres")

or via Unix socket:

socket_dir = "/path/to/data/pgsock"
engine = create_engine(f"postgresql+psycopg2:///postgres?host={socket_dir}")

Tips

  • Data is stored under ./data, so you can safely rebuild or re-enter the flake shell withoutloosing data
  • Logs are written to data/mini.log
  • The configuration files (postgresql.conf and pg_hba.conf`) can be customized outside the flake and are imported and configured automatically

About

Standalone PostgreSQL measurement database with MiniO-backend storage for experiment data and results.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages