Skip to main content

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.

Setup the dashboard (local)

The dashboard isn’t served at /dashboard when running locally. Start it in dev mode:

cd apps/dashboard
npm install
npm run dev

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.

note

ℹ️ 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:

  1. Open the iOS project in Xcode: open ios/*.xcworkspace
  2. Go to: Product → Scheme → Edit Scheme
  3. 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.