Installation
Installation
Clone the repository and build the binary:
git clone https://github.com/IdanKoblik/packster
cd packster
make buildThe binary is written to bin/packster.
Configuration
Packster is configured with a YAML file. Point to it with the CONFIG_PATH environment variable:
CONFIG_PATH=/etc/packster/config.yml ./bin/packsterExample config:
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)| Field | Description |
|---|---|
file_upload_limit | Max upload size in MB |
mongo.connection_string | MongoDB connection URI |
mongo.database | Database name |
mongo.token_collection | Collection used to store tokens |
mongo.product_collection | Collection used to store products |
redis.addr | Redis address (host:port) |
redis.password | Redis password (optional) |
redis.db | Redis database index (optional) |
metrics.addr | Address for the Prometheus /metrics endpoint (optional, defaults to 0.0.0.0:9091) |
Running
Start the server:
CONFIG_PATH=./config.yml ./bin/packsterTo also enable the web UI:
CONFIG_PATH=./config.yml ./bin/packster --uiBy default the server listens on 0.0.0.0:8080. Override with SERVER_ADDR:
SERVER_ADDR=0.0.0.0:9090 CONFIG_PATH=./config.yml ./bin/packsterStarting dependencies with Docker Compose:
A docker-compose.yml is included to spin up MongoDB, Redis, Prometheus, and Grafana locally:
docker compose up -dThis starts:
| Service | Port | Notes |
|---|---|---|
| MongoDB | 27017 | Primary data store |
| Redis | 6379 | Token cache |
| Prometheus | 9090 | Scrapes host.docker.internal:9091 every 15 s |
| Grafana | 3000 | Pre-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
| Flag | Description |
|---|---|
--init-admin-token | Generates an initial admin token on first run. No-op if an admin token already exists. |
--ui | Enables 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:
CONFIG_PATH=./config.yml ./bin/packster --init-admin-tokenThe 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.