Local testing
If you want to test Expo Open OTA locally, you can use the provided docker-compose file to run the server locally and expose it on internet using reverse proxy like ngrok.
Clone the repositoryâ
git clone https://github.com/axelmarciano/expo-open-ota
cd expo-open-ota
Setup .envâ
Setup environment variables by creating a .env
file in the root directory of the project.
Run the server using docker-composeâ
docker-compose build
docker-compose up
The server is now running on port 3000.
đ Running the Example Appâ
The example app is located in apps/example-app and is designed to help you test the update server locally.
âšī¸ The app must be run in release mode to properly test OTA behavior.
Setup certificatesâ
The signing certificates required for update validation are located in:
apps/example-app/certs/certificate-dev.pem
apps/example-app/certs/public-key.pem
To enable update signature verification, you must configure these certificates in your server environment. Ref
Build the Example Appâ
yarn prebuild_production
OR
yarn prebuild_staging
Configure the Expo Projectâ
Create an Expo project in your Expo dashboard with two branches:
staging
production
Each branch should have its own release channel. Then retrieve the Project ID from the Expo dashboard.
Update app.jsonâ
In apps/example-app/app.json, replace YOUR_PROJECT_ID
with your actual Expo project ID:
"extra": {
"router": {
"origin": false
},
"eas": {
"projectId": "YOUR_PROJECT_ID"
}
}
Android Setupâ
yarn prebuild_production # Prebuild the app with the 'production' config
cd android
./gradlew clean # Clean previous builds
./gradlew assembleRelease # Build the release APK
./gradlew installRelease # Install the release APK on a connected device/emulator
IOSâ
cd ios
pod cache clean --all
pod install
Then:
- Open the iOS project in Xcode: open ios/*.xcworkspace
- Go to: Product â Scheme â Edit Scheme
- Under Run, set Build Configuration to Release
Testing OTA Updatesâ
Once the app is installed in release mode, use the following commands to test OTA updates:
yarn release_production # Publish an update to the 'production' channel
yarn release_staging # Publish an update to the 'staging' channel
The app will dynamically switch between channels at runtime if configured accordingly.