랩2 설치

7235 단어 nginxphp-소기centos
랩2 설치
준비 작업
1、   node
2、git
3、redis
4、mysql

위의 모든 설치가 완료되었는지 확인하십시오
      :rap2-dolores         :rap2-delos    ,          

서버 delos 환경 구축
서버 코드 다운로드
git clone https://github.com/thx/rap2-delos.git

프로파일
  :rap2-delos/src/config
  :config.dev.ts;config.local.ts;config.prod.ts                  
  :config.dev.ts   db   username,password                   

위의 세 개의 구성 파일 config.*.tx 모두 수정해야 합니다. 주로 mysql에 대한 수정입니다.
import { IConfigOptions } from "../types";
let config: IConfigOptions =  {
    version: '2.3',
    serve: {
        port: 8080,  //                   8080,                   
    },
    keys: ['some secret hurr'],
    session: {
        key: 'rap2:sess',
    },
    db: {
        dialect: 'mysql',
        host: 'localhost',
        port: 3306,
        username: 'root',//  
        password: ''mysqlpw',//   
        database: 'RAP2_DELOS_APP',//                  
        pool: {
            max: 80,
            min: 0,
            idle: 20000,
            acquire: 20000,
        },
        logging: false,
    },
    // redis       
    redis: {
        host: process.env.REDIS_URL || 'localhost',
        port: (process.env.REDIS_PORT && parseInt(process.env.REDIS_PORT)) || 6379
    },
    mail: {
      host: 'smtp-mail.outlook.com',
      port: 587,
      secure: false,
      auth: {
          user: '[email protected]',
          pass: ''
      }
    },
    mailSender: '[email protected]',
}

export default config

데이터베이스 만들기
                    RAP2_DELOS_APP

mysql -uroot -p -e 'CREATE DATABASE IF NOT EXISTS RAP2_DELOS_APP DEFAULT CHARSET utf8 COLLATE utf8_general_ci';

종속 패키지 설치
       
# cd rap2-delos
        
# npm install
    PM2               
# npm install -g pm2
   TypeScript    
# npm install typescript -g

데이터베이스 초기화
      
# npm run build
          rimraf: command not found      npm install rimraf --save-dev -g             

                                
# npm run create-db
       sh: cross-env: command not found       npm install --save-dev cross-env -g

코드 사양 확인
# npm run check
       sh: tslint: command not found       npm install -g tslint typescript



시작 항목 아래의 두 가지 다른 시작 방식
                                (        ,     )
# npm run dev

              
# npm start

                   ,   node    10    ,             nvm use v10.15.0

제대로 부팅되었는지 확인
1、                   
# pm2 log

DATABASE √
HOST     localhost
PORT     3306
DATABASE RAP2_DELOS_APP

2、      ip:8080        8080   [        ]

RAP2       ,      (rap2-dolores)  。 RAP2 back-end server is started, please visit via front-end service (rap2-dolores).

FAQ
배포 문제
1、  npm run create-db  ,  Unable to connect to the database:{ SequelizeAccessDeniedError: Access denied for user 'root'@'localhost' (using password:NO)}

      :   rap2-delos/src/config          ,                          
    :  config.dev.ts         

             ,  npm run create-db    ,              dist  ,   ,                 

2、  npm run dev  ,  Error: listen EADDRINUSE :::8080
      :8080      
        :     8080      


3、  npm install   ,  hiredis       
      :     rap2-delos/node_modules/hiredis  
        :sudo npm install
        sudo: npm: command not found,    stackoverflow-npm,stackoverflow-node

4、  npm run dev      ,npm start          
      :   pm2 logs        
    
5、  :   Redis      ,      

    ReplyError: Ready check failed: DENIED Redis is running in protected mode because protected mode is enabled, no bind address was specified, no authentication password is requested to clients. In this mode connections are only accepted from the loopback interface. If you want to connect from external computers to Redis you may adopt one of the following solutions: 

    1) Just disable protected mode sending the command 'CONFIG SET protected-mode no' from the loopback interface by connecting to Redis from the same host the server is running, however MAKE SURE Redis is not publicly accessible from internet if you do so. Use CONFIG REWRITE to make this change permanent. 
    2) Alternatively you can just disable the protected mode by editing the Redis configuration file, and setting the protected mode option to 'no', and then restarting the server. 
    3) If you started the server manually just for testing, restart it with the '--protected-mode no' option. 
    4) Setup a bind address or an authentication password. 
    NOTE: You only need to do one of the above things in order for the server to start accepting connections from the outside.
    :   --protected-mode no    

클라이언트dolores 환경 구축
소스 코드 가져오기
git clone https://github.com/thx/rap2-dolores.git
           ,           https://github.com/thx/rap2-dolores.git         

프로파일
  :rap2-dolores/src/config
  :config.dev.ts;    dev,      ,    
  :config.dev.ts  ,serve        rap2-delos         ,  :'http://localhost:8080'

최종 수정 아래 설정 파일은 다음과 같습니다 ip에서 127.0.0.1을 사용할 수 없습니다 서버 ip를 사용하십시오
module.exports = {
  serve: 'http://ip:8080',
  keys: ['some secret hurr'],
  session: {
    key: 'koa:sess'
  }
}

프로젝트 종속 패키지 설치
# npm install  【       】

  

gyp ERR! configure error 
gyp ERR! stack Error: EACCES: permission denied, mkdir '/data/wwwroot/rap2-dolores/node_modules/node-sass/.node-gyp'

    

1、        .npmrc  ,          
phantomjs_cdnurl=http://cnpmjs.org/downloads
sass_binary_site=https://npm.taobao.org/mirrors/node-sass/
registry=https://registry.npm.taobao.org

2、      node-sass 
# npm uninstall node-sass
3、    
# npm install -g node-sass

              
ERR! configure error 
gyp ERR! stack Error: EACCES: permission denied, mkdir '/data/wwwroot/rap2-dolores/node_modules/node-sass/.node-gyp'

     npm
# npm install -g cnpm --registry=https://registry.npm.taobao.org
  cnpm   node-sass
# cnpm install -g node-sass

         npm install


시작 항목 컴파일
01、                
# npm run dev
  :    
# npm run test

02、        React    
# npm run build

서버 설정
    nginx             build             
        8181          
 server {
    listen 8181;
    server_name _;
    
    root /data/wwwroot/rap2-dolores/build;
    index index.html index.htm;
 
    location / {
        try_files $uri /index.html;
    }
 
    error_page 500 502 503 504 /500.html;
}

        
# systemctl reload nginx

     ip:8181    

                  rap2-dolores/src/config/config.dev.ts    ip        ip    127.0.0.1

module.exports = {
  serve: 'http://ip:8080',
  keys: ['some secret hurr'],
  session: {
    key: 'koa:sess'
  }
}

           npm run build    

참고 문장

좋은 웹페이지 즐겨찾기