Giter Club home page Giter Club logo

entropic's Introduction

Entropic: a federated package registry for anything

All Contributors Code of Conduct

A new package registry with a new CLI, designed to be easy to stand up inside your network. Entropic features an entirely new file-centric API and a content-addressable storage system that attempts to minimize the amount of data you must retrieve over a network. This file-centric approach also applies to the publication API. See the API section of the manifesto for more details about the API offered.

Entropic assumes many registries co-existing and interoperating as a part of your normal workflow. All Entropic packages are namespaced, and a full Entropic package spec also includes the hostname of its registry.

The legacy node package manager is treated as a read-only archive. You may install legacy packages through your Entropic home instance.

See docs/README.md for the manifesto.

Are you interested in contributing? Do you have some feedback to share? Come talk with us in our Discourse.

What's working

Entropic is self-hosting. That means login, publication, and installation (mostly) are working. There are bugs, many unimplemented features, and the whole thing will probably fall over in a stiff breeze. We feel this is exceeding expectations for a project that's just over a month old.

Our development instance is running at https://registry.entropic.dev/. You'll probably all knock it over trying it out, I just know it.

Overview

Package specifications are fully qualified with the namespace, hostname, and package name. They look like this: [email protected]/pkg-name. For example, the ds cli is specified by [email protected]/ds.

If you publish a package to your local registry that depends on packages from other registries, your local instance will proactively mirror all the packages yours depends on. The goal is to keep each instance entirely self-sufficient, so installs don't have to depend on a resource that might vanish. This is also true of packages installed from the legacy node package manager: they're given the namespace legacy and mirrored.

Abandoned packages are moved to the abandonware namespace.

Every Entropic user has a namespace that matches their user name. They may additionally belong to other namespaces. Packages can be updated by any user in the package's namespace. Packages can also have a list of maintainers.

For example, user chris owns the package [email protected]/ds. Chris can invite ceejbot to maintain ds. If ceejbot accepts, they'll be able to publish new versions of ds. Meanwhile, the package [email protected]/lodash can be maintained by anybody who's a member of the lodash-people namespace. This might include the user jdalton and anybody else jdalton invites. (We hear that jdd gets a dollar every time somebody uses lodash as an example.)

All packages published to Entropic are public. Our expectation is that you'll use something like the GitHub Package Registry if you need to control access to packages you publish. Or you might choose to run an Entropic instance and control access to it another way.

The only thing about Entropic that assumes you're managing javascript packages is the installer. We are open to adding other kinds of installers for other languages.

The ds cli

See INSTALLING to install.

Log in to a registry: ds login. You will be prompted to authenticate using Github.

The ds cli is configured with an .entropicrc file in your home directory. This is a TOML file. Use it to specify your preferred registry, as well as any other registries you use normally.

registry = "http://example.com"

[registries."https://entropic.dev"]
token = "a-valid-entropic-token"

[registries."http://example.com"]
token = "another-valid-entropic-token"

The cli doesn't have a very sensible shell for running commands yet, and it doesn't yet have working help. (Help for help welcomed!) You can see what commands are implemented by browsing the command source folder. See the cli readme for more notes.

At present, if you want to install packages using ds, you can run ds build in a directory with a Package.toml. This will produce a ds/node_modules directory, which you can move into place by hand. This is a temporary situation!

Packages

Packages are described by TOML files giving metadata and listing dependencies.

Here's an example Package.toml:

name = "[email protected]/ds"
version = "0.0.0-beta"

[dependencies]
"@iarna/toml" = "^2.2.3"
"[email protected]/figgy-pudding" = "^3.5.1"
[...]

Publish a new package-version with ds publish.

Contributing

Entropic is, at the moment of this writing, the work of two people: Chris Dickinson and C J Silverio. They are not sponsored by anybody nor do they represent anyone but themselves. Chris and Ceej are seeking additional contributors but wish to onboard newcomers slowly. The project is new enough that clear direction does not always exist in the code, so contributors will need to work closely with us.

For more, see Contributing and our Code of Conduct.

Moderators

Contributors

Nick Schonning
Nick Schonning

πŸ“–
Sergey
Sergey

πŸ’»
James
James

πŸ“– πŸ’»
Zac Anger
Zac Anger

πŸ’»
Todd Kennedy
Todd Kennedy

πŸ’»
SΓ©bastien Cevey
SΓ©bastien Cevey

πŸ’»
Nikhil Ranjan
Nikhil Ranjan

πŸ’»
Nick Olinger
Nick Olinger

πŸ’»
Jonathan Weiss
Jonathan Weiss

πŸ’»
Andrew Nesbitt
Andrew Nesbitt

πŸ“–
Brenna Flood
Brenna Flood

πŸ“–
Aaron Ross
Aaron Ross

πŸ“– πŸ’»
C J Silverio
C J Silverio

πŸ’» πŸ“–
Chris Dickinson
Chris Dickinson

πŸ’» πŸ“–
Aria Stewart
Aria Stewart

πŸ’»
Pranshu Chittora
Pranshu Chittora

πŸ“–
Kate Beard
Kate Beard

πŸ“–
Zeke Sikelianos
Zeke Sikelianos

πŸ’»
Sam Saccone
Sam Saccone

πŸ“–
Mohamed Badawi
Mohamed Badawi

πŸ’»
Wes Mason
Wes Mason

πŸ’»
Alfredo Miranda
Alfredo Miranda

πŸ’»
Kirill Enykeev
Kirill Enykeev

πŸ’»

LICENSE

This project is released under the Apache 2.0 license.

entropic's People

Contributors

1stvamp avatar allcontributors[bot] avatar andrew avatar captemulation avatar ceejbot avatar chrisdickinson avatar emkay avatar enykeev avatar fetis avatar flxwu avatar gribnoysup avatar ivandevp avatar jonathanweiss avatar josemaia avatar mikesamuel avatar moogacs avatar niklabh avatar nschonni avatar olingern avatar pranshuchittora avatar rsmelo avatar rwjblue avatar samccone avatar sbinlondon avatar sdawson avatar theefer avatar toddself avatar zacanger avatar zeke avatar zkat 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  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

entropic's Issues

Error on `ds login`

After running curl -sSL https://www.entropic.dev/install.sh | bash, trying ds login gives the error below:

Error: /Users/flxwu/.entropicrc
    at load (/Users/flxwu/.nvm/versions/node/v8.11.4/lib/node_modules/ds/lib/config.js:21:11)
    at main (/Users/flxwu/.nvm/versions/node/v8.11.4/lib/node_modules/ds/lib/main.js:19:26)
    at Object.<anonymous> (/Users/flxwu/.nvm/versions/node/v8.11.4/lib/node_modules/ds/lib/main.js:49:3)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Function.Module.runMain (module.js:693:10)
    at startup (bootstrap_node.js:191:16)

fill out the cli with useful commands

  • help
  • add-maintainer/remove-maintainer
  • namespace-create (need to talk about namespace-yank)
  • add-to-namespace / remove-from-namespace
  • abandon/yank package
  • deprecate/yank package-version

Depends on:
#52
#53

Issue should probably get broken up but I wanted to record the work somewhere.

We should probably discuss our approach toward command design. As an opening salvo I will say that I prefer short words for commands and no elaborate options for the targets of those commands. Argument order should preferably not be meaningful, or if meaningful unambiguous given existing context.

Example: ds add-maintainer chrisdickinson namepace/pkg is unambiguous in this example, but hard to predict without an example. Is it ds add-maintainer target-package target-human or does the human go first? Maybe it's great, though, because that last argument can be implicit if you're in a directory with a package.json.

ds add-maintainer user=chrisdickinson pkg=namespace/pkg is unambiguous but kinda weird.

ds maintainers add chrisdickinson to namespace/pkg is unambiguous if you speak English, might be hard to parse or translate.

yank is internal jargon that means two things: 'abandon' and 'deprecate'. Do we want to just let the jargon leak out into the user experience?

mirroring one entropic to another should be possible

It should be easy (eventually; possible is a good start) to point one entropic instance at another and make a read-only mirror of its packages. Perhaps the packages would go under a namespace that is the sitename of the site being mirrored?

Chris's TODO list

Here's what I'm thinking the priority list is:

  • tests
    • fix linting
  • validation
  • offline work
    • syncing
      • create legacy maintainer link to synced packages
    • revalidation
    • unify sync and publish
  • EMFILE in storage layer
  • s3 backend
  • cli
    • bin files
    • better output on publish
    • init
    • help functionality (thanks @toddself!)
    • build
      • devDependencies
      • install
      • install
      • stanza bonanza (support the following load-bearing stanzas from package.json in Package.toml & package-versions)
        • bin stanza
        • main stanza
  • www
    • styles?
    • separate process

Implement publication

Authenticated, authorized users can:

  • create new packages
  • publish new package-versions

GraphQL based API?

First, congrats on the project!
I was not present in the announcement in the JS Conf EU but it looks like it was amazing.

At my company, Wasmer, we created a WebAssembly Package Manager and used GraphQL for the API. We iterated very quickly with it.

I would really recommend to use GraphQL as a first class citizen for the API, it helps both for the perspective of the server and also for any client using it.
It could also help for any other entity trying to launch a registry that is complaint with your API (since they will just need to validate the their schema against the official one).

Hopefully it's useful... keep up the great work! πŸ‘

Have a localization story

Inspired by the closing keynote of JSConf EU. We have some gestures toward localizability in error codes, but we need to be rigorous about it. Also, we need to have a plan for getting there with the client.

the cli invitation & joining commands need some cleanup

The conflation between packages and namespaces isn't so great. Right now, it's ds invite <user|namespace> --to <namespace|package>. This is fairly clear about the order of arguments if you speak English, but what can you can invite to what isn't so obvious.

Some facts:

  • Namespaces can have many users. You invite users to namespaces.
  • Packages are maintained by namespaces. You invite namespaces to package.
  • Users accept or decline invitations to namespaces as their logged-in selves.
  • Users accept or decline invitations to maintain packages on behalf of namespaces.

I suggest adding a --namespace or --package parameter to make it unambiguous.

  • ds invite potter --namespace gryffindor: dumbledore invites potter to gryffindor
  • ds accept --namespace gryffindor: potter accepts
  • ds invite malfoy --namespace gryffindor: potter invites malfoy
  • ds decline --namespace gryffindor: malfoy declines
  • ds invite gryffindor --package quiddich-cup: dumbledore invites gryffindor to maintain the quiddich-cup package
  • ds accept --package quiddich-cup --as gryffindor: potter accepts the invitation to maintain the cup on behalf of gryffindor
  • ds remove malfoy --package quiddich-cup: potter removes malfoy-the-namespace from the quiddich cup

To fill out the interactions for the invitations feature, I propose changing ds invitations as follows:

  • ds invitations --packages: list all maintainership invitations the logged-in user can accept
  • ds invitations: list all namespace invitations for the logged-in user

In each case, the invitations lister gives the exact commands the user can run to accept.

Script support?

Hello and thanks for the project. It’s not clear from the manifesto will it be possible to have package scripts? At the moment it’s very handy part of package.json

implement a blocklist

Are blocklists a thing? I sometimes wish I could block anything from ever installing oniguruma in any project I work on.

implement whoami

There's a function registered as a handler for /-/whoami but it isn't implemented yet

package.json support

Supporting json based description of package seems pretty important, even support for incompatible version of package.json would be a plus.

And my personal preference would be also adding an option to load package description as a js object (without necessity of placing quotes) and with possibility to define scripts not only as a shell commands, but also as functions to which command line arguments and environment variables are passed.

{
  name: "[email protected]/ds",
  version: "0.0.0-beta",

  scripts: {
    test: "node test.js" // classic shell script
    compile: function(args, env, shell) {
      shell.run("ts " + args[0]);
    }
  },

  dependencies: {
      "@iarna/toml": "^2.2.3",
      "[email protected]/figgy-pudding": "^3.5.1"
  }
}

Your solution could support all these 3 formats (toml > json > js like)

create list of reserved/disallowed namespaces

Things like abandonware, legacy, and git will already be in use in entropic. Other names might need to be disallowed to prevent user confusion. This might belong in an editable text file. Think it through.

fall back to cached version on timeout

If the registry we're providing a read-through cache for is down or slow, we want to short-circuit and respond with what's in cache. Ideally we'd be able to configure the timeout.

battle-harden for public announcement

  • elastic IP
  • repoint dns to the eip
  • upsize the instance from t3.medium maybe
  • backups or other safety mechanism for the packages
  • redis -> small elasticache
  • postgres -> small rds

block on security problem

This is a feature we can let wait, but it would be neat to block a package-version with a security warning associated.

build a new entropic instance setup flow

Key config concepts like:

  • set the hostname, so users created on this instance have a fully-qualified name
  • create the first user
  • set up admin privileges for that first user
  • or perhaps build in an admin user with randomly-generated credentials that the owner must store or change somehow

This all should take place out of band of the website, preferably.

implement a project about page

It would be good to introduce the world to the project, what its goals are, what its goals aren't, and how people can help if they want to.

`ds run` needs to work

Run scripts.

start
pre-start
pre-pre-start etc etc
test
-- to pass arguments to a script
the bash environment set up to make things run

Accept GitHub, or other foreign, credentials

It would simplify MAINTAINER's workflow if they could use GitHub, or other foreign credentials to tie to their registry account. This would simplify team management (e.g. one could setup so that anyone with push access to the repo can publish, etc.).

implement an allow list

I just ripped this out when I ripped out the legacy proxy endpoints, but it would be a nice-to-have feature for the core registry.

split out internal & external APIs

If we have workers doing things, we suddenly need an API for the workers to talk to. This API should not be the same thing as the one we expose to the outside world. CONGRATS we've just grown a second service! Make it happen.

implement namespaces workflow

Invitations should be working already, more or less. We need to fill out the namespaces workflow.

First: The two-booleans approach to mark status is not so great. We need a status enum. Valid statuses for namespace_memberships:

  • active: has full privileges
  • invited: has been asked to join
  • inactive: a rejected invitation or removed member is inactive; can be invited again
  • banned: cannot be invited again (trying to anticipate a future need here)

Invitations & permissions code will need to be updated;

After that, we can fill out the namespaces feature:

  • There should be a way to create namespaces in the cli.
  • The api endpoint that creates a namespace should make the logged-in user a member of the namespace.

Implement 2FA

Implement flows for enabling and disabling 2FA, including using recovery codes.

Implement login flow for 2FA. (This looks like "oauth success -> user requires 2fa, enter otp code -> on success continue, on error retry")

finish the package maintainerships workflows

Two api endpoints to implement here, at least:

  • /packages/authored-by/:namespace : packages owned by the namespace ("namespace" is in their name0
  • /packages/maintained-by/:namespace: packages that the namespace has write permissions for (not necessarily in that namespace). Now that I think about it, shouldn't that be packages the user can write? Users are part of namespaces, and users have maintainership relationships with packages, so... (@chrisdickinson confirm intentions here?)

Then implement cli commands to invoke these endpoints.

Consider using ipfs or other existing content addressable stores for tarballs.

In the readme you mentioned that you want to use a content addressable storage.

There are existing content addressable systems like IPFS that you can leverage.

I’ve recently spoken with IPFS engineers and they are really interested in making IPFS easy to use for package managers so they might be open to implement features you need.

s3 option for backing store

pacote uses cacache which has a file system backing. We need to make s3 or some other kind of object store available as a pluggable storage engine.

write registry tests enough to get code coverage to 80%

We don't have tests. It will help potential contributors contribute if we have tests. We should write some.

We should see if we can make it easier to build a test rig for the registry, or if the provider-function approach we have now is enough.

administrative tools

We need some kind of administrative tools to provide a first-line counter to abusive content, spam content, or just plain illegal content. These tools will need to do at least the following:

  • delete individual packages
  • ban users and delete all their packages

implement a basic website

Right now we have just enough website to do an oauth flow. We need one that shows package information.

Under load, pino (via sonic-boom, via flatstr) crashes

Looks like maybe sonic-boom's "expose intrinsics" approach may need to be updated to work with Node 12?

return typeof s === "string" ? %FlattenString(s) : s
                               ^

SyntaxError: Unexpected token %
    at actualWrite (/Users/chris/projects/personal/entropic/src/node_modules/sonic-boom/index.js:242:3)
    at SonicBoom.write (/Users/chris/projects/personal/entropic/src/node_modules/sonic-boom/index.js:142:5)
    at Pino.write (/Users/chris/projects/personal/entropic/src/node_modules/pino/lib/proto.js:136:43)
    at Pino.LOG [as error] (/Users/chris/projects/personal/entropic/src/node_modules/pino/lib/tools.js:35:26)
    at Timeout._onTimeout (/Users/chris/projects/personal/entropic/src/registry/middleware/dev-only.js:36:16)
    at listOnTimeout (internal/timers.js:531:17)
    at processTimers (internal/timers.js:475:7)

make the cli installable somehow

Lots of options:
Publish it to a legacy-api registry so existing clients can install it.
Put the tarball somewhere existing clients can install from.
And publish it to the home entropic node so it can self-update. (Well, if it can self-update. I sense a research topic.)

Preferred option: curl to shell.

Website requirements

Replacing #27 in order to pin this. I want give more context on the pending software design decisions we need to make in order to build out a website (this affects #102 and #103, which are much appreciated!)

the problem

Entropic needs a website, because:

  1. In order to allow people to sign up for accounts, we use GitHub OAuth login for signup and token creation
  2. In order to allow people to manage their account, we display a token management UI.
  3. In order to aid discovery & vetting of packages, we want to display information about packages (dependencies, dependents, etc.)
  4. In order to aid vetting of packages, we want to display information about package contents (styled, rendered package contents as html)

The current website doesn't have any styles, is likely inaccessible, and is hard for developers to extend. Importantly, it's also embedded into the registry service, which could present security & caching concerns down the line.

constraints, rakes in the yard, & open questions

splitting into services

At present, Entropic runs in a single process. Because certain tasks (like syncing external packages) are too time-consuming to run in the duration of a request/response cycle, we need to split this out into multiple services. Eventually, I believe we'll need 4 services:

  1. The existing external registry API service we expose today, talking to...
  2. A ✨new✨ internal api encapsulating our data stores that the website, worker, and registry service can leverage.
  3. A ✨new✨ external website service talking to that same internal api
  4. A ✨new✨ worker service for processing syncing requests, talking to the internal api

For the production entropic instance, @ceejbot took a clever approach with nginx proxy_pass's so that we can simulate privileged APIs for the website to use by mounting them on the registry at non-exposed routes (for example, /private/.) This lets us start working on the website without having completed the other two ✨new✨ apis. However, until we split out the website process from the registry process, web handlers will use HTTP clients to talk to internal handlers in the same process. We'll start this process for the registry as well.

This is quite a mouthful: this is all to say that when the website starts needing to get at registry data, please pull in @chrisdickinson and/or @ceejbot.

Single page app or Server Side Template Language?

We'll want to consider whether we use a server-side templating language like Nunjucks to render pages in a traditional fashion, or go a single page app route using something like React + Next.js. Right now I am leaning towards server side templating using Nunjucks (or similar):

  • Our present Oauth & CLI signup needs lean on url routing. (They could, yanno, not. But.)
  • Our form needs are pretty basic.
  • SPA's introduce a certain level of maintenance complexity (bundling FE assets, etc.) Next solves this pretty nicely, which is one of the (many) things I like about it, but it's still a cost.

I could be wrong here, so please poke holes in this. What are we buying with a single page app?

CSS

Let us do the simplest thing that works, then iterate. I propose we use Tachyons for a base coat, then specialize with an added stylesheet. (When this gets unwieldy, that's when we should start looking into css-modules or css-in-js as an additional layer on top of tachyons.)

implement list/add/remove maintainers for packages

API probably looks like this:

  • GET /packages/package/:namespace/:name/maintainers
  • PUT /packages/package/:namespace/:name/maintainers/:maintainer
  • DEL /packages/package/:namespace/:name/maintainers/:maintainer

NB: package maintainers are a separate concept from namespace members. Namespace members implicitly get write access to all packages in the namespace.

fingerprint trusted entropic instances

The threat model is: somebody inherits the domain name for a server, gets a valid cert for it, and then runs an entropic with malware-injected versions of the packages from the original entropic instance. Proposal: If one entropic instance installs packages from another, they should exchange some kind of fingerprint that identifies them to each other. Sweat the details, find a good solution.

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.