CodePush Server source
CodePush Server is a CodePush progam server! microsoft CodePush cloud is slow in China, we can use this to build our's. I use qiniu to store the files, because it's simple and quick! Or you can use local storage, just modify config.js file, it's simple configure.
$ code-push login http://codepush.19910225.com:8080访问:http://codepush-managerment.19910225.com:8080
$ cd /path/to/code-push-server
$ mysql -uroot -e"create database codepush default charset utf8;"
$ mysql -uroot codepush < ./sql/codepush.sql
$ mysql -uroot codepush < ./sql/codepush-v0.1.1.sql
$ mysql -uroot codepush < ./sql/codepush-v0.1.5.sql
$ npm install$ vim config/config.jsread config.js
$ node ./bin/wwwor point config file and ENV
$ CONFIG_FILE=/path/to/config.js NODE_ENV=production node ./bin/wwwnotice. you have to change loginSecret in config.js for security.
you can change like this.
$ PORT=3000 HOST=127.0.0.1 NODE_ENV=production node ./bin/wwwUse code-push-cli manager CodePushServer
$ npm install code-push-cli@lastest -g
$ code-push login http://127.0.0.1:3000 #login in browser account:admin password:123456$ cd /path/to/project
$ npm install react-native-code-push@lastestFollow the react-native-code-push docs, addition iOS add a new entry named CodePushServerURL, whose value is the key of ourself CodePushServer URL. Andriod use the new CodePush constructor in MainApplication point CodePushServerUrl
iOS eg. in file Info.plist
...
<key>CodePushDeploymentKey</key>
<string>YourCodePushKey</string>
<key>CodePushServerURL</key>
<string>YourCodePushServerUrl</string>
...Android eg. in file MainApplication.java
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new CodePush(
"YourKey",
MainApplication.this,
BuildConfig.DEBUG,
"YourCodePushServerUrl"
)
);
}use pm2 to manage process.
$ npm install pm2 -g
$ cp config/config.js /path/to/production/config.js
$ vim /path/to/production/config.js #configure your env.
$ cp docs/process.yml /path/to/production/process.yml
$ vim /path/to/production/process.yml #configure your env.
$ pm2 start /path/to/production/process.ymlUse CodePush Web manage apps
add codePushWebUrl config in ./config/config.js
eg.
...
"common": {
"loginSecret": "CodePushServer",
"codePushWebUrl": "Your CodePush Web address",
}
...MIT License read