Skip to content

Commit 9368d5c

Browse files
authored
Update README to reflect current CLI flags, Postgres, and S3 support (#33)
The README still referenced old flag names (-storage, -database) and was missing documentation for Postgres and S3 storage backends that have since been added. Also bumps the listed Go version from 1.23 to 1.25.
1 parent 599fe9e commit 9368d5c

1 file changed

Lines changed: 71 additions & 27 deletions

File tree

README.md

Lines changed: 71 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -352,23 +352,28 @@ The proxy can be configured via:
352352
### Command Line Flags
353353

354354
```
355-
-config string Path to configuration file
356-
-listen string Address to listen on (default ":8080")
357-
-base-url string Public URL of this proxy (default "http://localhost:8080")
358-
-storage string Path to artifact storage directory (default "./cache/artifacts")
359-
-database string Path to SQLite database file (default "./cache/proxy.db")
360-
-log-level string Log level: debug, info, warn, error (default "info")
361-
-log-format string Log format: text, json (default "text")
362-
-version Print version and exit
355+
-config string Path to configuration file
356+
-listen string Address to listen on (default ":8080")
357+
-base-url string Public URL of this proxy (default "http://localhost:8080")
358+
-storage-url string Storage URL (file:// or s3://)
359+
-storage-path string Path to artifact storage directory (deprecated, use -storage-url)
360+
-database-driver string Database driver: sqlite or postgres (default "sqlite")
361+
-database-path string Path to SQLite database file (default "./cache/proxy.db")
362+
-database-url string PostgreSQL connection URL
363+
-log-level string Log level: debug, info, warn, error (default "info")
364+
-log-format string Log format: text, json (default "text")
365+
-version Print version and exit
363366
```
364367
365368
### Environment Variables
366369
367370
```bash
368371
PROXY_LISTEN=:8080
369372
PROXY_BASE_URL=http://localhost:8080
370-
PROXY_STORAGE_PATH=./cache/artifacts
373+
PROXY_STORAGE_URL=file:///var/cache/proxy/artifacts
374+
PROXY_DATABASE_DRIVER=sqlite
371375
PROXY_DATABASE_PATH=./cache/proxy.db
376+
PROXY_DATABASE_URL=postgres://user:pass@localhost/proxy?sslmode=disable
372377
PROXY_LOG_LEVEL=info
373378
PROXY_LOG_FORMAT=text
374379
```
@@ -380,10 +385,11 @@ listen: ":8080"
380385
base_url: "http://localhost:8080"
381386

382387
storage:
383-
path: "/var/cache/proxy/artifacts"
388+
url: "file:///var/cache/proxy/artifacts"
384389
max_size: "10GB" # Optional: evict LRU when exceeded
385390

386391
database:
392+
driver: "sqlite"
387393
path: "/var/lib/proxy/cache.db"
388394

389395
log:
@@ -406,6 +412,43 @@ Run with config file:
406412
./proxy -config /etc/proxy/config.yaml
407413
```
408414

415+
### PostgreSQL
416+
417+
SQLite is the default and works well for single-node deployments. For multi-node setups or if you prefer a managed database, switch to Postgres:
418+
419+
```yaml
420+
database:
421+
driver: "postgres"
422+
url: "postgres://user:password@localhost:5432/proxy?sslmode=disable"
423+
```
424+
425+
Or via environment variables:
426+
427+
```bash
428+
PROXY_DATABASE_DRIVER=postgres
429+
PROXY_DATABASE_URL=postgres://user:password@localhost:5432/proxy?sslmode=disable
430+
```
431+
432+
The proxy creates tables automatically on first run.
433+
434+
### S3 Storage
435+
436+
The proxy can store cached artifacts in S3 or any S3-compatible service (MinIO, R2, etc.) instead of the local filesystem.
437+
438+
```yaml
439+
storage:
440+
url: "s3://my-bucket-name?region=us-east-1"
441+
```
442+
443+
For S3-compatible services like MinIO:
444+
445+
```yaml
446+
storage:
447+
url: "s3://my-bucket?endpoint=http://localhost:9000&disableSSL=true&s3ForcePathStyle=true"
448+
```
449+
450+
Set credentials via standard AWS environment variables (`AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, `AWS_REGION`).
451+
409452
## CLI Commands
410453

411454
### serve (default)
@@ -429,7 +472,10 @@ proxy stats
429472
proxy stats -json
430473
431474
# Custom database path
432-
proxy stats -database /var/lib/proxy/cache.db
475+
proxy stats -database-path /var/lib/proxy/cache.db
476+
477+
# With PostgreSQL
478+
proxy stats -database-driver postgres -database-url postgres://user:pass@localhost/proxy
433479
434480
# Show top 20 most popular packages
435481
proxy stats -popular 20
@@ -741,25 +787,23 @@ sudo systemctl start proxy
741787

742788
### Docker
743789

744-
```dockerfile
745-
FROM golang:1.23-alpine AS build
746-
WORKDIR /app
747-
COPY . .
748-
RUN go build -o proxy ./cmd/proxy
790+
A Dockerfile is included in the repo. Build and run:
749791

750-
FROM alpine:latest
751-
RUN apk --no-cache add ca-certificates
752-
COPY --from=build /app/proxy /usr/local/bin/
753-
EXPOSE 8080
754-
VOLUME ["/data"]
755-
CMD ["proxy", "-storage", "/data/artifacts", "-database", "/data/proxy.db"]
792+
```bash
793+
docker build -t proxy .
794+
docker run -p 8080:8080 -v proxy-data:/data proxy
756795
```
757796

758-
Build and run:
797+
With Postgres and S3:
759798

760799
```bash
761-
docker build -t proxy .
762-
docker run -p 8080:8080 -v proxy-data:/data proxy
800+
docker run -p 8080:8080 \
801+
-e PROXY_DATABASE_DRIVER=postgres \
802+
-e PROXY_DATABASE_URL=postgres://user:pass@db:5432/proxy \
803+
-e PROXY_STORAGE_URL=s3://my-bucket?region=us-east-1 \
804+
-e AWS_ACCESS_KEY_ID=... \
805+
-e AWS_SECRET_ACCESS_KEY=... \
806+
proxy
763807
```
764808

765809
### Behind a Reverse Proxy
@@ -814,7 +858,7 @@ cache/artifacts/
814858
└── nginx-1.24.0-1.fc39.x86_64.rpm
815859
```
816860

817-
Cache metadata is stored in an SQLite database. To clear the cache:
861+
Cache metadata is stored in SQLite (default) or PostgreSQL. To clear a local cache:
818862

819863
```bash
820864
rm -rf ./cache/artifacts/*
@@ -826,7 +870,7 @@ The proxy will recreate the database on next start.
826870
## Building from Source
827871

828872
Requirements:
829-
- Go 1.23 or later
873+
- Go 1.25 or later
830874

831875
```bash
832876
git clone https://github.com/git-pkgs/proxy.git

0 commit comments

Comments
 (0)