Skip to content

Commit

Permalink
docs: remove the K/V setup instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
gabivlj committed Mar 8, 2024
1 parent fc7fcfa commit 24575b0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 20 deletions.
25 changes: 9 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Username/Password and public key JWT based authentication.
### Deployment

You have to install all the dependencies with your favorite package manager (e.g pnpm, npm, yarn, bun...).

```bash
$ npm install
```
Expand All @@ -17,50 +18,42 @@ After installation, there is a few steps to actually deploy the registry into pr
1. Setup the R2 Bucket for this registry

```bash
$ wrangler --env production r2 bucket create r2-registry
$ wrangler --env production r2 bucket create r2-registry
```

Add this to your `wrangler.toml`

```
r2_buckets = [
{ binding = "REGISTRY", bucket_name = "r2-registry"}
]
```

2. Setup the KV namespace for this registry

```bash
$ wrangler --env production kv:namespace create r2_registry_uploads
```

Add the namespace id to your `wrangler.toml`
```
kv_namespaces = [
{ binding = "UPLOADS", id = "<namespace-id-here>"}
]
```

3. Setup the JWT_STATE_SECRET secret binding
2. Setup the JWT_STATE_SECRET secret binding

```bash
$ node -p 'crypto.randomUUID()' | wrangler --env production secret put JWT_STATE_SECRET
```

4. Deploy your image registry
3. Deploy your image registry

```bash
$ wrangler deploy --env production
```

Your registry should be up and running. It will refuse any requests if you don't setup credentials.

### Adding username password based authentication

Set the USERNAME and PASSWORD as secrets with `wrangler secret put USERNAME --env production` and `wrangler secret put PASSWORD --env production`.

### Adding JWT authentication with public key

You can add a base64 encoded JWT public key to verify passwords (or token) that are signed by the private key.
`wrangler secret put JWT_REGISTRY_TOKENS_PUBLIC_KEY --env production`

### Known limitations

Right now there is some limitations with this docker registry.

- Pushing with docker is limited to images that have layers of maximum size 500MB. Refer to maximum request body sizes in your Workers plan.
Expand Down
10 changes: 6 additions & 4 deletions wrangler.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name = "r2-registry"
name = "my-registry-test-now"

workers_dev = true
main = "./index.ts"
Expand All @@ -7,8 +7,10 @@ compatibility_flags = ["streams_enable_constructors"]

## Production
[env.production]
r2_buckets = [{ binding = "REGISTRY", bucket_name = "" }]
kv_namespaces = [{ binding = "UPLOADS", id = "" }]
r2_buckets = [
{ binding = "REGISTRY", bucket_name = "r2-my-registry-test-now-image-registry", preview_bucket_name = "" }
]
kv_namespaces = [{ binding = "UPLOADS", id = "337f00d182aa4640aba3b47cc4c123d1" }]

[env.production.vars]
JWT_REGISTRY_TOKENS_PUBLIC_KEY = ""
Expand All @@ -26,7 +28,7 @@ JWT_REGISTRY_TOKENS_PUBLIC_KEY = ""
r2_buckets = [{ binding = "REGISTRY", bucket_name = "r2-image-registry-dev" }]
kv_namespaces = [{ binding = "UPLOADS", id = "abcd" }]
[env.dev.vars]
REGISTRIES_JSON = "[{ \"registry\": \"http://localhost:9999\", \"password_env\": \"PASSWORD\", \"username\": \"hello\" }]"
# REGISTRIES_JSON = "[{ \"registry\": \"http://localhost:9999\", \"password_env\": \"PASSWORD\", \"username\": \"hello\" }]"
JWT_STATE_SECRET = "HELLO"
USERNAME = "hello"
PASSWORD = "world"
Expand Down

0 comments on commit 24575b0

Please sign in to comment.