Skip to content
This repository has been archived by the owner on Jun 2, 2024. It is now read-only.
rhinoceros.xn edited this page Sep 15, 2018 · 25 revisions

Dependencies

  • Node >= 6.11.3
  • MySQL >= 0.5.0, include mysqld and mysql cli
  • Simple File Store Service, like qiniu, aliyun-oss, tfs, upyun

Deploy With NPM Module [not recommend]

Deploy From Source Code [recommend]

Get the Code

# clone from github
$ git clone git://github.com/cnpm/cnpmjs.org.git $HOME/cnpmjs.org
$ cd $HOME/cnpmjs.org

# create mysql tables
$ mysql -u yourname -p
mysql> create database cnpmjs
mysql> use cnpmjs;
mysql> source docs/db.sql

Edit Your Own Config File

Replace qiniu CDN with Your Own CDN System
$ vim config/config.js
 module.exports = {
    debug: false,
    enableCluster: true, // enable cluster mode
    enablePrivate: true, // enable private mode, only admin can publish, other use just can sync package from source npm
    database: {
		db: 'cnpmjstest',
        host: 'localhost',
        port: 3306,unknown database cnpmjs
        username: 'cnpmjs',
        password: 'cnpmjs123'  
    },
    admins: {
      admin: 'admin@cnpmjs.org',
    },
    syncModel: 'exist'// 'none', 'all', 'exist'
  };  

Install Dependencies

$  npm install --build-from-source --registry=https://registry.npm.taobao.org --disturl=https://npm.taobao.org/mirrors/node

Run

$ npm run start

Check

#open registry and web
# registry
open http://localhost:7001
# web
open http://localhost:7002

Replace qiniu CDN with Your Own CDN System

See an example with oss: oss-cnpm

Use oss-cnpm:

$ cd $HOME/cnpmjs.org
$ cnpm install oss-cnpm
  • Then edit the config/index.js, add nfs options:
nfs: require('oss-cnpm').create({
    accessKeyId: 'YOUR_OSS_AccessKeyID',
    accessKeySecret: 'YOUR_OSS_AccessKeySecret:',
    // change to your endpoint
    endpoint: 'YOUR_OSS_Endpoint',
    bucket: 'YOUR_OSS_Bucket',
    mode: 'private',
  }),
Clone this wiki locally