Flipkart / DUS

A differential download based Over The Air(OTA) Update system for React Native
75 stars 25 forks source link
codepush dus electrode ota ota-server ota-update react-native

DUS - Dynamic Update Service

DUS is a Over The Air (OTA) update system that allows React Native developers to deploy mobile app updates directly to the devices of the users. It allows you to use your own servers to maintain release patches and provides configurability in the way these patches are downloaded on your Native Apps.

Features

Why DUS?

Once a React Native application is released, updating the code involves a recompilation of the new code and releasing a fresh APK/IPA. The adoption of the new APK/IPA and the review time associated with the review process makes it difficult for your latest code to reach your entire users instantly.

DUS allows you to push your latest improvements/bug fixes to all your users instantly. This introduces the agility of web into your Native Applications. It also allows multiple teams to work on the same applications where each team maintains and releases their React Native bundles for their own screens without affecting other bundles.

During the update process, DUS only downloads the missing/changed components in your React Native code reducing the download size by ~90%. While React Native does not allow sharing of code across multiple bundles, DUS avoids redundant download of common code during the bundle creation process at the native clients.

How it works?

Dus Deployer pulls the repositories specified in a configuration file called DeploymentConfig.json creates a bundle for each repository, splits it into chunks and generates update patches which contains a config called Update Graph for each version of the Android/iOS application. These patches are then uploaded to the server and the chunks are uploaded to a key-value storage pair/CDN.

The update graph for a app version specifies the chunks to be combined to generate a specific bundle. During the launch of the application, a new update graph is downloaded. When a new bundle is to be generated it fetches the chunks required for the bundle from the cache, downloading the missing chunks and combines them to form a new bundle.

This ReactFoo video explains the working of DUS. A detailed guide on the workings of DUS can be found here(link)

Supported React Native Versions

Each version of React Native has a corresponding branch 0.\<react-native-version>-stable.

We are doing our best to support each React Native version and respond to new React Native releases. In most cases, if support for a particular React Native version is unavailable, the branch supporting the previous version should work.

React Native Version DUS Version Branch Name
0.47.x 1.47.11 0.47-stable
0.48.x 1.48.3 0.48-stable
0.49.x 1.49.0 0.49-stable
0.50.x WIP
0.51.x WIP
0.52.x WIP

Setup

NOTE: This guide assumes you have used the react-native init command to initialize your React Native project. As of March 2017, the command create-react-native-app can also be used to initialize a React Native project. If using this command, please run npm run eject in your project's home directory to get a project very similar to what react-native init would have created.

Even if you have a different project structure, dus could be easily integrated by setting the appropriate filepath for dus in your android/settings.gradle

Integration (For Android)

The specifications of these dependencies can be found here

Deployment

Sample File

{
  "deploymentJob": [
    {
      "repoUrl": "git@github.com:surya-kanoria/DUS-Sample-App.git",
      "appVersions": [
        "default"
      ],
      "branchName": "master",
      "shouldDeploy": true,
      "preCompileScript": "ls",
      "bundleName": "example"
    }
  ]
}

For advanced usage please refer this doc(*link*).

Sample Project

https://github.com/surya-kanoria/DUS-Sample-App

Contributing

How?

The easiest way to contribute is by forking the repo, making your changes and creating a pull request.

What?

License

Apache v2.0

Contact us

Please open issues for any bugs that you encounter. You can reach out to me on twitter @suryakanoria or, write to cross-platform@flipkart.com for any questions that you might have.