npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

verdaccio-redis-storage

v1.2.4

Published

A Redis based storage plugin for Verdaccio.

Downloads

35

Readme

verdaccio-redis-storage

All Contributors

npm NPM npm

A Redis based storage plugin for Verdaccio.

Usage

Install

npm install verdaccio-redis-storage

Configuration

store:
  redis-storage:
    host: 127.0.0.1
    port: 6379
    ...

See more in https://github.com/luin/ioredis#connect-to-redis

Note Since v0.2.5, verdaccio-redis-storage changed the redis library from node-redis to ioredis.

About the offline queue

By default, there is no active connection to the Redis server, commands are added to a queue and are executed once the connection is "ready". This is (only) necessary for the verdaccio-redis-storage initialziation, due to the way a verdaccio plugin is being invoked. You should not set the enableOfflineQueue boolean to false in the configuration file.

However, the offline queue feature will be disabled when the first redis connection is ready, to make following web requests fail instantly if a redis connection is down.

Serving tarball

Redis is an in-memory database that is not good at dealing with large tarball files. It's highly recommended to use verdaccio-storage-proxy to decouple the tarball accesses to another storage backend like verdaccio-aws-s3-storage or verdaccio-minio.

Data structure

| Content type | Redis type | Redis key | Hash field | Note | |--------------|------------|---------------------|--------------|----------------| | package list | set | ve:pkgs | - | | | secret | string | ve:secret | - | | | token | hash | ve:token:$user | $tokenKey | | | package.json | hash | ve:pkg:$packageName | package.json | | | tarball | hash | ve:pkg:$packageName | $fileName | base64 encoded |

Data are stored with prefix ve: (testve: for test mode).

Dump and restore

With verdaccio-redis CLI, you can exchange data between redis storage and file system.

Dump and restore commmands don't support token yet.

Goto the package folder where you installed the plugin, run ./node_modules/verdaccio-redis-storage/bin/verdaccio-redis.

$ ./node_modules/verdaccio-redis-storage/bin/verdaccio-redis --help
Usage: verdaccio-redis [options] [command]

verdaccio-redis-storage CLI

Options:
  -V, --version            output the version number
  --config <path>          specify the path of Verdaccio configuration file
  --host <host>            Redis host
  --port <port>            Redis port
  --url <url>              Redis URL string
  --socket <socket>        Redis socket string
  --password <password>    Redis password
  --db <db>                Redis db
  --prefix <prefix>        Redis prefix
  -h, --help               display help for command

Commands:
  dump [options] <dir>     dump Redis storage to dir
  restore [options] <dir>  restore Redis storage from dir
  help [command]           display help for command

You can provide the Redis connection by specifying the Verdaccio config path (--config=...), or extra options like --host and --port. By default, it connects to 127.0.0.1:6379.

Dump redis storage to file system

Use the dump command to export redis storage to the file system. The exported folder can be used by Verdaccio's default file storage.

$ ./node_modules/verdaccio-redis-storage/bin/verdaccio-redis dump --help
Usage: verdaccio-redis dump [options] <dir>

dump Redis storage to dir

Options:
  --no-tarball  ignore tarball files
  --dbname      database filename (default: .verdaccio-db.json)
  -h, --help    display help for command

Use --no-tarball option to ignore export tarball files to the file system. See serving tarball for details.

Use --dbname option to specify a different database filename to write. i.e. for Verdaccio S3 storage, the filename is verdaccio-s3-db.json.

Restore redis storage from file system

Use the restore command to import redis storage from the file system.

./node_modules/verdaccio-redis-storage/bin/verdaccio-redis restore --help
Usage: verdaccio-redis restore [options] <dir>

restore Redis storage from dir

Options:
  --no-tarball  ignore tarball files
  --dbname      database filename (default: .verdaccio-db.json)
  --scan        scan package.json to fill database
  -h, --help    display help for command

Use --no-tarball option to ignore import tarball files to the Redis storage. See serving tarball for details.

Use --dbname option to specify a different database filename to read. i.e. for Verdaccio S3 storage, the filename is verdaccio-s3-db.json.

Use --scan option to scan the package.json file of sub-folders to fill the database. A rare usage to convert cached uplink packages to local packages (uplink packages are not stored to database by defaut).

Development

See the verdaccio contributing guide for instructions setting up your development environment. Once you have completed that, use the following npm tasks.

  • npm run build

    Build a distributable archive

  • npm run test

    Run unit test

For more information about any of these commands run npm run ${task} -- --help.

Reference

Contributors ✨

Thanks goes to these wonderful people (emoji key):

This project follows the all-contributors specification. Contributions of any kind welcome!