HUB
Sign inSign up

tredmann/repahead

By tredmann

•Updated 3 days ago

Image
0

4.0K

tredmann/repahead repository overview

⁠Private Composer Server

A lightweight PHP service that turns a folder of ZIP files into a private Composer⁠ (Packagist-compatible) repository. Drop versioned ZIPs into a folder tree, point your composer.json at the server, and install private packages like any other dependency.

Storage is pluggable via Flysystem⁠ — use local disk or S3-compatible storage. All endpoints are protected by HTTP basic auth.

⁠How it works

  1. Drop ZIPs into the folder tree: zips/vendor/package/1.0.0.zip
  2. The composer.json inside each ZIP is the source of truth for metadata
  3. The server scans storage, builds a packages.json index, and caches it
  4. Composer resolves and downloads packages through the standard repository protocol

⁠Endpoints

MethodRoutePurpose
GET/packages.jsonComposer repository index (cached)
GET/dist/{vendor}/{package}/{version}.zipStreams the ZIP
POST/rebuildForce cache rebuild; returns {packages, versions, skipped, duration_ms}

⁠Quick start

# minimal — only AUTH_PASS is required
docker run -d -p 8080:8080 -e AUTH_PASS=secret tredmann/repahead

# production — set the public URL so dist links resolve correctly
docker run -d \
  -p 8080:8080 \
  -e AUTH_PASS=secret \
  -e APP_BASE_URL=https://composer.your-domain.com \
  -v /path/to/zips:/var/www/html/zips \
  tredmann/repahead

Drop a ZIP and trigger a rebuild:

docker cp ./acme-billing-1.2.0.zip <container>:/var/www/html/zips/acme/billing/1.2.0.zip
curl -u ci:secret -X POST http://localhost:8080/rebuild

⁠Consumer setup

composer config repositories.private composer https://composer.your-domain.com
composer config http-basic.composer.your-domain.com ci <password>
composer require acme/billing:^1.0

⁠Environment variables

VariableDefaultDescription
AUTH_PASS—Required. HTTP basic auth password
AUTH_USERciHTTP basic auth username
APP_BASE_URLhttp://localhost:8080Public base URL; used in packages.json dist download links
STORAGE_DSNlocal:/var/www/html/zipsStorage backend — local:<path> or s3:<bucket>/<prefix>
CACHE_DIR/var/www/html/cacheDirectory for the packages.json cache and hash files
LISTING_TTL_SECONDS30Seconds before the storage listing cache expires; 0 = list on every request
AWS_ACCESS_KEY_ID—S3 only — AWS access key ID
AWS_SECRET_ACCESS_KEY—S3 only — AWS secret access key
AWS_REGION—S3 only — AWS region, e.g. eu-central-1
SERVER_NAME:8080Listen address and port (base image)
AUTOMATIC_HTTPSoffAuto-HTTPS via FrankenPHP/Caddy; keep off behind a reverse proxy (base image)
PHP_OPCACHE_ENABLE1Enable PHP OPcache (base image)

⁠ZIP folder layout

zips/
  vendor/
    package/
      1.0.0.zip
      1.1.0.zip

The folder path determines vendor/package; the filename determines the version. ZIPs that are corrupt, missing composer.json, or whose name field doesn't match the folder path are skipped and logged.

⁠S3 storage

STORAGE_DSN=s3:my-bucket/composer/zips
AWS_ACCESS_KEY_ID=AKIA...
AWS_SECRET_ACCESS_KEY=...
AWS_REGION=eu-central-1

Minimum IAM permissions: s3:ListBucket + s3:GetObject. The service is read-only from S3 — upload ZIPs externally, then POST /rebuild.

Tag summary

Content type

Image

Digest

sha256:962272da6…

Size

84.8 MB

Last updated

3 days ago

docker pull tredmann/repahead