Skip to content
This repository has been archived by the owner on Jun 2, 2024. It is now read-only.
fengmk2 edited this page Feb 23, 2016 · 25 revisions

Dependencies

  • Node >= 4.2
  • 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> use cnpmjs;
mysql> source docs/db.sql

Edit Your Own Config File

$ vim config/config.js
 module.exports = {
    debug: false,
    enableCluster: true, // enable cluster mode
    mysqlServers: [
      {
        host: 'localhost',
        port: 3306,
        user: 'cnpmjs',
        password: 'cnpmjs123',
      }
    ],
    mysqlDatabase: 'cnpmjstest',
    enablePrivate: true, // enable private mode, only admin can publish, other use just can sync package from source npm
    admins: {
      admin: 'admin@cnpmjs.org',
    },
    syncModel: 'exist'// 'none', 'all', 'exist'
  };  

Install Dependencies

$ make install

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/config.js, add nfs options:
nfs: require('oss-cnpm').create()
Clone this wiki locally