reiizumi/sachiko-api

By reiizumi

Updated 3 months ago

API for managing server inventory, network, IP address, shared folders, and scheduled tasks

Image
Networking
0

328

reiizumi/sachiko-api repository overview

Sachiko API

REST API for managing server inventory, network devices, IP address allocation, shared folders, and scheduled tasks. Built on Bun with a distroless container image running as a non-root user (UID 65532).

Prerequisites

  • Docker
  • PostgreSQL 18+ instance accessible from the container
  • OIDC Identity Provider with a valid discovery endpoint

Running

Initialize the Database

Run migrations and seed reference data, then stop:

docker run --rm \
  -e DATABASE_URL=postgresql://sachiko:password@db-host:5432/sachiko \
  reiizumi/sachiko-api:latest init-db
Start the API
docker run -d \
  -e DATABASE_URL=postgresql://sachiko:password@db-host:5432/sachiko \
  -e OIDC_WELL_KNOWN_URL=https://idp.example.com/.well-known/openid-configuration \
  -e CORS_ORIGINS=https://sachiko.example.com \
  -e NETWORK_SUBNET=192.168.1.0/24 \
  -p 3001:3001 \
  reiizumi/sachiko-api:latest

Environment Variables

VariableRequiredDefaultDescription
DATABASE_URLYespostgresql://user:password@localhost:5432/sachikoPostgreSQL connection string.
OIDC_WELL_KNOWN_URLYeshttps://idp.example.com/.well-known/openid-configurationOIDC Discovery endpoint for JWT verification. Not required for init-db.
CORS_ORIGINSYeshttp://localhost:3000Comma-separated allowed CORS origins.
PORTNo3001Port the API listens on.
NETWORK_SUBNETYes192.168.1.0/24Network subnet prefix for IP address management.
ENVIRONMENTNoproductionEnvironment name returned by GET /api/v1/about.
OTEL_ENABLEDNofalseEnable OpenTelemetry instrumentation.
OTEL_EXPORTER_OTLP_ENDPOINTNohttp://localhost:4318OTLP collector endpoint (HTTP). Only used when OTEL_ENABLED=true.

Health and Observability Endpoints

EndpointPurposeSuccessFailure
GET /healthLiveness probe200 { "status": "ok" }--
GET /readyReadiness probe (checks DB connection)200 { "status": "ok" }503 { "status": "unavailable" }
GET /metricsPrometheus metrics (text exposition format)200--

All three endpoints are public (no authentication) and are outside the /api/ path.


Moon.cat - GitLab Repository

Tag summary

Content type

Image

Digest

sha256:e7826acc1

Size

48.9 MB

Last updated

3 months ago

docker pull reiizumi/sachiko-api:1.0.0-arm64