所需环境

1、mysql

mysql linux安装步骤:https://blog.csdn.net/qq_31854907/article/details/85070544
2、redis

redis linux安装步骤:https://blog.csdn.net/qq_31854907/article/details/85107885
3、nginx安装

ngix linux安装步骤:https://blog.csdn.net/qq_31854907/article/details/85099271
4、npm/nodejs环境

node linux安装步骤:https://blog.csdn.net/micarlxm/article/details/81091284

下载的版本是:wget https://nodejs.org/dist/latest-v8.x/node-v8.15.1-linux-x64.tar.gz
5、rap2-delos端安装

使用git下载安装源码: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,},keys: ['some secret hurr'],session: {key: 'rap2:sess',},db: {dialect: 'mysql',host: 'localhost',port: 3306,username: 'root',password: '123456',database: 'db_rap2_delos_app',pool: {max: 5,min: 0,idle: 10000,},logging: false,},redis: {host: '127.0.0.1',port: 6379}
}export default config

三个文件都按照上面的文件进行配置

自己根据上面定义的数据名字创建 我的是 RAP2_DELOS_APP

CREATE DATABASE IF NOT EXISTS db_rap2_delos_app
DEFAULT CHARSET utf8
COLLATE utf8_general_ci;

3、安装依赖包

进入项目根目录
# cd rap2-delos
安装项目所需依赖
# npm install
全局安装PM2   这是用来启动服务端代码的
# npm install -g pm2
安装 TypeScript 编译包
# npm install typescript -g

4、初始化数据库

执行编译
# 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

5、代码规范检查

# 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使用pm2指令进行生产模式启动
pm2 start dispatch.js --name=rap-server-delos-prod

6、常见问题

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-node4、执行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方式启动
---------------------
作者:清悟
来源:CSDN
原文:https://blog.csdn.net/qq_16142851/article/details/85198925
版权声明:本文为博主原创文章,转载请附上博文链接!

7、客户端dolores环境搭建

1、获取源代码

git clone https://github.com/thx/rap2-dolores.git
执行不成功 多执行几次,或者直接在浏览器打开 https://github.com/thx/rap2-dolores.git 去下载压缩包回来

2、配置文件

目录:rap2-dolores/src/config
文件:config.dev.ts; 其中 dev,表示开发环境,其他同理
修改:config.dev.ts文件,serve地址是 服务端 rap2-delos 部署成功后的地址,默认:'http://localhost:8080'   可以不做修改

最终修改如下 配置文件如下 请注意 ip 那里 不能使用 127.0.0.1 请使用服务器ip (可以尝试使用localhost试试)
module.exports = {
serve: ‘http://ip:8080’,
keys: [‘some secret hurr’],
session: {
key: ‘koa:sess’
}
}
3、安装项目依赖包

# 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.org2、删除之前安装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

4、编译启动项目

01、开发模式 自动监视改变后重新编译
# npm run dev
备注:测试用例
# npm run test02、生产模式 编译 React 生产包
# npm run build

5、配置服务器 我使用的是nginx

使用 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  即可

RAP2开发环境部署相关推荐

  1. 【Smobiler企业APP开发之一】开发环境部署

    最近研究了下Smobiler-.net移动开发,对于做企业APP开发Smobiler还是够用的,况且是完全使用C#进行编程,对于使用C#进行程序设计的程序员来说还是很容易上手的. 本章节主要介绍Smo ...

  2. Linux——Django 开发环境部署(二)python版本控制器pyenv

    python版本控制器pyenv 之前的 那篇是说明了django环境的site package完全独立出来了,但是使用的python解释器还是系统的,为了继续独立出来,甚至是达到ruby的rvm的自 ...

  3. 五部搞定Android开发环境部署——费UC噶不过详细的Android开发环境搭建教程

     五步搞定Android开发环境部署--非常详细的Android开发环境搭建教程 引言 在windows安装Android的开发环境不简单也说不上算复杂,本文写给第一次想在自己Windows上建立 ...

  4. Python开发环境部署详细教程,附上免费Python开发平台

    Python开发环境部署详细教程来啦!本文将带大家搭建一个Python虚拟环境和基于网页的用于交互计算的应用程序Jupyter Notebook. 如果这么简单的部署教程你还是学不会,没关系,在文章末 ...

  5. 西秦的ACE-Python教程 一、Python本地开发环境部署

    西秦的ACE-Python教程 一.Python本地开发环境部署     西秦 级别: 论坛版主 发帖 1357 云币 2782 加关注 写私信 只看楼主 更多操作楼主  发表于: 10-10 从今天 ...

  6. 轻量级JavaWeb开发环境部署

    本文章是结合轻量级JavaWeb企业级应用实战所写的学习总结记录文章,开发环境部署文章仍然使用的是我的旧文章习惯,在下一章我会使用新的文章书写习惯来更清晰和简便的记录 Tomcat的安装 tomcat ...

  7. UE4离线开发环境部署(UE4 + VS + VIVE + SteamVR)

    UE4程序离线开发环境部署 VS部署(以VS2019专业版为例) 配置安装环境 脱机安装 UE4引擎部署(这里以4.27.2为例) 联网下载引擎 非源码版下载 源码版下载 离线安装 非源码版安装 源码 ...

  8. Tigase开发环境部署

    Tigase开发环境部署 接下来开始正式进入tigase项目,tigase依赖tigase-utils.jar,tigase-utils.jar依赖tigase-xmltools.jar,因此我们先编 ...

  9. RAP2本地开发环境部署

    目录 RAP2简介 本教程简介 环境要求 服务端 delos 环境搭建 构建项目 启动项目 客户端 dolores 环境搭建 构建项目 启动项目 RAP2简介 RAP2 是在 RAP1 基础上重做的新 ...

最新文章

  1. backup restore On Ubuntu
  2. 十年学术生涯新开端:港中文助理教授周博磊宣布加入UCLA
  3. LeetCode 2169. 得到 0 的操作数
  4. 在windows下的cmd中如何进入与退出mysql
  5. java底层模型_Java I/O模型及其底层原理,夯实你的开发基础
  6. neovim--ubuntu安装
  7. 重磅炸弹之英译世界名著137部
  8. 任学堂说科技:穿越计算机迷雾,从零开始构建计算机
  9. 通往诺贝尔奖之路:盘点10个著名的科学家族
  10. flask-uploads
  11. 做了5年研发效能度量,我的6点思考
  12. 随笔小记--微博手动扩容来解决因新热搜“鹿晗关晓彤恋情”引起的down机
  13. ESP8266学习笔记:实现ESP8266的局域网内通信
  14. win10 win11关睿频(打开隐藏的“处理器性能提升模式”)
  15. CTF_Web:攻防世界高手区进阶题WP(15-18)
  16. 怎么查看一段时间的计算机ip,如何查看电脑中使用过的历史IP地址
  17. 【画画】UCF Local Programming Contest 2012(Practice)E. Pete's Pantry
  18. 【公益创投】“爱无限·心关爱”2021心理情景剧剧本征集活动结果出炉啦!
  19. 2021-2027全球及中国耳鼻喉科窥镜行业研究及十四五规划分析报告
  20. Android-沉浸式导航栏

热门文章

  1. 第一代云原生企业米哈游如何让想象发生?
  2. 怎么调大计算机浏览器内字体,W7系统浏览器字体大小设置的方法
  3. 网络文件共享服务 - Samba详解
  4. InDesign 教程如何更改字体和字体大小?
  5. 什么是死锁?死锁的预防?
  6. 信息系统面临的安全风险
  7. 智优ERP的升级版智优E3_ERP,可以自定义列,和自定义打印公司logo
  8. 世界500强公司面试题(很多)
  9. gcrobustvar:基于VAR的稳健性Granger因果检验
  10. chrome插件莫名消失【已解决】