Giter Club home page Giter Club logo

ipfs-npm-registry-mirror's Introduction

npm on IPFS logo

ipfs-npm-registry-mirror

Build Status Code Coverage Dependency Status

A npm mirror that adds files to IPFS and makes them available over the distributed web!

Usage

# with docker installed
$ git clone https://github.com/ipfs-shipyard/ipfs-npm-registry-mirror.git
$ cd ipfs-npm-registry-mirror
$ ./deploy.sh

Overview

There are two docker images, a replication-master which continually syncs the npm registry and all of its packages and a registry-mirror which serves files to clients.

The replication-master publishes notifications of new packages to the mirrors via pubsub, they then save the CIDs of newly published modules and use them to resolve them on the IPFS network.

You can can either use the public http mirror with npm/yarn (e.g. pass --registry=https://registry.js.ipfs.io to npm or yarn) or use the ipfs-npm client directly.

Lead Maintainer

Alex Potsides

Deployment

Requirements:

  • Docker
  • docker-compose v1.24.0-rc1 or later.
$ git clone https://github.com/ipfs-shipyard/ipfs-npm-registry-mirror.git
$ cd ipfs-npm-registry-mirror
$ echo NODE_ENV=production > .env
$ ./deploy.sh
version: '2'

services:

  proxy:
    image: jwilder/nginx-proxy:alpine
    mem_limit: 1024m
    links:
      - replicate
      - registry
    ports:
      - '80:80'
      - '443:443'
    logging:
      driver: "json-file"
      options:
        max-size: "1m"
        max-file: "3"
    volumes:
      - /var/run/docker.sock:/tmp/docker.sock:ro
      - /etc/nginx/vhost.d
      - /usr/share/nginx/html
      - /etc/nginx/certs
      - ./conf/proxy.conf:/etc/nginx/proxy.conf
    restart: 'always'

  replicate:
    build:
      context: .
      dockerfile: packages/replication-master/Dockerfile
    restart: 'always'
    env_file: .env
    mem_limit: 4608m
    environment:
      - VIRTUAL_HOST=replication.rig.home
      - VIRTUAL_PORT=8080
      - NODE_ENV=${NODE_ENV}
      - EXTERNAL_PROTOCOL=http
      - EXTERNAL_HOST=rig.home
      - EXTERNAL_PORT=80
      - EXTERNAL_IP=192.168.1.112
      - IPFS_STORE_TYPE=fs
      - IPFS_REPO=/usr/local/ipfs-npm-registry-mirror/replication-master
      - FOLLOW_SEQ_FILE=/usr/local/ipfs-npm-registry-mirror/seq.txt
      - CLONE_DELAY=30000
      - FOLLOW_CONCURRENCY=5
      - REQUEST_CONCURRENCY=5
    volumes:
      - /var/run/docker.sock:/tmp/docker.sock:ro
      - /usr/local/ipfs-npm-registry-mirror:/usr/local/ipfs-npm-registry-mirror
    logging:
      driver: "json-file"
      options:
        max-size: "100m"
        max-file: "3"

  registry:
    build:
      context: .
      dockerfile: packages/registry-mirror/Dockerfile
    restart: 'always'
    env_file: .env
    mem_limit: 2048m
    volumes:
      - /var/run/docker.sock:/tmp/docker.sock:ro
    environment:
      - VIRTUAL_HOST=rig.home
      - VIRTUAL_PORT=8080
      - NODE_ENV=${NODE_ENV}
      - EXTERNAL_PROTOCOL=http
      - EXTERNAL_HOST=rig.home
      - EXTERNAL_PORT=80
      - EXTERNAL_IP=192.168.1.112
      - IPFS_STORE_TYPE=fs
      - IPFS_REPO=/usr/local/ipfs-npm-registry-mirror/worker
      - PUBSUB_MASTER=http://replicate:8080
      - REQUEST_MAX_SOCKETS=20
    volumes:
      - /var/run/docker.sock:/tmp/docker.sock:ro
      - /usr/local/ipfs-npm-registry-mirror:/usr/local/ipfs-npm-registry-mirror
    links:
      - replicate
    ports:
      - "10000:10000"
      - "10001:10001"
      - "10002:10002"
      - "10003:10003"
      - "10004:10004"
      - "10005:10005"
      - "10006:10006"
      - "10007:10007"
      - "10008:10008"
      - "10009:10009"
    logging:
      driver: "json-file"
      options:
        max-size: "100m"
        max-file: "3"

ipfs-npm-registry-mirror's People

Contributors

achingbrain avatar andrew avatar jacobheun avatar jaller94 avatar jessicaschilling avatar

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.