랩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
참고 문장
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
간단! Certbot을 사용하여 웹 사이트를 SSL(HTTPS)화하는 방법초보자가 인프라 주위를 정돈하는 것은 매우 어렵습니다. 이번은 사이트를 간단하게 SSL화(HTTP에서 HTTPS통신)로 변경하는 방법을 소개합니다! 이번에는 소프트웨어 시스템 Nginx CentOS7 의 환경에서 S...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.