Git Product home page Git Product logo

serverless-registry's Introduction

Docker Registry in Workers

This repository contains a docker registry implementation in Workers that uses R2.

It supports all pushing and pulling workflows. It also supports 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...).

$ npm install

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

  1. Setup the R2 Bucket for this registry
$ wrangler --env production r2 bucket create r2-registry

Add this to your wrangler.toml

r2_buckets = [
    { binding = "REGISTRY", bucket_name = "r2-registry"}
]
  1. Setup the JWT_STATE_SECRET secret binding
$ node -p 'crypto.randomUUID()' | wrangler --env production secret put JWT_STATE_SECRET
  1. Deploy your image registry
$ 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.
  • 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.

License

The project is licensed under the Apache License.

Contribution

See CONTRIBUTING.md for contributing to the project.

serverless-registry's People

Contributors

dependabot[bot] avatar erisa avatar gabivlj avatar harryzcy avatar ivandev avatar keyskull avatar polvallverdu avatar punkeel avatar skepticfx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

serverless-registry's Issues

atob causing issues with base64

I'm getting the following error with a status code of 500

atob() called with invalid base64-encoded data. (Only whitespace, '+', '/', alphanumeric ASCII, and up to two terminal '=' signs when the input data length is divisible by 4 are allowed.)"

Going to open a PR with my fix (atob is deprecated anyways)

Migrate from existing registry

Can we have a easy way to migrate from existing registry? i.e. Let worker to import from an registry, and triggered by some API, or maybe use the cron trigger
This repo looks promising and I would like to gradually migrate over

Missing push error message.

5f70bf18a086: Pushed
30170ad1cf54: Pushed
b57dae4cd99e: Pushing [==================================================>]  34.36MB
c494be6f7d61: Pushed
cdd7c7392317: Pushing [=================================================> ]  77.21MB/77.81MB
error parsing HTTP 416 response body: no error details found in HTTP response body: "{}"

Sometimes the worker would unexpectedly return a 416 error when pushing images.

Wrangler error related to `logpush = true`

I'm getting the following error running wrangler deploy when logpush is set to true. Logpush is not available to non-enterprise plan, maybe it could be documented. The error message doesn't tell the actual issue.

โœ˜ [ERROR] A request to the Cloudflare API (/accounts/***/workers/scripts/r2-registry) failed.

  workers.api.error.unauthorized [code: 10023]

Related to wrangler: cloudflare/workers-sdk#2991

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.