React Native(RN)热更新:code-push-server

React Native 热更新服务:code-push-server

一、环境准备

版本名称 版本号
操作版本 CentOS Linux release 7.9.2009 (Core)
内核版本 3.10.0-1160.36.2.el7.x86_64
Glibc版本 glibc 2.17
node版本 v8.16.0
npm版本 6.4.1
Mysql版本 5.7.23-1.el7

二、安装 Node 程序
? 2.1 下载 node.js 安装包

[root@localhost ~]# wget https://npm.taobao.org/mirrors/node/latest-v8.x/node-v8.16.0-linux-x64.tar.gz
--2021-08-19 17:44:22--  https://npm.taobao.org/mirrors/node/latest-v8.x/node-v8.16.0-linux-x64.tar.gz
Resolving npm.taobao.org (npm.taobao.org)... 114.55.80.225
Connecting to npm.taobao.org (npm.taobao.org)|114.55.80.225|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://cdn.npm.taobao.org/dist/node/latest-v8.x/node-v8.16.0-linux-x64.tar.gz [following]
--2021-08-19 17:44:22--  https://cdn.npm.taobao.org/dist/node/latest-v8.x/node-v8.16.0-linux-x64.tar.gz
Resolving cdn.npm.taobao.org (cdn.npm.taobao.org)... 114.80.179.229, 101.89.125.248, 101.89.125.240, ...
Connecting to cdn.npm.taobao.org (cdn.npm.taobao.org)|114.80.179.229|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 17169084 (16M) [application/octet-stream]
Saving to: ‘node-v8.16.0-linux-x64.tar.gz’
100%[===================================================================================================================>] 17,169,084  7.00MB/s   in 2.3s   
2021-08-19 17:44:25 (7.00 MB/s) - ‘node-v8.16.0-linux-x64.tar.gz’ saved [17169084/17169084]
[root@localhost ~]# 

? 2.2 解压 node-v8.16.0-linux-x64.tar.gz

[root@localhost ~]# tar -xvf node-v8.16.0-linux-x64.tar.gz

? 2.3 安装 node.js

[root@localhost ~]# ls -l
total 16772
-rw-------. 1 root root     1259 Aug 19  2021 anaconda-ks.cfg
drwxrwxr-x  6  500  500      108 Apr 17  2019 node-v8.16.0-linux-x64
-rw-r--r--  1 root root 17169084 Apr 17  2019 node-v8.16.0-linux-x64.tar.gz
[root@localhost ~]# mkdir -pv /usr/local/node/release
mkdir: created directory ‘/usr/local/node’
mkdir: created directory ‘/usr/local/node/release’
[root@localhost ~]# mv node-v8.16.0-linux-x64 /usr/local/node/release/
[root@localhost ~]# ls
anaconda-ks.cfg  node-v8.16.0-linux-x64.tar.gz
[root@localhost ~]# cd /usr/local/node/
[root@localhost node]# ls
release
[root@localhost node]# ln -nsvf release/node-v8.16.0-linux-x64 current
‘current’ -> ‘release/node-v8.16.0-linux-x64’
[root@localhost node]# ls
current  release
[root@localhost node]# cat > /etc/profile.d/node.sh <<EOF
export PATH=/usr/local/node/current/bin:\$PATH
EOF
[root@localhost ~]# . /etc/profile 
[root@localhost ~]# node -v
v8.16.0
[root@localhost ~]# npm -v
6.4.1
[root@localhost ~]# // node.js 安装完成!

三、 安装 Mysql 服务
? 3.1 下载 Mysql 的 rpm 安装包

[root@localhost ~]# wget https://cdn.mysql.com/archives/mysql-5.7/mysql-community-server-5.7.23-1.el7.x86_64.rpm
[root@localhost ~]# wget https://cdn.mysql.com/archives/mysql-5.7/mysql-community-client-5.7.23-1.el7.x86_64.rpm
[root@localhost ~]# wget https://cdn.mysql.com/archives/mysql-5.7/mysql-community-common-5.7.23-1.el7.x86_64.rpm
[root@localhost ~]# wget https://cdn.mysql.com/archives/mysql-5.7/mysql-community-libs-5.7.23-1.el7.x86_64.rpm
[root@localhost ~]# ls -l
total 212876
-rw-------. 1 root root      1259 Aug 19  2021 anaconda-ks.cfg
-rw-r--r--  1 root root  25253600 Aug 19 17:57 mysql-community-client-5.7.23-1.el7.x86_64.rpm
-rw-r--r--  1 root root    280860 Aug 19 17:57 mysql-community-common-5.7.23-1.el7.x86_64.rpm
-rw-r--r--  1 root root   2256452 Aug 19 17:57 mysql-community-libs-5.7.23-1.el7.x86_64.rpm
-rw-r--r--  1 root root 173011196 Aug 19 17:57 mysql-community-server-5.7.23-1.el7.x86_64.rpm
-rw-r--r--  1 root root  17169084 Apr 17  2019 node-v8.16.0-linux-x64.tar.gz
[root@localhost ~]#

? 3.2 安装 Mysql

[root@localhost ~]# yum localinstall -y mysql-community-*
Loaded plugins: fastestmirror
Examining mysql-community-client-5.7.23-1.el7.x86_64.rpm: mysql-community-client-5.7.23-1.el7.x86_64
Marking mysql-community-client-5.7.23-1.el7.x86_64.rpm to be installed
Examining mysql-community-common-5.7.23-1.el7.x86_64.rpm: mysql-community-common-5.7.23-1.el7.x86_64
Marking mysql-community-common-5.7.23-1.el7.x86_64.rpm to be installed
Examining mysql-community-libs-5.7.23-1.el7.x86_64.rpm: mysql-community-libs-5.7.23-1.el7.x86_64
Marking mysql-community-libs-5.7.23-1.el7.x86_64.rpm to be installed
Examining mysql-community-server-5.7.23-1.el7.x86_64.rpm: mysql-community-server-5.7.23-1.el7.x86_64
Marking mysql-community-server-5.7.23-1.el7.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package mariadb-libs.x86_64 1:5.5.68-1.el7 will be obsoleted
--> Processing Dependency: libmysqlclient.so.18()(64bit) for package: 2:postfix-2.10.1-9.el7.x86_64
Loading mirror speeds from cached hostfile
 * base: ftp.sjtu.edu.cn
 * epel: mirrors.tuna.tsinghua.edu.cn
 * extras: ftp.sjtu.edu.cn
 * updates: ftp.sjtu.edu.cn
--> Processing Dependency: libmysqlclient.so.18(libmysqlclient_18)(64bit) for package: 2:postfix-2.10.1-9.el7.x86_64
---> Package mysql-community-client.x86_64 0:5.7.23-1.el7 will be installed
---> Package mysql-community-common.x86_64 0:5.7.23-1.el7 will be installed
---> Package mysql-community-libs.x86_64 0:5.7.23-1.el7 will be obsoleting
---> Package mysql-community-server.x86_64 0:5.7.23-1.el7 will be installed
--> Finished Dependency Resolution
Error: Package: 2:postfix-2.10.1-9.el7.x86_64 (@anaconda)
           Requires: libmysqlclient.so.18()(64bit)
           Removing: 1:mariadb-libs-5.5.68-1.el7.x86_64 (@anaconda)
               libmysqlclient.so.18()(64bit)
           Obsoleted By: mysql-community-libs-5.7.23-1.el7.x86_64 (/mysql-community-libs-5.7.23-1.el7.x86_64)
              ~libmysqlclient.so.20()(64bit)
Error: Package: 2:postfix-2.10.1-9.el7.x86_64 (@anaconda)
           Requires: libmysqlclient.so.18(libmysqlclient_18)(64bit)
           Removing: 1:mariadb-libs-5.5.68-1.el7.x86_64 (@anaconda)
               libmysqlclient.so.18(libmysqlclient_18)(64bit)
           Obsoleted By: mysql-community-libs-5.7.23-1.el7.x86_64 (/mysql-community-libs-5.7.23-1.el7.x86_64)
               Not found
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest
[root@localhost ~]# 

解决办法:依赖库冲突,卸载 mariadb-libs-5.5.68-1.el7.x86_64。

[root@localhost ~]# yum remove -y mariadb-libs-5.5.68-1.el7.x86_64
Loaded plugins: fastestmirror
Resolving Dependencies
--> Running transaction check
---> Package mariadb-libs.x86_64 1:5.5.68-1.el7 will be erased
--> Processing Dependency: libmysqlclient.so.18()(64bit) for package: 2:postfix-2.10.1-9.el7.x86_64
--> Processing Dependency: libmysqlclient.so.18(libmysqlclient_18)(64bit) for package: 2:postfix-2.10.1-9.el7.x86_64
--> Running transaction check
---> Package postfix.x86_64 2:2.10.1-9.el7 will be erased
--> Finished Dependency Resolution
Dependencies Resolved
=============================================================================================================================================================
 Package                                Arch                             Version                                   Repository                           Size
=============================================================================================================================================================
Removing:
 mariadb-libs                           x86_64                           1:5.5.68-1.el7                            @anaconda                           4.4 M
Removing for dependencies:
 postfix                                x86_64                           2:2.10.1-9.el7                            @anaconda                            12 M

Transaction Summary
=============================================================================================================================================================
Remove  1 Package (+1 Dependent package)

Installed size: 17 M
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Erasing    : 2:postfix-2.10.1-9.el7.x86_64                                                                                                             1/2 
  Erasing    : 1:mariadb-libs-5.5.68-1.el7.x86_64                                                                                                        2/2 
  Verifying  : 1:mariadb-libs-5.5.68-1.el7.x86_64                                                                                                        1/2 
  Verifying  : 2:postfix-2.10.1-9.el7.x86_64                                                                                                             2/2 

Removed:
  mariadb-libs.x86_64 1:5.5.68-1.el7                                                                                                                         

Dependency Removed:
  postfix.x86_64 2:2.10.1-9.el7                                                                                                                              

Complete!
[root@localhost ~]# 

再次执行安装 Mysql 命令

[root@localhost ~]# yum localinstall -y mysql-community-*
Loaded plugins: fastestmirror
Examining mysql-community-client-5.7.23-1.el7.x86_64.rpm: mysql-community-client-5.7.23-1.el7.x86_64
Marking mysql-community-client-5.7.23-1.el7.x86_64.rpm to be installed
Examining mysql-community-common-5.7.23-1.el7.x86_64.rpm: mysql-community-common-5.7.23-1.el7.x86_64
Marking mysql-community-common-5.7.23-1.el7.x86_64.rpm to be installed
Examining mysql-community-libs-5.7.23-1.el7.x86_64.rpm: mysql-community-libs-5.7.23-1.el7.x86_64
Marking mysql-community-libs-5.7.23-1.el7.x86_64.rpm to be installed
Examining mysql-community-server-5.7.23-1.el7.x86_64.rpm: mysql-community-server-5.7.23-1.el7.x86_64
Marking mysql-community-server-5.7.23-1.el7.x86_64.rpm to be installed
Resolving Dependencies
There are unfinished transactions remaining. You might consider running yum-complete-transaction, or "yum-complete-transaction --cleanup-only" and "yum history redo last", first to finish them. If those don‘t work you‘ll have to try removing/installing packages by hand (maybe package-cleanup can help).
The program yum-complete-transaction is found in the yum-utils package.
--> Running transaction check
---> Package mysql-community-client.x86_64 0:5.7.23-1.el7 will be installed
---> Package mysql-community-common.x86_64 0:5.7.23-1.el7 will be installed
---> Package mysql-community-libs.x86_64 0:5.7.23-1.el7 will be installed
---> Package mysql-community-server.x86_64 0:5.7.23-1.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=====================================================================================================================
 Package                     Arch        Version              Repository                                        Size
=====================================================================================================================
Installing:
 mysql-community-client      x86_64      5.7.23-1.el7         /mysql-community-client-5.7.23-1.el7.x86_64      107 M
 mysql-community-common      x86_64      5.7.23-1.el7         /mysql-community-common-5.7.23-1.el7.x86_64      2.6 M
 mysql-community-libs        x86_64      5.7.23-1.el7         /mysql-community-libs-5.7.23-1.el7.x86_64        9.5 M
 mysql-community-server      x86_64      5.7.23-1.el7         /mysql-community-server-5.7.23-1.el7.x86_64      744 M

Transaction Summary
=====================================================================================================================
Install  4 Packages

Total size: 862 M
Installed size: 862 M
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : mysql-community-common-5.7.23-1.el7.x86_64                                                        1/4 
  Installing : mysql-community-libs-5.7.23-1.el7.x86_64                                                          2/4 
  Installing : mysql-community-client-5.7.23-1.el7.x86_64                                                        3/4 
  Installing : mysql-community-server-5.7.23-1.el7.x86_64                                                        4/4 
  Verifying  : mysql-community-server-5.7.23-1.el7.x86_64                                                        1/4 
  Verifying  : mysql-community-client-5.7.23-1.el7.x86_64                                                        2/4 
  Verifying  : mysql-community-common-5.7.23-1.el7.x86_64                                                        3/4 
  Verifying  : mysql-community-libs-5.7.23-1.el7.x86_64                                                          4/4 
Installed:
  mysql-community-client.x86_64 0:5.7.23-1.el7              mysql-community-common.x86_64 0:5.7.23-1.el7             
  mysql-community-libs.x86_64 0:5.7.23-1.el7                mysql-community-server.x86_64 0:5.7.23-1.el7             

Complete!
[root@localhost ~]# 

? 3.3 启动 Mysql,并加入开机启动项

[root@localhost ~]# systemctl start mysqld
[root@localhost ~]# systemctl enable mysqld

? 3.4 查看 Mysql 默认密码

[root@localhost ~]# egrep password /var/log/mysqld.log 2021-08-20T01:21:57.642576Z 1 [Note] A temporary password is generated for root@localhost: drda_kslk7qR[root@localhost ~]# 

? 3.5 修改 Mysql 默认密码

[root@localhost ~]# mysql -uroot -pEnter password: Welcome to the MySQL monitor.  Commands end with ; or \g.Your MySQL connection id is 2Server version: 5.7.23Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.mysql> use mysql;ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.mysql> alter user user() identified by "G*$m92^ie31IKv";Query OK, 0 rows affected (0.00 sec)mysql> GRANT ALL ON *.* TO root@‘%‘ IDENTIFIED BY ‘G*$m92^ie31IKv‘ WITH GRANT OPTION;Query OK, 0 rows affected, 1 warning (0.00 sec)mysql> flush privileges;Query OK, 0 rows affected (0.00 sec)mysql> 

四、安装 npm/cnpm 淘宝源

[root@localhost ~]# npm config get registryhttps://registry.npmjs.org/[root@localhost ~]# npm config set registry https://registry.npm.taobao.org[root@localhost ~]# npm install -g cnpm --registry=https://registry.npm.taobao.orgnpm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142npm WARN deprecated har-validator@5.1.5: this library is no longer supported/usr/local/node/release/node-v8.16.0-linux-x64/bin/cnpm -> /usr/local/node/release/node-v8.16.0-linux-x64/lib/node_modules/cnpm/bin/cnpm+ cnpm@7.0.0added 709 packages from 969 contributors in 17.118s[root@localhost ~]# 

五、安装 pm2

[root@localhost ~]# npm i -g pm2/usr/local/node/release/node-v8.16.0-linux-x64/bin/pm2 -> /usr/local/node/release/node-v8.16.0-linux-x64/lib/node_modules/pm2/bin/pm2/usr/local/node/release/node-v8.16.0-linux-x64/bin/pm2-dev -> /usr/local/node/release/node-v8.16.0-linux-x64/lib/node_modules/pm2/bin/pm2-dev/usr/local/node/release/node-v8.16.0-linux-x64/bin/pm2-runtime -> /usr/local/node/release/node-v8.16.0-linux-x64/lib/node_modules/pm2/bin/pm2-runtime/usr/local/node/release/node-v8.16.0-linux-x64/bin/pm2-docker -> /usr/local/node/release/node-v8.16.0-linux-x64/lib/node_modules/pm2/bin/pm2-dockernpm WARN ws@7.4.6 requires a peer of bufferutil@^4.0.1 but none is installed. You must install peer dependencies yourself.npm WARN ws@7.4.6 requires a peer of utf-8-validate@^5.0.2 but none is installed. You must install peer dependencies yourself.npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules/pm2/node_modules/fsevents):npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})+ pm2@5.1.1added 179 packages from 199 contributors in 12.179s[root@localhost ~]# 

六、安装 code-push-server

[root@localhost ~]# npm install code-push-server@latest -gnpm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142npm WARN deprecated sequelize@4.44.4: This version will no longer receive security fixes per our security policy. Please update to sequelize@5 or above.npm WARN deprecated querystring@0.2.0: Thenpm WARN deprecated har-validator@5.1.5: this library is no longer supportednpm WARN deprecated messageformat@2.3.0: Package renamed as ‘@messageformat/core‘, see messageformat.github.io for more details. ‘messageformat‘ will eventually provide a polyfill for Intl.MessageFormat, once it‘s been defined by Unicode & ECMA.npm WARN deprecated circular-json@0.5.9: CircularJSON is in maintenance only, flatted is its successor.npm WARN deprecated core-js@2.6.12: core-js@<3.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.npm WARN deprecated terraformer-wkt-parser@1.2.1: terraformer-wkt-parser is deprecated and no longer supported. Please use @terraformer/wkt.npm WARN deprecated terraformer@1.0.12: terraformer is deprecated and no longer supported. Please use @terraformer/arcgis.npm WARN deprecated axios@0.19.2: Critical security vulnerability fixed in v0.21.1. For more information, see https://github.com/axios/axios/pull/3410/usr/local/node/release/node-v8.16.0-linux-x64/bin/code-push-server -> /usr/local/node/release/node-v8.16.0-linux-x64/lib/node_modules/code-push-server/bin/www/usr/local/node/release/node-v8.16.0-linux-x64/bin/code-push-server-db -> /usr/local/node/release/node-v8.16.0-linux-x64/lib/node_modules/code-push-server/bin/db> core-js@2.6.12 postinstall /usr/local/node/release/node-v8.16.0-linux-x64/lib/node_modules/code-push-server/node_modules/core-js> node -e "try{require(‘./postinstall‘)}catch(e){}"Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!The project needs your help! Please consider supporting of core-js on Open Collective or Patreon: > https://opencollective.com/core-js > https://www.patreon.com/zloirock Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)> protobufjs@6.11.2 postinstall /usr/local/node/release/node-v8.16.0-linux-x64/lib/node_modules/code-push-server/node_modules/protobufjs> node scripts/postinstall> aws-sdk@2.972.0 postinstall /usr/local/node/release/node-v8.16.0-linux-x64/lib/node_modules/code-push-server/node_modules/aws-sdk> node scripts/check-node-version.jsThe AWS SDK for JavaScript (v2) will no longer support Node.js v8.16.0as of November 1, 2021. To continue receiving updates to AWS servicesand bug fixes please upgrade to Node.js 10.x or later.More information can be found at: https://a.co/cf10B3y+ code-push-server@5.7.1added 510 packages from 520 contributors in 25.923s[root@localhost ~]# 

? 6.1 /usr/local/node/current/lib/node_modules/code-push-server/config/config.js 配置文件,修改后如下:

var os = require(‘os‘);var config = {};config.development = {  // Config for database, only support mysql.  db: {    username: process.env.RDS_USERNAME || "root",           //按照实际的修改    password: process.env.RDS_PASSWORD || "G*$m92^ie31IKv", //按照实际的修改    database: process.env.DATA_BASE || "codepush",          //不要手动创建,初始化的时候会自动创建    host: process.env.RDS_HOST || "127.0.0.1",    port: process.env.RDS_PORT || 3306,                     //按照实际的修改    dialect: "mysql",    logging: false,    operatorsAliases: false,  },  // Config for qiniu (http://www.qiniu.com/) cloud storage when storageType value is "qiniu".  qiniu: {    accessKey: "",    secretKey: "",    bucketName: "",    downloadUrl: "" // Binary files download host address.  },  // Config for upyun (https://www.upyun.com/) storage when storageType value is "upyun"  upyun: {    storageDir: process.env.UPYUN_STORAGE_DIR,    serviceName: process.env.UPYUN_SERVICE_NAME,    operatorName: process.env.UPYUN_OPERATOR_NAME,    operatorPass: process.env.UPYUN_OPERATOR_PASS,    downloadUrl: process.env.DOWNLOAD_URL,  },  // Config for Amazon s3 (https://aws.amazon.com/cn/s3/) storage when storageType value is "s3".  s3: {    accessKeyId: process.env.AWS_ACCESS_KEY_ID,    secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,    sessionToken: process.env.AWS_SESSION_TOKEN, //(optional)    bucketName: process.env.BUCKET_NAME,    region: process.env.REGION,    downloadUrl: process.env.DOWNLOAD_URL, // binary files download host address.  },  // Config for Aliyun OSS (https://www.aliyun.com/product/oss) when storageType value is "oss".  oss: {    accessKeyId: "",    secretAccessKey: "",    endpoint: "",    bucketName: "",    prefix: "", // Key prefix in object key    downloadUrl: "", // binary files download host address.  },  // Config for tencentyun COS (https://cloud.tencent.com/product/cos) when storageType value is "oss".  tencentcloud: {    accessKeyId: "",    secretAccessKey: "",    bucketName: "",    region: "",    downloadUrl: "", // binary files download host address.  },  // Config for local storage when storageType value is "local".  local: {    // Binary files storage dir, Do not use tmpdir and it‘s public download dir.    storageDir: process.env.STORAGE_DIR || "/data/code-push-server/storage",            //按照实际的修改    // Binary files download host address which Code Push Server listen to. the files storage in storageDir.    downloadUrl: process.env.LOCAL_DOWNLOAD_URL || "http://10.2.48.63:3000/download",  //按照实际的修改    // public static download spacename.    public: ‘/download‘  },  jwt: {    // Recommended: 63 random alpha-numeric characters    // Generate using: https://www.grc.com/passwords.htm //访问 https://www.grc.com/passwords.htm 获取    tokenSecret: process.env.TOKEN_SECRET ||‘ZgNJwNfeDRWwAv1FVem1USZXbo7FITi0KE28o6mGGZSPnTeaNml8OvXBfXprBhZ‘  },  common: {    /*     * tryLoginTimes is control login error times to avoid force attack.     * if value is 0, no limit for login auth, it may not safe for account. when it‘s a number, it means you can     * try that times today. but it need config redis server.     */    tryLoginTimes: 0,    // CodePush Web(https://github.com/lisong/code-push-web) login address.    //codePushWebUrl: "http://127.0.0.1:3001/login",    // create patch updates‘s number. default value is 3    diffNums: 3,    // data dir for caclulate diff files. it‘s optimization.    dataDir: process.env.DATA_DIR || "/data/code-push-server/data",                    //按照实际的修改         // storageType which is your binary package files store. options value is ("local" | "qiniu" | "s3"| "oss" || "tencentcloud")    storageType: process.env.STORAGE_TYPE || "local",    // options value is (true | false), when it‘s true, it will cache updateCheck results in redis.    updateCheckCache: false,    // options value is (true | false), when it‘s true, it will cache rollout results in redis    rolloutClientUniqueIdCache: false,  },  // Config for smtp email,register module need validate user email project source https://github.com/nodemailer/nodemailer  smtpConfig:{    host: "smtp.aliyun.com",    port: 465,    secure: true,    auth: {      user: "",      pass: ""    }  },  // Config for redis (register module, tryLoginTimes module)  redis: {    default: {      host: "127.0.0.1",      port: 6379,      retry_strategy: function (options) {        if (options.error.code === ‘ECONNREFUSED‘) {          // End reconnecting on a specific error and flush all commands with a individual error          return new Error(‘The server refused the connection‘);        }        if (options.total_retry_time > 1000 * 60 * 60) {            // End reconnecting after a specific timeout and flush all commands with a individual error            return new Error(‘Retry time exhausted‘);        }        if (options.times_connected > 10) {            // End reconnecting with built in error            return undefined;        }        // reconnect after        return Math.max(options.attempt * 100, 3000);      }    }  }}config.development.log4js = {  appenders: {console: { type: ‘console‘}},  categories : {    "default": { appenders: [‘console‘], level:‘error‘},    "startup": { appenders: [‘console‘], level:‘info‘},    "http": { appenders: [‘console‘], level:‘info‘}  }}config.production = Object.assign({}, config.development);module.exports = config;

? 6.2 获取 db 初始化命令

[root@localhost code-push-server]# egrep "example" /usr/local/node/current/lib/node_modules/code-push-server/bin/db    .example(‘$0 init --dbname codepush --dbhost localhost --dbuser root --dbpassword 123456 --dbport 3306 --force‘, ‘初始化code-push-server数据库‘)    .example(‘$0 upgrade --dbname codepush --dbhost localhost --dbuser root --dbpassword 123456 --dbport 3306‘, ‘升级code-push-server数据库‘)

? 6.3 执行 db 初始化命令

[root@localhost code-push-server]# /usr/local/node/current/lib/node_modules/code-push-server/bin/db init --dbname codepush --dbhost localhost --dbuser root --dbpassword "G*$m92^ie31IKv" --dbport 3306success.[root@localhost code-push-server]# 

? 6.4 启动 code-push-server 服务

[root@localhost code-push-server]# pm2 list┌────┬────────────────────┬──────────┬──────┬───────────┬──────────┬──────────┐│ id │ name               │ mode     │ ?    │ status    │ cpu      │ memory   │└────┴────────────────────┴──────────┴──────┴───────────┴──────────┴──────────┘[root@localhost code-push-server]# pm2 start code-push-server[PM2] Starting /usr/local/node/current/bin/code-push-server in fork_mode (1 instance)[PM2] Done.┌────┬────────────────────┬──────────┬──────┬───────────┬──────────┬──────────┐│ id │ name               │ mode     │ ?    │ status    │ cpu      │ memory   │├────┼────────────────────┼──────────┼──────┼───────────┼──────────┼──────────┤│ 0  │ code-push-server   │ fork     │ 0    │ online    │ 0%       │ 7.9mb    │└────┴────────────────────┴──────────┴──────┴───────────┴──────────┴──────────┘[root@localhost code-push-server]# netstat -tunlap             // 检查端口是否打开Active Internet connections (servers and established)Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      991/sshd            tcp        0      0 10.2.48.63:22           10.3.35.90:63737        ESTABLISHED 18242/sshd: root@no tcp        0      0 10.2.48.63:22           10.3.35.90:63736        ESTABLISHED 18239/sshd: root@pt tcp        0      0 10.2.48.63:22           10.3.35.90:51125        ESTABLISHED 18812/sshd: root@pt tcp        0      0 10.2.48.63:22           10.3.35.90:51127        ESTABLISHED 18819/sshd: root@no tcp        0     36 10.2.48.63:22           10.3.35.90:57528        ESTABLISHED 18594/sshd: root@pt tcp        0      0 10.2.48.63:22           10.3.35.90:57529        ESTABLISHED 18597/sshd: root@no tcp6       0      0 :::3000                 :::*                    LISTEN      19526/node /usr/loc tcp6       0      0 :::3306                 :::*                    LISTEN      18533/mysqld        tcp6       0      0 :::22                   :::*                    LISTEN      991/sshd            tcp6       0      0 10.2.48.63:3306         10.3.35.90:58159        ESTABLISHED 18533/mysqld        tcp6       0      0 10.2.48.63:3306         10.3.35.90:58215        ESTABLISHED 18533/mysqld        udp        0      0 0.0.0.0:68              0.0.0.0:*                           916/dhclient        [root@localhost code-push-server]# systemctl status firewalld  //关闭防火墙● firewalld.service - firewalld - dynamic firewall daemon   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)   Active: inactive (dead)     Docs: man:firewalld(1)[root@localhost code-push-server]# 

? 6.5 打开浏览器,输入 10.2.48.63:3000,回车
React Native(RN)热更新:code-push-server
? 6.6 默认帐号:admin,默认密码:123456,
React Native(RN)热更新:code-push-server
? 6.7 完成!

React Native(RN)热更新:code-push-server

上一篇:XTOOL X100 Pro3 VS X100 Pro2


下一篇:检查实体字段是否被修改并记录修改内容