Skip to content

Installation

Installation

Clone the repository and build the binary:

bash
git clone https://github.com/IdanKoblik/packster
cd packster
make build

The binary is written to bin/packster.

Configuration

Packster is configured with a YAML file. Point to it with the CONFIG_PATH environment variable:

bash
CONFIG_PATH=/etc/packster/config.yml ./bin/packster

Example config:

yaml
file_upload_limit: 100  # MB, maximum size of an uploaded artifact

mongo:
  connection_string: mongodb://localhost:27017
  database: packster
  token_collection: tokens
  product_collection: products

redis:
  addr: localhost:6379
  password: ""
  db: 0

metrics:
  addr: 0.0.0.0:9091  # Prometheus scrape endpoint (optional, defaults to 0.0.0.0:9091)
FieldDescription
file_upload_limitMax upload size in MB
mongo.connection_stringMongoDB connection URI
mongo.databaseDatabase name
mongo.token_collectionCollection used to store tokens
mongo.product_collectionCollection used to store products
redis.addrRedis address (host:port)
redis.passwordRedis password (optional)
redis.dbRedis database index (optional)
metrics.addrAddress for the Prometheus /metrics endpoint (optional, defaults to 0.0.0.0:9091)

Running

Start the server:

bash
CONFIG_PATH=./config.yml ./bin/packster

To also enable the web UI:

bash
CONFIG_PATH=./config.yml ./bin/packster --ui

By default the server listens on 0.0.0.0:8080. Override with SERVER_ADDR:

bash
SERVER_ADDR=0.0.0.0:9090 CONFIG_PATH=./config.yml ./bin/packster

Starting dependencies with Docker Compose:

A docker-compose.yml is included to spin up MongoDB, Redis, Prometheus, and Grafana locally:

bash
docker compose up -d

This starts:

ServicePortNotes
MongoDB27017Primary data store
Redis6379Token cache
Prometheus9090Scrapes host.docker.internal:9091 every 15 s
Grafana3000Pre-provisioned dashboard at http://localhost:3000 (admin / admin)

Prometheus scrapes the /metrics endpoint exposed by the running packster binary on port 9091. Make sure packster is running before expecting data in Grafana.

Flags

FlagDescription
--init-admin-tokenGenerates an initial admin token on first run. No-op if an admin token already exists.
--uiEnables the web UI served at /ui. Requires an admin token to log in.

Authentication

Every request must include an X-Api-Token header with a valid token.

There are two token types:

  • Admin — can register and manage tokens, create/delete products, and perform all operations.
  • Non-admin — access is controlled per-product through token permissions (upload, download, delete, maintainer).

Creating the first admin token

On first run, pass --init-admin-token to generate an initial admin token:

bash
CONFIG_PATH=./config.yml ./bin/packster --init-admin-token

The token is printed to the log output. Remove the flag after the first use — it is a no-op if an admin token already exists.

Use this token in the X-Api-Token header for all subsequent admin operations, such as registering additional tokens via PUT /api/register.