create-expo-updates-server 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +19 -0
  3. package/bin/create-expo-updates-server.mjs +5 -0
  4. package/dist/template/.env.docker.example +15 -0
  5. package/dist/template/.env.example +35 -0
  6. package/dist/template/Dockerfile +42 -0
  7. package/dist/template/LICENSE +21 -0
  8. package/dist/template/README.md +665 -0
  9. package/dist/template/app/api/admin/access-tokens/[id]/route.ts +25 -0
  10. package/dist/template/app/api/admin/access-tokens/route.test.ts +73 -0
  11. package/dist/template/app/api/admin/access-tokens/route.ts +90 -0
  12. package/dist/template/app/api/admin/embedded-updates/[embeddedUpdateId]/route.ts +25 -0
  13. package/dist/template/app/api/admin/embedded-updates/route.test.ts +102 -0
  14. package/dist/template/app/api/admin/embedded-updates/route.ts +47 -0
  15. package/dist/template/app/api/admin/emergency-redirects/[id]/route.ts +62 -0
  16. package/dist/template/app/api/admin/emergency-redirects/route.test.ts +84 -0
  17. package/dist/template/app/api/admin/emergency-redirects/route.ts +56 -0
  18. package/dist/template/app/api/admin/login/route.test.ts +55 -0
  19. package/dist/template/app/api/admin/login/route.ts +52 -0
  20. package/dist/template/app/api/admin/logout/route.ts +20 -0
  21. package/dist/template/app/api/admin/session/route.ts +15 -0
  22. package/dist/template/app/api/admin/updates/[encodedKey]/deactivate/route.ts +33 -0
  23. package/dist/template/app/api/admin/updates/[encodedKey]/promote/route.ts +29 -0
  24. package/dist/template/app/api/admin/updates/[encodedKey]/rollback/route.ts +29 -0
  25. package/dist/template/app/api/admin/updates/[encodedKey]/route.ts +96 -0
  26. package/dist/template/app/api/admin/updates/route.test.ts +142 -0
  27. package/dist/template/app/api/admin/updates/route.ts +32 -0
  28. package/dist/template/app/api/assets/route.ts +6 -0
  29. package/dist/template/app/api/health/route.test.ts +26 -0
  30. package/dist/template/app/api/health/route.ts +42 -0
  31. package/dist/template/app/api/manifest/route.ts +6 -0
  32. package/dist/template/app/api/update-complete/route.ts +6 -0
  33. package/dist/template/app/favicon.ico +0 -0
  34. package/dist/template/app/globals.css +26 -0
  35. package/dist/template/app/layout.tsx +34 -0
  36. package/dist/template/app/login/page.tsx +77 -0
  37. package/dist/template/app/page.tsx +12 -0
  38. package/dist/template/app/updates/[encodedKey]/page.tsx +482 -0
  39. package/dist/template/app/updates/embedded/page.tsx +164 -0
  40. package/dist/template/app/updates/emergency-redirects/page.tsx +430 -0
  41. package/dist/template/app/updates/layout.tsx +14 -0
  42. package/dist/template/app/updates/page.tsx +281 -0
  43. package/dist/template/docker-compose.yml +100 -0
  44. package/dist/template/docs/expo-app-setup.md +497 -0
  45. package/dist/template/docs/getting-started.md +502 -0
  46. package/dist/template/docs/getting-started.ru.md +623 -0
  47. package/dist/template/docs/index.md +57 -0
  48. package/dist/template/docs/migrations/schema.sql +363 -0
  49. package/dist/template/docs/npm-installer.md +83 -0
  50. package/dist/template/docs/operations-guide.md +270 -0
  51. package/dist/template/docs/ota-emergency-recovery.md +109 -0
  52. package/dist/template/docs/supabase-setup.md +133 -0
  53. package/dist/template/eslint.config.mjs +30 -0
  54. package/dist/template/gitignore.template +58 -0
  55. package/dist/template/next.config.ts +7 -0
  56. package/dist/template/package-lock.json +12156 -0
  57. package/dist/template/package.json +50 -0
  58. package/dist/template/postcss.config.mjs +7 -0
  59. package/dist/template/public/file.svg +1 -0
  60. package/dist/template/public/globe.svg +1 -0
  61. package/dist/template/public/next.svg +1 -0
  62. package/dist/template/public/vercel.svg +1 -0
  63. package/dist/template/public/window.svg +1 -0
  64. package/dist/template/scripts/configure-expo-app.mjs +145 -0
  65. package/dist/template/scripts/create-access-token.mjs +135 -0
  66. package/dist/template/scripts/create-admin.mjs +169 -0
  67. package/dist/template/scripts/import-emergency-redirects.mjs +126 -0
  68. package/dist/template/scripts/lib/embedded-update-registrar.test.ts +64 -0
  69. package/dist/template/scripts/lib/expo-app-configurator.mjs +666 -0
  70. package/dist/template/scripts/lib/expo-app-configurator.test.ts +463 -0
  71. package/dist/template/scripts/lib/expo-app-prompts.mjs +139 -0
  72. package/dist/template/scripts/lib/expo-app-prompts.test.ts +97 -0
  73. package/dist/template/scripts/lib/expo-export-command.test.ts +31 -0
  74. package/dist/template/scripts/lib/ota-publish-retry.test.ts +33 -0
  75. package/dist/template/scripts/manage-emergency-redirect.mjs +483 -0
  76. package/dist/template/scripts/sync-docker-database-password.sh +16 -0
  77. package/dist/template/src/client/admin-api.ts +174 -0
  78. package/dist/template/src/client/admin-types.ts +93 -0
  79. package/dist/template/src/client/logout-button.tsx +31 -0
  80. package/dist/template/src/server/controllers/assets.ts +216 -0
  81. package/dist/template/src/server/controllers/manifest.test.ts +403 -0
  82. package/dist/template/src/server/controllers/manifest.ts +626 -0
  83. package/dist/template/src/server/controllers/update-complete.ts +36 -0
  84. package/dist/template/src/server/lib/admin-access-tokens.ts +169 -0
  85. package/dist/template/src/server/lib/admin-api.ts +101 -0
  86. package/dist/template/src/server/lib/admin-auth.ts +208 -0
  87. package/dist/template/src/server/lib/admin-embedded-updates.ts +150 -0
  88. package/dist/template/src/server/lib/admin-updates.ts +1282 -0
  89. package/dist/template/src/server/lib/common.js +24 -0
  90. package/dist/template/src/server/lib/emergency-channel-redirects.ts +310 -0
  91. package/dist/template/src/server/lib/env.js +8 -0
  92. package/dist/template/src/server/lib/manifest-helpers.js +91 -0
  93. package/dist/template/src/server/lib/response.js +11 -0
  94. package/dist/template/src/server/lib/signing.js +55 -0
  95. package/dist/template/src/server/lib/supabase.js +763 -0
  96. package/dist/template/src/server/manifest/manifest-repository.ts +269 -0
  97. package/dist/template/src/server/manifest/manifest-request.ts +21 -0
  98. package/dist/template/src/server/manifest/manifest-response.ts +235 -0
  99. package/dist/template/src/server/manifest/manifest-values.ts +62 -0
  100. package/dist/template/templates/expo-app/.env.ota.example +18 -0
  101. package/dist/template/templates/expo-app/ci_scripts/ci_post_xcodebuild.sh +6 -0
  102. package/dist/template/templates/expo-app/ci_scripts/register-embedded-update.sh +36 -0
  103. package/dist/template/templates/expo-app/plugins/with-ota-embedded-registration.js +33 -0
  104. package/dist/template/templates/expo-app/scripts/ota-publish/api/database-client.mjs +87 -0
  105. package/dist/template/templates/expo-app/scripts/ota-publish/api/storage-client.mjs +57 -0
  106. package/dist/template/templates/expo-app/scripts/ota-publish/index.mjs +182 -0
  107. package/dist/template/templates/expo-app/scripts/ota-publish/lib/common.mjs +84 -0
  108. package/dist/template/templates/expo-app/scripts/ota-publish/lib/expo-export-command.mjs +24 -0
  109. package/dist/template/templates/expo-app/scripts/ota-publish/lib/retry.mjs +25 -0
  110. package/dist/template/templates/expo-app/scripts/ota-publish/shared/config.mjs +48 -0
  111. package/dist/template/templates/expo-app/scripts/ota-register-embedded/android-register-embedded-update.sh +18 -0
  112. package/dist/template/templates/expo-app/scripts/ota-register-embedded/index.mjs +275 -0
  113. package/dist/template/tsconfig.json +36 -0
  114. package/dist/template/vitest.config.mts +20 -0
  115. package/dist/template-manifest.json +564 -0
  116. package/lib/cli.mjs +549 -0
  117. package/package.json +41 -0
@@ -0,0 +1,502 @@
1
+ # Beginner Quick Start
2
+
3
+ This guide takes you from an empty machine to a working OTA server and a
4
+ connected Expo application. Deep Docker, PostgreSQL or Supabase knowledge is
5
+ not required.
6
+
7
+ ## What you will have
8
+
9
+ At the end you can:
10
+
11
+ 1. open the OTA admin panel;
12
+ 2. sign in as an administrator;
13
+ 3. connect an Expo application;
14
+ 4. publish updates;
15
+ 5. activate an update manually;
16
+ 6. roll back or configure an emergency redirect.
17
+
18
+ ## Choose one installation path
19
+
20
+ - **Docker** runs the server, PostgreSQL and MinIO together.
21
+ - **Supabase** hosts the database and storage; the OTA server is deployed
22
+ separately.
23
+
24
+ Use Docker for the quickest local test.
25
+
26
+ ---
27
+
28
+ # Option A: Docker
29
+
30
+ ## Step 1. Install and start Docker Desktop
31
+
32
+ Download Docker Desktop from:
33
+
34
+ ```text
35
+ https://www.docker.com/products/docker-desktop/
36
+ ```
37
+
38
+ Open it and wait until Docker Engine is running.
39
+
40
+ ## Step 2. Open the project folder
41
+
42
+ In Terminal:
43
+
44
+ ```bash
45
+ cd /path/to/expo-updates-server
46
+ ```
47
+
48
+ ## Step 3. Create the settings file
49
+
50
+ ```bash
51
+ cp .env.docker.example .env
52
+ ```
53
+
54
+ Open `.env` and replace:
55
+
56
+ ```env
57
+ POSTGRES_PASSWORD=choose-a-long-random-password
58
+ MINIO_ROOT_PASSWORD=choose-another-long-random-password
59
+ ```
60
+
61
+ Do not publish `.env` to GitHub.
62
+
63
+ If port `3000` is busy:
64
+
65
+ ```env
66
+ OTA_HTTP_PORT=3100
67
+ OTA_PUBLIC_BASE_URL=http://localhost:3100
68
+ ```
69
+
70
+ If another project already uses PostgreSQL port `5432`, set:
71
+
72
+ ```env
73
+ POSTGRES_PORT=5433
74
+ ```
75
+
76
+ ## Step 4. Create the signing key pair
77
+
78
+ ```bash
79
+ mkdir -p secrets local-certificates
80
+
81
+ openssl req \
82
+ -x509 \
83
+ -newkey rsa:2048 \
84
+ -nodes \
85
+ -sha256 \
86
+ -days 3650 \
87
+ -subj "/CN=expo-updates" \
88
+ -addext "basicConstraints=critical,CA:FALSE" \
89
+ -addext "keyUsage=critical,digitalSignature" \
90
+ -addext "extendedKeyUsage=codeSigning" \
91
+ -keyout secrets/code-signing-private-key.pem \
92
+ -out local-certificates/code-signing-certificate.pem
93
+
94
+ chmod 600 secrets/code-signing-private-key.pem
95
+ ```
96
+
97
+ Keep `secrets/code-signing-private-key.pem` on the server. Copy
98
+ `local-certificates/code-signing-certificate.pem` to the Expo application.
99
+ The two files must remain a matching pair.
100
+
101
+ ## Step 5. Start everything
102
+
103
+ ```bash
104
+ docker compose up -d --build
105
+ docker compose ps
106
+ ```
107
+
108
+ Wait until `postgres`, `minio` and `app` are `healthy`.
109
+
110
+ ## Step 6. Database setup is automatic
111
+
112
+ Docker automatically applies:
113
+
114
+ ```text
115
+ docs/migrations/schema.sql
116
+ ```
117
+
118
+ You do not need pgAdmin or manual SQL commands for a new Docker installation.
119
+
120
+ ## Step 7. Create the first administrator
121
+
122
+ ```bash
123
+ docker compose exec app npm run create-admin
124
+ ```
125
+
126
+ Enter a username, a password of at least 12 characters and choose `admin`.
127
+
128
+ ## Step 8. Open the admin panel
129
+
130
+ ```text
131
+ http://localhost:3000/login
132
+ ```
133
+
134
+ Use `3100` if you changed `OTA_HTTP_PORT`.
135
+
136
+ ## Step 9. Local publisher settings
137
+
138
+ The Expo publisher can reach Docker services through loopback-only ports:
139
+
140
+ ```env
141
+ OTA_DATABASE_URL=postgresql://expo_updates:YOUR_POSTGRES_PASSWORD@localhost:YOUR_POSTGRES_PORT/expo_updates
142
+ OTA_DATABASE_SSL=false
143
+
144
+ R2_ENDPOINT=http://localhost:9000
145
+ R2_ACCESS_KEY_ID=expo_updates
146
+ R2_SECRET_ACCESS_KEY=YOUR_MINIO_ROOT_PASSWORD
147
+ R2_BUCKET=expo-updates
148
+ ```
149
+
150
+ Use `5432` when `POSTGRES_PORT` was not changed. If `.env` contains
151
+ `POSTGRES_PORT=5433`, use `5433` in `OTA_DATABASE_URL` as well.
152
+
153
+ MinIO Console is available at `http://localhost:9001`.
154
+
155
+ ## Recommended: use an HTTPS tunnel for device testing
156
+
157
+ Keep `http://localhost` for the admin panel and local publisher connections.
158
+ For a physical device, do not use a plain `http://` LAN address. Prefer
159
+ temporary HTTPS port forwarding such as
160
+ [Microsoft Dev Tunnels](https://learn.microsoft.com/en-us/azure/developer/dev-tunnels/get-started).
161
+
162
+ On macOS:
163
+
164
+ ```bash
165
+ brew install --cask devtunnel
166
+ devtunnel user login -g
167
+ devtunnel host -p 3000 --allow-anonymous
168
+ ```
169
+
170
+ If `OTA_HTTP_PORT` is not `3000`, forward that port instead. Copy the generated
171
+ `https://...devtunnels.ms` URL into `.env`:
172
+
173
+ ```env
174
+ OTA_PUBLIC_BASE_URL=https://YOUR-TUNNEL.devtunnels.ms
175
+ ```
176
+
177
+ Apply the changed environment value:
178
+
179
+ ```bash
180
+ docker compose up -d --force-recreate app
181
+ ```
182
+
183
+ Pass the same HTTPS URL to `npm run configure-app` as the server URL. The
184
+ configurator recognizes `*.devtunnels.ms` as local Docker exposure and keeps
185
+ the publisher connected directly to MinIO at
186
+ `R2_ENDPOINT=http://127.0.0.1:9000`.
187
+
188
+ Do not forward PostgreSQL or MinIO to the internet. Signed S3 requests should
189
+ not pass through a generic HTTP tunnel because host rewriting can invalidate
190
+ the signature.
191
+
192
+ `--allow-anonymous` lets the Expo application reach the OTA endpoint without
193
+ an interactive Dev Tunnels login, but it also makes the forwarded port
194
+ publicly reachable. Use a temporary tunnel, strong admin credentials, and stop
195
+ the tunnel immediately after testing.
196
+
197
+ ---
198
+
199
+ # Option B: Supabase
200
+
201
+ Supabase replaces PostgreSQL and MinIO. It does not run the OTA web server.
202
+
203
+ ## Step 1. Create a project
204
+
205
+ 1. Open `https://supabase.com`.
206
+ 2. Select **New project**.
207
+ 3. Enter a project name.
208
+ 4. Create and save a strong database password.
209
+ 5. Select a nearby region.
210
+ 6. Wait until the project is ready.
211
+
212
+ ## Step 2. Install the schema
213
+
214
+ 1. Open **SQL Editor** in the left sidebar.
215
+ 2. Select **New query**.
216
+ 3. Open `docs/migrations/schema.sql` on your computer.
217
+ 4. Copy the entire file.
218
+ 5. Paste it into Supabase SQL Editor.
219
+ 6. Select **Run**.
220
+ 7. Wait for the success message.
221
+
222
+ No other migration files are required.
223
+
224
+ ## Step 3. Confirm the tables
225
+
226
+ Open **Table Editor**. You should see:
227
+
228
+ ```text
229
+ ota_access_tokens
230
+ ota_admin_sessions
231
+ ota_admin_users
232
+ ota_device_state
233
+ ota_device_transitions
234
+ ota_embedded_updates
235
+ ota_emergency_redirects
236
+ ota_served_manifest_log
237
+ ota_update_channels
238
+ ota_updates
239
+ ```
240
+
241
+ ## Step 4. Create storage
242
+
243
+ 1. Open **Storage**.
244
+ 2. Select **New bucket**.
245
+ 3. Name it `expo-updates`.
246
+ 4. Keep the bucket private.
247
+ 5. Select **Create bucket**.
248
+
249
+ ## Step 5. Get server credentials
250
+
251
+ Find the project URL and `service_role` key in project settings. The service
252
+ role key is a backend secret. Never place it in the Expo application.
253
+
254
+ ## Step 6. Configure the OTA server
255
+
256
+ Create `.env.local`:
257
+
258
+ ```env
259
+ DATABASE_PROVIDER=supabase
260
+ SUPABASE_PROJECT_URL=https://YOUR-PROJECT.supabase.co
261
+ SUPABASE_SERVICE_ROLE_KEY=YOUR_SERVICE_ROLE_KEY
262
+ SUPABASE_UPDATES_BUCKET=expo-updates
263
+
264
+ OTA_PUBLIC_BASE_URL=https://updates.example.com
265
+ CODE_SIGNING_PRIVATE_KEY_PATH=/full/path/code-signing-private-key.pem
266
+ ```
267
+
268
+ ## Step 7. Start and check the server
269
+
270
+ ```bash
271
+ npm ci
272
+ npm run build
273
+ npm run start
274
+ ```
275
+
276
+ Open `http://localhost:3000/api/health`. A response containing
277
+ `"status":"ok"` means the database connection works.
278
+
279
+ ## Step 8. Create the administrator
280
+
281
+ ```bash
282
+ npm run create-admin
283
+ ```
284
+
285
+ Choose the `admin` role for the first user.
286
+
287
+ ---
288
+
289
+ # Connect the Expo application
290
+
291
+ These steps are the same for Docker and Supabase.
292
+
293
+ ## Automatic CLI configuration
294
+
295
+ For an Expo application with a static `app.json`, run this command from the OTA
296
+ server repository:
297
+
298
+ ```bash
299
+ npm run configure-app
300
+ ```
301
+
302
+ The CLI asks for the application path, public certificate, server URL, channel,
303
+ runtime, platform and overwrite preference. It displays a summary and requires
304
+ confirmation before changing files or running `expo prebuild`.
305
+
306
+ For CI or advanced usage, pass the same values as flags:
307
+
308
+ ```bash
309
+ npm run configure-app -- \
310
+ --app /full/path/to/expo-application \
311
+ --certificate /full/path/code-signing-certificate.pem \
312
+ --server-url https://updates.example.com \
313
+ --channel production \
314
+ --runtime-version 1.0.0
315
+ ```
316
+
317
+ The CLI:
318
+
319
+ 1. validates the Expo project;
320
+ 2. installs the Expo-compatible `expo-updates` version;
321
+ 3. configures URL, channel, runtime and code signing in `app.json`;
322
+ 4. copies the public certificate;
323
+ 5. installs a portable publish script;
324
+ 6. creates `.env.ota.example`;
325
+ 7. adds `npm run ota:publish`;
326
+ 8. installs publisher dependencies;
327
+ 9. installs Android, Xcode and Xcode Cloud embedded registration hooks;
328
+ 10. runs `expo prebuild` to synchronize native projects.
329
+
330
+ Use `--platform ios` or `--platform android` to prebuild one platform. The
331
+ default is both platforms.
332
+
333
+ Existing generated publisher or certificate files are not overwritten. Add
334
+ `--force` only when replacement is intentional.
335
+
336
+ The CLI stops when `app.config.ts`, `app.config.js`, `app.config.mjs` or
337
+ `app.config.cjs` exists because dynamic Expo config overrides `app.json`.
338
+
339
+ After configuration:
340
+
341
+ ```bash
342
+ cd /full/path/to/expo-application
343
+ cp .env.ota.example .env.ota
344
+ ```
345
+
346
+ Fill in the publisher credentials, then run:
347
+
348
+ ```bash
349
+ npm run ota:publish -- --message "Describe the change"
350
+ ```
351
+
352
+ For local Docker with a `localhost` server URL, the CLI creates the ignored
353
+ `.env.ota` automatically from the OTA server `.env`. Manual configuration is
354
+ only required for a remote server, Supabase or another storage provider.
355
+ Microsoft Dev Tunnel URLs (`*.devtunnels.ms`) are also recognized as local
356
+ Docker exposure: the public tunnel is used for `OTA_SERVER_URL`, while the
357
+ publisher connects directly to MinIO at `http://127.0.0.1:9000`.
358
+
359
+ The update is uploaded as inactive. Activate it in the admin panel after
360
+ review. The following sections describe the equivalent manual setup.
361
+
362
+ ## Register the update embedded in a binary
363
+
364
+ Every release binary contains an embedded update. The server needs its ID for
365
+ reliable rollback and emergency redirects. The configurator installs this flow
366
+ automatically.
367
+
368
+ For local Docker, build Android with:
369
+
370
+ ```bash
371
+ npm run ota:build:android:apk
372
+ ```
373
+
374
+ Use `npm run ota:build:android:aab` for an App Bundle. After Gradle succeeds,
375
+ the generated script finds `app.manifest` and registers the embedded update.
376
+ For iOS, the configurator adds an Xcode Build Phase, so a Release/Archive build
377
+ in Xcode performs registration automatically.
378
+
379
+ For remote CI or Xcode Cloud, do not provide PostgreSQL credentials. Create a
380
+ dedicated token:
381
+
382
+ ```bash
383
+ docker compose exec app npm run create-access-token
384
+ ```
385
+
386
+ Keep the default `updates:write` scope and add the displayed token to CI
387
+ secrets:
388
+
389
+ ```env
390
+ OTA_SERVER_URL=https://updates.example.com
391
+ OTA_ACCESS_TOKEN=ota_...
392
+ ```
393
+
394
+ The configurator also creates `ci_scripts/ci_post_xcodebuild.sh`, which Xcode
395
+ Cloud runs after a build. The token is shown only once and must never be
396
+ committed or included in the mobile binary. Verify registered binaries at
397
+ `/updates/embedded`.
398
+
399
+ ## Step 1. Install Expo Updates
400
+
401
+ ```bash
402
+ npx expo install expo-updates
403
+ ```
404
+
405
+ ## Step 2. Copy the public certificate
406
+
407
+ Copy `code-signing-certificate.pem` into a `certificates` directory in the Expo
408
+ application. Never copy the private key into the mobile project.
409
+
410
+ ## Step 3. Configure Expo
411
+
412
+ Use the `app.config.ts` example in
413
+ [`expo-app-setup.md`](https://github.com/tonichiga/expo-updates-server/blob/main/docs/expo-app-setup.md).
414
+ Set:
415
+
416
+ - `EXPO_OTA_SERVER_URL`;
417
+ - `EXPO_UPDATE_CHANNEL`;
418
+ - `EXPO_RUNTIME_VERSION`.
419
+
420
+ A physical device cannot reach the computer through `localhost`. Production
421
+ requires a public HTTPS URL. For local device testing, use the
422
+ [HTTPS Dev Tunnel setup](#recommended-use-an-https-tunnel-for-device-testing)
423
+ instead of a plain HTTP LAN address.
424
+
425
+ ## Step 4. Build a new native binary
426
+
427
+ The OTA URL, channel, runtime and certificate are native settings. Build the
428
+ iOS or Android application again after changing them.
429
+
430
+ ## Step 5. Publish an update
431
+
432
+ After automatic configuration, use:
433
+
434
+ ```bash
435
+ npm run ota:publish -- --message "Describe the change"
436
+ ```
437
+
438
+ The publisher exports JavaScript, uploads assets and inserts database records.
439
+ The new update remains inactive until you approve it.
440
+
441
+ ## Step 6. Activate the update
442
+
443
+ 1. Open `/updates` in the admin panel.
444
+ 2. Find the new update.
445
+ 3. Confirm its channel, runtime and platform.
446
+ 4. Activate it manually.
447
+
448
+ ## Step 7. Test on a device
449
+
450
+ Before testing, complete the
451
+ [Expo application setup tutorial](https://github.com/tonichiga/expo-updates-server/blob/main/docs/expo-app-setup.md).
452
+ In particular, add the
453
+ [`checkForUpdateAsync`, `fetchUpdateAsync`, and `reloadAsync` flow](https://github.com/tonichiga/expo-updates-server/blob/main/docs/expo-app-setup.md#5-check-and-install-updates-in-the-application)
454
+ to a screen or startup flow in the application.
455
+
456
+ Then:
457
+
458
+ 1. Create and install a release build containing the OTA URL, runtime,
459
+ channel, and public certificate.
460
+ 2. Publish an update with a visible test change.
461
+ 3. Activate the update in the admin panel.
462
+ 4. Open the release build and trigger the update check.
463
+ 5. Download the update, reload the application, and confirm the test change.
464
+
465
+ Expo Go and development mode are not suitable for this test because the
466
+ application must use the native update configuration embedded in the release
467
+ binary.
468
+
469
+ ## Troubleshooting
470
+
471
+ - Server failure: `docker compose logs app`.
472
+ - Container state: `docker compose ps`.
473
+ - Port conflict: change the matching `*_PORT` in `.env`.
474
+ - `password authentication failed for user "expo_updates"` after editing
475
+ `.env`: the existing PostgreSQL volume still has its original password. Run:
476
+
477
+ ```bash
478
+ npm run docker:sync-db-password
479
+ docker compose restart app
480
+ ```
481
+
482
+ - Missing Supabase tables: run the complete `schema.sql` again.
483
+ - Missing update: compare platform, runtime and channel.
484
+ - Signature error: the server private key does not match the app certificate.
485
+ - `SignatureDoesNotMatch`: `.env.ota` storage credentials do not match MinIO
486
+ or R2. For local Docker, run `npm run configure-app` again and allow generated
487
+ files to be replaced so `.env.ota` is synchronized from the server `.env`.
488
+ If the OTA server uses a Dev Tunnel, put the tunnel URL in `OTA_SERVER_URL`
489
+ but keep `R2_ENDPOINT=http://127.0.0.1:9000` for a local publisher. Sending
490
+ signed S3 requests through a generic HTTP tunnel can change the host and
491
+ invalidate the AWS signature.
492
+ - `unknown or unexpected option: --platform`: the publisher was generated by
493
+ an older CLI version. Run `npm run configure-app` again and allow generated
494
+ files to be replaced.
495
+ - Missing embedded update: confirm that a Release configuration was built and
496
+ CI has `OTA_SERVER_URL` plus an `OTA_ACCESS_TOKEN` with `updates:write`.
497
+
498
+ Technical reference:
499
+
500
+ - [Operations guide](https://github.com/tonichiga/expo-updates-server/blob/main/docs/operations-guide.md);
501
+ - [Supabase setup](https://github.com/tonichiga/expo-updates-server/blob/main/docs/supabase-setup.md);
502
+ - [Expo application setup](https://github.com/tonichiga/expo-updates-server/blob/main/docs/expo-app-setup.md).