Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Standardize on pnpm and update deps #35

Merged
merged 6 commits into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,16 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Use Node
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'

- run: npm ci
- run: npm run typecheck
- run: npm test
- run: pnpm install --frozen-lockfile --child-concurrency=10
- run: pnpm run typecheck
- run: pnpm test
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Running the registry is done via `wrangler dev`

```bash
$ wrangler --env dev dev
$ npx wrangler --env dev dev
```

You can `docker login` locally for running a push
Expand All @@ -26,7 +26,7 @@ $ docker tag my-image:local docker tag localhost:8787/my-image:local && docker p
Test the registry with unit tests by running `vitest` with `miniflare 2`.

```bash
$ npm run test
$ pnpm test
```

## Making a change
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ 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...).
You have to install all the dependencies with [pnpm](https://pnpm.io/installation) (other package managers may work, but only pnpm is supported.)

```bash
$ npm install
$ pnpm install
```

After installation, there is a few steps to actually deploy the registry into production:

1. Setup the R2 Bucket for this registry

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

Add this to your `wrangler.toml`
Expand All @@ -32,27 +32,27 @@ r2_buckets = [
2. Deploy your image registry

```bash
$ wrangler deploy --env production
$ npx 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`.
Set the USERNAME and PASSWORD as secrets with `npx wrangler secret put USERNAME --env production` and `npx 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`
`npx 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.
- To circumvent that limitation, you can manually add the layer and the manifest into the R2 bucket or use a client that is able to chunk uploads in sizes less than 500MB (or the limit that you have in your Workers plan).
- If you use `wrangler dev` and push to the R2 registry with docker, the R2 registry will have to buffer the request on the Worker.
- If you use `npx wrangler dev` and push to the R2 registry with docker, the R2 registry will have to buffer the request on the Worker.

## License

Expand Down
2 changes: 1 addition & 1 deletion index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export default {
const ensureConfig = (env: Env): boolean => {
if (!env.REGISTRY) {
console.error(
"env.REGISTRY is not setup. Please setup an R2 bucket and add the binding in wrangler.toml. Try 'wrangler --env production r2 bucket create r2-registry'",
"env.REGISTRY is not setup. Please setup an R2 bucket and add the binding in wrangler.toml. Try 'npx wrangler --env production r2 bucket create r2-registry'",
);
return false;
}
Expand Down
Loading