[go: up one dir, main page]

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

Dependencies

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

Deploy from source code

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 config file

replace local file system with your preferred storage service. see https://github.com/cnpm/cnpmjs.org/wiki/NFS-Guide

$ vim config/config.js

config database and admin's username

 module.exports = {
    debug: false,
    enableCluster: true, // enable cluster mode
    enablePrivate: true, // enable private mode, only admin can publish, other user 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