Server: tải code-push server : https://github.com/shm-open/code-push-server.git sửa file src/core/config : db: { username: process.env.RDS_USERNAME || 'beoxiupr_autoUpdateApp', password: process.env.RDS_PASSWORD || 'Vuhai2112$', database: process.env.RDS_DATABASE || 'beoxiupr_autoUpdateApp', host: process.env.RDS_HOST || 'cookie.pro.vn', port: toNumber(process.env.RDS_PORT, 3306), dialect: 'mysql', logging: false, }, local: { // Binary files storage dir, Do not use tmpdir and it's public download dir. storageDir: process.env.STORAGE_DIR || '/Users/vuhai/codepush-storage', // Binary files download host address which Code Push Server listen to. the files storage in storageDir. downloadUrl: process.env.LOCAL_DOWNLOAD_URL || process.env.DOWNLOAD_URL || 'http://192.168.110.62:8888/download', // public static download spacename. public: '/download', }, redis: { host: process.env.REDIS_HOST || 'redis-14978.c228.us-central1-1.gce.redns.redis-cloud.com', port: toNumber(process.env.REDIS_PORT, 14978), password: 'pxOlc4yZWNbsDTMgPPHLCtdmmDObjvY4', db: toNumber(process.env.REDIS_DB, 0), }, sửa file src/db.ts const argv = yargs .usage('Usage: $0 [options]') .command('init', '初始化数据库', { dbpassword: { alias: 'dbpassword', type: 'string', }, }) .command('upgrade', '升级数据库', { dbpassword: { alias: 'dbpassword', type: 'string', }, }) .example( '$0 init --dbname beoxiupr_autoUpdateApp --dbhost cookie.pro.vn --dbuser beoxiupr_autoUpdateApp --dbpassword Vuhai2112$ --dbport 3306 --force', '初始化code-push-server数据库', ) .example( '$0 upgrade --dbname beoxiupr_autoUpdateApp --dbhost cookie.pro.vn --dbuser beoxiupr_autoUpdateApp --dbpassword Vuhai2112$ --dbport 3306', '升级code-push-server数据库', ) .default({ dbname: 'beoxiupr_autoUpdateApp', dbhost: 'cookie.pro.vn', dbuser: 'beoxiupr_autoUpdateApp', dbpassword: 'Vuhai2112$', }) .help('h') .alias('h', 'help') .parseSync(); build server : npm run build khởi tạo database : node ./bin/db.js init cập nhật database : node ./bin/db.js upgrade tải code-push : npm install @shm-open/code-push-cli@latest -g đăng nhập vào code-push : code-push login http://localhost:8888 reddirect đến trang html (admin/123456) lấy mã token dán vào console và tiếp tục chạy server : npm start tạo ứng dụng trên máy chủ code-push(ios): code-push app add chipchipClass-ios ios react-native tạo ứng dụng trên máy chủ code-push(android): code-push app add chipchipClass-android android react-native React-native : tải thư viện code-push: npm install react-native-code-push@9.0.1 định dạng version phải là : x.y.z cấu hình android : thêm vào android/settings.gradle include ':app', ':react-native-code-push' project(':react-native-code-push').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-code-push/android/app') thêm vào cuối android/app/build.gradle apply from: "../../node_modules/react-native-code-push/android/codepush.gradle" thêm vào android/app/src/main/res/values/strings.xm bên trong thẻ ChipChip Class http://192.168.110.62:8888 OXf0lqwY2ScNSREo1z7oLcPZeAhc4ksvOXqog 1.0.0 thêm vào android/app/src/main/java/com/chipchipclass/MainApplication.kt import com.microsoft.codepush.react.CodePush thêm vào bên trong object : DefaultReactNativeHost(this) {} override fun getJSBundleFile(): String { return CodePush.getJSBundleFile() } cấu hình ios : thêm vào info.plit CodePushServerURL http://192.168.110.62:8888/ CodePushDeploymentKey xciNRzzUA0y7cnkfP9TTSz2F5rsp4ksvOXqog CFBundleShortVersionString 1.0.0 CFBundleSignature ???? CFBundleVersion 1 thêm vào AppDelegate.mm #import thay sourceURLForBridge - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge { #ifdef DEBUG return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"]; #else return [CodePush bundleURL]; #endif } câu lệnh tạo bundle cho android : npx react-native bundle --platform android --dev false --entry-file index.js --bundle-output ./code-push/index.android.bundle --assets-dest ./code-push câu lệnh đẩy bundle cho android lên server : code-push release chipchipClass-android ./code-push 1.0.0 --deploymentName Staging câu lệnh tạo bundle cho ios : npx react-native bundle --platform ios --dev false --entry-file index.js --bundle-output ./code-push-ios/main.jsbundle --assets-dest ./code-push-ios câu lệnh đẩy bundle cho ios lên server : code-push release chipchipClass-ios ./code-push-ios 1.0.0 --deploymentName Staging thông tin phiên bản hiện tại(ios):code-push deployment list chipchipClass-ios thông tin phiên bản hiện tại(android):code-push deployment list chipchipClass-android