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.
- package/LICENSE +21 -0
- package/README.md +19 -0
- package/bin/create-expo-updates-server.mjs +5 -0
- package/dist/template/.env.docker.example +15 -0
- package/dist/template/.env.example +35 -0
- package/dist/template/Dockerfile +42 -0
- package/dist/template/LICENSE +21 -0
- package/dist/template/README.md +665 -0
- package/dist/template/app/api/admin/access-tokens/[id]/route.ts +25 -0
- package/dist/template/app/api/admin/access-tokens/route.test.ts +73 -0
- package/dist/template/app/api/admin/access-tokens/route.ts +90 -0
- package/dist/template/app/api/admin/embedded-updates/[embeddedUpdateId]/route.ts +25 -0
- package/dist/template/app/api/admin/embedded-updates/route.test.ts +102 -0
- package/dist/template/app/api/admin/embedded-updates/route.ts +47 -0
- package/dist/template/app/api/admin/emergency-redirects/[id]/route.ts +62 -0
- package/dist/template/app/api/admin/emergency-redirects/route.test.ts +84 -0
- package/dist/template/app/api/admin/emergency-redirects/route.ts +56 -0
- package/dist/template/app/api/admin/login/route.test.ts +55 -0
- package/dist/template/app/api/admin/login/route.ts +52 -0
- package/dist/template/app/api/admin/logout/route.ts +20 -0
- package/dist/template/app/api/admin/session/route.ts +15 -0
- package/dist/template/app/api/admin/updates/[encodedKey]/deactivate/route.ts +33 -0
- package/dist/template/app/api/admin/updates/[encodedKey]/promote/route.ts +29 -0
- package/dist/template/app/api/admin/updates/[encodedKey]/rollback/route.ts +29 -0
- package/dist/template/app/api/admin/updates/[encodedKey]/route.ts +96 -0
- package/dist/template/app/api/admin/updates/route.test.ts +142 -0
- package/dist/template/app/api/admin/updates/route.ts +32 -0
- package/dist/template/app/api/assets/route.ts +6 -0
- package/dist/template/app/api/health/route.test.ts +26 -0
- package/dist/template/app/api/health/route.ts +42 -0
- package/dist/template/app/api/manifest/route.ts +6 -0
- package/dist/template/app/api/update-complete/route.ts +6 -0
- package/dist/template/app/favicon.ico +0 -0
- package/dist/template/app/globals.css +26 -0
- package/dist/template/app/layout.tsx +34 -0
- package/dist/template/app/login/page.tsx +77 -0
- package/dist/template/app/page.tsx +12 -0
- package/dist/template/app/updates/[encodedKey]/page.tsx +482 -0
- package/dist/template/app/updates/embedded/page.tsx +164 -0
- package/dist/template/app/updates/emergency-redirects/page.tsx +430 -0
- package/dist/template/app/updates/layout.tsx +14 -0
- package/dist/template/app/updates/page.tsx +281 -0
- package/dist/template/docker-compose.yml +100 -0
- package/dist/template/docs/expo-app-setup.md +497 -0
- package/dist/template/docs/getting-started.md +502 -0
- package/dist/template/docs/getting-started.ru.md +623 -0
- package/dist/template/docs/index.md +57 -0
- package/dist/template/docs/migrations/schema.sql +363 -0
- package/dist/template/docs/npm-installer.md +83 -0
- package/dist/template/docs/operations-guide.md +270 -0
- package/dist/template/docs/ota-emergency-recovery.md +109 -0
- package/dist/template/docs/supabase-setup.md +133 -0
- package/dist/template/eslint.config.mjs +30 -0
- package/dist/template/gitignore.template +58 -0
- package/dist/template/next.config.ts +7 -0
- package/dist/template/package-lock.json +12156 -0
- package/dist/template/package.json +50 -0
- package/dist/template/postcss.config.mjs +7 -0
- package/dist/template/public/file.svg +1 -0
- package/dist/template/public/globe.svg +1 -0
- package/dist/template/public/next.svg +1 -0
- package/dist/template/public/vercel.svg +1 -0
- package/dist/template/public/window.svg +1 -0
- package/dist/template/scripts/configure-expo-app.mjs +145 -0
- package/dist/template/scripts/create-access-token.mjs +135 -0
- package/dist/template/scripts/create-admin.mjs +169 -0
- package/dist/template/scripts/import-emergency-redirects.mjs +126 -0
- package/dist/template/scripts/lib/embedded-update-registrar.test.ts +64 -0
- package/dist/template/scripts/lib/expo-app-configurator.mjs +666 -0
- package/dist/template/scripts/lib/expo-app-configurator.test.ts +463 -0
- package/dist/template/scripts/lib/expo-app-prompts.mjs +139 -0
- package/dist/template/scripts/lib/expo-app-prompts.test.ts +97 -0
- package/dist/template/scripts/lib/expo-export-command.test.ts +31 -0
- package/dist/template/scripts/lib/ota-publish-retry.test.ts +33 -0
- package/dist/template/scripts/manage-emergency-redirect.mjs +483 -0
- package/dist/template/scripts/sync-docker-database-password.sh +16 -0
- package/dist/template/src/client/admin-api.ts +174 -0
- package/dist/template/src/client/admin-types.ts +93 -0
- package/dist/template/src/client/logout-button.tsx +31 -0
- package/dist/template/src/server/controllers/assets.ts +216 -0
- package/dist/template/src/server/controllers/manifest.test.ts +403 -0
- package/dist/template/src/server/controllers/manifest.ts +626 -0
- package/dist/template/src/server/controllers/update-complete.ts +36 -0
- package/dist/template/src/server/lib/admin-access-tokens.ts +169 -0
- package/dist/template/src/server/lib/admin-api.ts +101 -0
- package/dist/template/src/server/lib/admin-auth.ts +208 -0
- package/dist/template/src/server/lib/admin-embedded-updates.ts +150 -0
- package/dist/template/src/server/lib/admin-updates.ts +1282 -0
- package/dist/template/src/server/lib/common.js +24 -0
- package/dist/template/src/server/lib/emergency-channel-redirects.ts +310 -0
- package/dist/template/src/server/lib/env.js +8 -0
- package/dist/template/src/server/lib/manifest-helpers.js +91 -0
- package/dist/template/src/server/lib/response.js +11 -0
- package/dist/template/src/server/lib/signing.js +55 -0
- package/dist/template/src/server/lib/supabase.js +763 -0
- package/dist/template/src/server/manifest/manifest-repository.ts +269 -0
- package/dist/template/src/server/manifest/manifest-request.ts +21 -0
- package/dist/template/src/server/manifest/manifest-response.ts +235 -0
- package/dist/template/src/server/manifest/manifest-values.ts +62 -0
- package/dist/template/templates/expo-app/.env.ota.example +18 -0
- package/dist/template/templates/expo-app/ci_scripts/ci_post_xcodebuild.sh +6 -0
- package/dist/template/templates/expo-app/ci_scripts/register-embedded-update.sh +36 -0
- package/dist/template/templates/expo-app/plugins/with-ota-embedded-registration.js +33 -0
- package/dist/template/templates/expo-app/scripts/ota-publish/api/database-client.mjs +87 -0
- package/dist/template/templates/expo-app/scripts/ota-publish/api/storage-client.mjs +57 -0
- package/dist/template/templates/expo-app/scripts/ota-publish/index.mjs +182 -0
- package/dist/template/templates/expo-app/scripts/ota-publish/lib/common.mjs +84 -0
- package/dist/template/templates/expo-app/scripts/ota-publish/lib/expo-export-command.mjs +24 -0
- package/dist/template/templates/expo-app/scripts/ota-publish/lib/retry.mjs +25 -0
- package/dist/template/templates/expo-app/scripts/ota-publish/shared/config.mjs +48 -0
- package/dist/template/templates/expo-app/scripts/ota-register-embedded/android-register-embedded-update.sh +18 -0
- package/dist/template/templates/expo-app/scripts/ota-register-embedded/index.mjs +275 -0
- package/dist/template/tsconfig.json +36 -0
- package/dist/template/vitest.config.mts +20 -0
- package/dist/template-manifest.json +564 -0
- package/lib/cli.mjs +549 -0
- package/package.json +41 -0
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { getUpdates } from "@/src/client/admin-api";
|
|
4
|
+
import { UpdateItem } from "@/src/client/admin-types";
|
|
5
|
+
import LogoutButton from "@/src/client/logout-button";
|
|
6
|
+
import Link from "next/link";
|
|
7
|
+
import { useCallback, useEffect, useState } from "react";
|
|
8
|
+
|
|
9
|
+
const PAGE_SIZE = 20;
|
|
10
|
+
|
|
11
|
+
type SortBy =
|
|
12
|
+
| "createdAt"
|
|
13
|
+
| "runtimeVersion"
|
|
14
|
+
| "platform"
|
|
15
|
+
| "channel"
|
|
16
|
+
| "stage"
|
|
17
|
+
| "status"
|
|
18
|
+
| "updateId";
|
|
19
|
+
|
|
20
|
+
export default function UpdatesPage() {
|
|
21
|
+
const [items, setItems] = useState<UpdateItem[]>([]);
|
|
22
|
+
const [rollbackScopes, setRollbackScopes] = useState<
|
|
23
|
+
Array<{
|
|
24
|
+
scopeKey: string;
|
|
25
|
+
runtimeVersion: string;
|
|
26
|
+
channel: string;
|
|
27
|
+
platform: "ios" | "android";
|
|
28
|
+
rollbackActive: boolean;
|
|
29
|
+
autoDeliveryEnabled: boolean;
|
|
30
|
+
activeUpdateId: string | null;
|
|
31
|
+
latestUpdateId: string | null;
|
|
32
|
+
}>
|
|
33
|
+
>([]);
|
|
34
|
+
const [page, setPage] = useState(1);
|
|
35
|
+
const [totalPages, setTotalPages] = useState(1);
|
|
36
|
+
const [total, setTotal] = useState(0);
|
|
37
|
+
const [sortBy, setSortBy] = useState<SortBy>("createdAt");
|
|
38
|
+
const [order, setOrder] = useState<"asc" | "desc">("desc");
|
|
39
|
+
const [loading, setLoading] = useState(true);
|
|
40
|
+
const [error, setError] = useState("");
|
|
41
|
+
|
|
42
|
+
const hasRollbackActive = items.some((item) => item.isRollbackActive);
|
|
43
|
+
const hasIgnoredUpdates = items.some((item) => item.isIgnoredByRollback);
|
|
44
|
+
const lockedScopes = rollbackScopes.filter((scope) => scope.rollbackActive);
|
|
45
|
+
|
|
46
|
+
const loadUpdates = useCallback(async () => {
|
|
47
|
+
setLoading(true);
|
|
48
|
+
setError("");
|
|
49
|
+
|
|
50
|
+
try {
|
|
51
|
+
const response = await getUpdates({
|
|
52
|
+
page,
|
|
53
|
+
pageSize: PAGE_SIZE,
|
|
54
|
+
sortBy,
|
|
55
|
+
order,
|
|
56
|
+
});
|
|
57
|
+
setItems(response.items);
|
|
58
|
+
setRollbackScopes(response.rollbackLockByScope || []);
|
|
59
|
+
setTotalPages(response.totalPages);
|
|
60
|
+
setTotal(response.total);
|
|
61
|
+
} catch (loadError: unknown) {
|
|
62
|
+
setError((loadError as Error).message || "Не удалось загрузить список");
|
|
63
|
+
} finally {
|
|
64
|
+
setLoading(false);
|
|
65
|
+
}
|
|
66
|
+
}, [page, sortBy, order]);
|
|
67
|
+
|
|
68
|
+
useEffect(() => {
|
|
69
|
+
void loadUpdates();
|
|
70
|
+
}, [loadUpdates]);
|
|
71
|
+
|
|
72
|
+
return (
|
|
73
|
+
<main className="min-h-screen bg-zinc-50 p-4 dark:bg-zinc-950 md:p-8">
|
|
74
|
+
<div className="mx-auto max-w-7xl space-y-4">
|
|
75
|
+
<header className="flex flex-col gap-3 rounded-xl border border-zinc-200 bg-white p-4 dark:border-zinc-800 dark:bg-zinc-900 md:flex-row md:items-center md:justify-between">
|
|
76
|
+
<div>
|
|
77
|
+
<h1 className="text-xl font-semibold">OTA Updates</h1>
|
|
78
|
+
<p className="text-sm text-zinc-600 dark:text-zinc-400">
|
|
79
|
+
Всего апдейтов: {total}
|
|
80
|
+
</p>
|
|
81
|
+
</div>
|
|
82
|
+
<div className="flex items-center gap-2">
|
|
83
|
+
<Link
|
|
84
|
+
href="/updates/emergency-redirects"
|
|
85
|
+
className="rounded-md border border-zinc-300 px-4 py-4 text-sm hover:bg-zinc-100 dark:border-zinc-700 dark:hover:bg-zinc-800"
|
|
86
|
+
>
|
|
87
|
+
Emergency
|
|
88
|
+
</Link>
|
|
89
|
+
<Link
|
|
90
|
+
href="/updates/embedded"
|
|
91
|
+
className="rounded-md border border-zinc-300 px-4 py-4 text-sm hover:bg-zinc-100 dark:border-zinc-700 dark:hover:bg-zinc-800"
|
|
92
|
+
>
|
|
93
|
+
Embedded
|
|
94
|
+
</Link>
|
|
95
|
+
<label className="text-sm">Сортировка</label>
|
|
96
|
+
<select
|
|
97
|
+
value={sortBy}
|
|
98
|
+
onChange={(event) => {
|
|
99
|
+
setSortBy(event.target.value as SortBy);
|
|
100
|
+
setPage(1);
|
|
101
|
+
}}
|
|
102
|
+
aria-label="Сортировка списка апдейтов"
|
|
103
|
+
className="rounded-md border border-zinc-300 bg-transparent px-2 py-2 text-sm dark:border-zinc-700"
|
|
104
|
+
>
|
|
105
|
+
<option value="createdAt">Дата</option>
|
|
106
|
+
<option value="runtimeVersion">Runtime</option>
|
|
107
|
+
<option value="platform">Платформа</option>
|
|
108
|
+
<option value="channel">Канал</option>
|
|
109
|
+
<option value="stage">Stage</option>
|
|
110
|
+
<option value="status">Статус</option>
|
|
111
|
+
<option value="updateId">ID</option>
|
|
112
|
+
</select>
|
|
113
|
+
<button
|
|
114
|
+
type="button"
|
|
115
|
+
onClick={() => {
|
|
116
|
+
setOrder((current) => (current === "asc" ? "desc" : "asc"));
|
|
117
|
+
setPage(1);
|
|
118
|
+
}}
|
|
119
|
+
className="rounded-md border border-zinc-300 px-4 py-4 text-sm hover:bg-zinc-100 dark:border-zinc-700 dark:hover:bg-zinc-800"
|
|
120
|
+
>
|
|
121
|
+
{order === "asc" ? "ASC" : "DESC"}
|
|
122
|
+
</button>
|
|
123
|
+
<LogoutButton />
|
|
124
|
+
</div>
|
|
125
|
+
</header>
|
|
126
|
+
|
|
127
|
+
{error ? (
|
|
128
|
+
<div className="rounded-md border border-red-200 bg-red-50 p-3 text-sm text-red-700 dark:border-red-900 dark:bg-red-950/40 dark:text-red-300">
|
|
129
|
+
{error}
|
|
130
|
+
</div>
|
|
131
|
+
) : null}
|
|
132
|
+
|
|
133
|
+
{hasRollbackActive ? (
|
|
134
|
+
<div className="rounded-md border border-orange-300 bg-orange-50 p-3 text-sm text-orange-900 dark:border-orange-700 dark:bg-orange-950/30 dark:text-orange-200">
|
|
135
|
+
⚠️ Rollback активен: автодоставка новых апдейтов временно отключена.
|
|
136
|
+
{hasIgnoredUpdates
|
|
137
|
+
? " Новые апдейты в этом scope помечены как ignored."
|
|
138
|
+
: ""}
|
|
139
|
+
</div>
|
|
140
|
+
) : null}
|
|
141
|
+
|
|
142
|
+
{lockedScopes.length > 0 ? (
|
|
143
|
+
<div className="rounded-md border border-zinc-300 bg-zinc-50 p-3 text-sm text-zinc-800 dark:border-zinc-700 dark:bg-zinc-900/40 dark:text-zinc-200">
|
|
144
|
+
<p className="font-medium">Rollback lock по scope:</p>
|
|
145
|
+
<p className="mt-1 text-xs">
|
|
146
|
+
{lockedScopes
|
|
147
|
+
.map(
|
|
148
|
+
(scope) =>
|
|
149
|
+
`${scope.runtimeVersion} / ${scope.platform} / ${scope.channel}`,
|
|
150
|
+
)
|
|
151
|
+
.join("; ")}
|
|
152
|
+
</p>
|
|
153
|
+
</div>
|
|
154
|
+
) : null}
|
|
155
|
+
|
|
156
|
+
<section className="overflow-hidden rounded-xl border border-zinc-200 bg-white dark:border-zinc-800 dark:bg-zinc-900">
|
|
157
|
+
<div className="overflow-x-auto">
|
|
158
|
+
<table className="min-w-full text-sm">
|
|
159
|
+
<thead className="bg-zinc-100 dark:bg-zinc-800">
|
|
160
|
+
<tr>
|
|
161
|
+
<th className="px-4 py-4 text-left">Дата</th>
|
|
162
|
+
<th className="px-4 py-4 text-left">Runtime</th>
|
|
163
|
+
<th className="px-4 py-4 text-left">Платформа</th>
|
|
164
|
+
<th className="px-4 py-4 text-left">Канал</th>
|
|
165
|
+
<th className="px-4 py-4 text-left">Комментарий</th>
|
|
166
|
+
<th className="px-4 py-4 text-left">Stage</th>
|
|
167
|
+
<th className="px-4 py-4 text-left">Статус</th>
|
|
168
|
+
<th className="px-4 py-4 text-left">Режим</th>
|
|
169
|
+
<th className="px-4 py-4 text-left">Latest</th>
|
|
170
|
+
<th className="px-4 py-4 text-left">Assets</th>
|
|
171
|
+
<th className="px-4 py-4 text-left">ID</th>
|
|
172
|
+
</tr>
|
|
173
|
+
</thead>
|
|
174
|
+
<tbody>
|
|
175
|
+
{loading ? (
|
|
176
|
+
<tr>
|
|
177
|
+
<td className="px-3 py-4 text-zinc-500" colSpan={11}>
|
|
178
|
+
Загрузка...
|
|
179
|
+
</td>
|
|
180
|
+
</tr>
|
|
181
|
+
) : null}
|
|
182
|
+
|
|
183
|
+
{!loading && items.length === 0 ? (
|
|
184
|
+
<tr>
|
|
185
|
+
<td className="px-3 py-4 text-zinc-500" colSpan={11}>
|
|
186
|
+
Апдейты не найдены
|
|
187
|
+
</td>
|
|
188
|
+
</tr>
|
|
189
|
+
) : null}
|
|
190
|
+
|
|
191
|
+
{!loading
|
|
192
|
+
? items.map((item) => (
|
|
193
|
+
<tr
|
|
194
|
+
key={item.key}
|
|
195
|
+
className={`border-t border-zinc-200 dark:border-zinc-800 ${
|
|
196
|
+
item.isRollbackActive
|
|
197
|
+
? "bg-amber-50/70 dark:bg-amber-950/30"
|
|
198
|
+
: ""
|
|
199
|
+
}`}
|
|
200
|
+
>
|
|
201
|
+
<td className="px-4 py-4">
|
|
202
|
+
{new Date(item.createdAt).toLocaleString("uk-UA") ||
|
|
203
|
+
item.createdAtPath}
|
|
204
|
+
</td>
|
|
205
|
+
<td className="px-4 py-4">{item.runtimeVersion}</td>
|
|
206
|
+
<td className="px-4 py-4">{item.platform}</td>
|
|
207
|
+
<td className="px-4 py-4">{item.channel}</td>
|
|
208
|
+
<td className="px-4 py-4">
|
|
209
|
+
<div
|
|
210
|
+
className="max-w-72 truncate"
|
|
211
|
+
title={item.comment || ""}
|
|
212
|
+
>
|
|
213
|
+
{item.comment || "-"}
|
|
214
|
+
</div>
|
|
215
|
+
</td>
|
|
216
|
+
<td className="px-4 py-4">{item.stage}</td>
|
|
217
|
+
<td className="px-4 py-4">{item.status}</td>
|
|
218
|
+
<td className="px-4 py-4">
|
|
219
|
+
{item.isRollbackActive ? (
|
|
220
|
+
<span className="rounded border border-amber-300 px-2 py-0.5 text-xs text-amber-800 dark:border-amber-700 dark:text-amber-300">
|
|
221
|
+
rollback
|
|
222
|
+
</span>
|
|
223
|
+
) : item.isIgnoredByRollback ? (
|
|
224
|
+
<span className="rounded border border-zinc-300 px-2 py-0.5 text-xs text-zinc-700 dark:border-zinc-600 dark:text-zinc-300">
|
|
225
|
+
ignored
|
|
226
|
+
</span>
|
|
227
|
+
) : (
|
|
228
|
+
<span className="rounded border border-emerald-300 px-2 py-0.5 text-xs text-emerald-700 dark:border-emerald-700 dark:text-emerald-300">
|
|
229
|
+
auto
|
|
230
|
+
</span>
|
|
231
|
+
)}
|
|
232
|
+
</td>
|
|
233
|
+
<td className="px-4 py-4">
|
|
234
|
+
{item.isLatest ? "Да" : "Нет"}
|
|
235
|
+
</td>
|
|
236
|
+
<td className="px-4 py-4">{item.assetsCount}</td>
|
|
237
|
+
<td className="px-4 py-4">
|
|
238
|
+
<Link
|
|
239
|
+
href={`/updates/${item.encodedKey}`}
|
|
240
|
+
className="text-blue-600 hover:underline dark:text-blue-400"
|
|
241
|
+
>
|
|
242
|
+
{item.updateId}
|
|
243
|
+
</Link>
|
|
244
|
+
</td>
|
|
245
|
+
</tr>
|
|
246
|
+
))
|
|
247
|
+
: null}
|
|
248
|
+
</tbody>
|
|
249
|
+
</table>
|
|
250
|
+
</div>
|
|
251
|
+
|
|
252
|
+
<div className="flex items-center justify-between border-t border-zinc-200 px-4 py-3 dark:border-zinc-800">
|
|
253
|
+
<p className="text-sm text-zinc-600 dark:text-zinc-400">
|
|
254
|
+
Страница {page} из {totalPages}
|
|
255
|
+
</p>
|
|
256
|
+
<div className="flex gap-2">
|
|
257
|
+
<button
|
|
258
|
+
type="button"
|
|
259
|
+
onClick={() => setPage((current) => Math.max(1, current - 1))}
|
|
260
|
+
disabled={page <= 1 || loading}
|
|
261
|
+
className="rounded-md border border-zinc-300 px-4 py-4 text-sm hover:bg-zinc-100 disabled:cursor-not-allowed disabled:opacity-60 dark:border-zinc-700 dark:hover:bg-zinc-800"
|
|
262
|
+
>
|
|
263
|
+
Назад
|
|
264
|
+
</button>
|
|
265
|
+
<button
|
|
266
|
+
type="button"
|
|
267
|
+
onClick={() =>
|
|
268
|
+
setPage((current) => Math.min(totalPages, current + 1))
|
|
269
|
+
}
|
|
270
|
+
disabled={page >= totalPages || loading}
|
|
271
|
+
className="rounded-md border border-zinc-300 px-4 py-4 text-sm hover:bg-zinc-100 disabled:cursor-not-allowed disabled:opacity-60 dark:border-zinc-700 dark:hover:bg-zinc-800"
|
|
272
|
+
>
|
|
273
|
+
Вперёд
|
|
274
|
+
</button>
|
|
275
|
+
</div>
|
|
276
|
+
</div>
|
|
277
|
+
</section>
|
|
278
|
+
</div>
|
|
279
|
+
</main>
|
|
280
|
+
);
|
|
281
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
services:
|
|
2
|
+
postgres:
|
|
3
|
+
image: postgres:17-alpine
|
|
4
|
+
restart: unless-stopped
|
|
5
|
+
environment:
|
|
6
|
+
POSTGRES_DB: ${POSTGRES_DB:-expo_updates}
|
|
7
|
+
POSTGRES_USER: ${POSTGRES_USER:-expo_updates}
|
|
8
|
+
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-expo_updates_local}
|
|
9
|
+
volumes:
|
|
10
|
+
- postgres-data:/var/lib/postgresql/data
|
|
11
|
+
- ./docs/migrations/schema.sql:/docker-entrypoint-initdb.d/001-schema.sql:ro
|
|
12
|
+
ports:
|
|
13
|
+
- "127.0.0.1:${POSTGRES_PORT:-5432}:5432"
|
|
14
|
+
healthcheck:
|
|
15
|
+
test:
|
|
16
|
+
[
|
|
17
|
+
"CMD-SHELL",
|
|
18
|
+
"pg_isready -U ${POSTGRES_USER:-expo_updates} -d ${POSTGRES_DB:-expo_updates}",
|
|
19
|
+
]
|
|
20
|
+
interval: 5s
|
|
21
|
+
timeout: 5s
|
|
22
|
+
retries: 20
|
|
23
|
+
|
|
24
|
+
minio:
|
|
25
|
+
image: minio/minio:latest
|
|
26
|
+
restart: unless-stopped
|
|
27
|
+
command: server /data --console-address ":9001"
|
|
28
|
+
environment:
|
|
29
|
+
MINIO_ROOT_USER: ${MINIO_ROOT_USER:-expo_updates}
|
|
30
|
+
MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD:-expo_updates_local}
|
|
31
|
+
ports:
|
|
32
|
+
- "127.0.0.1:${MINIO_API_PORT:-9000}:9000"
|
|
33
|
+
- "127.0.0.1:${MINIO_CONSOLE_PORT:-9001}:9001"
|
|
34
|
+
volumes:
|
|
35
|
+
- minio-data:/data
|
|
36
|
+
healthcheck:
|
|
37
|
+
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
|
|
38
|
+
interval: 5s
|
|
39
|
+
timeout: 5s
|
|
40
|
+
retries: 20
|
|
41
|
+
|
|
42
|
+
minio-init:
|
|
43
|
+
image: minio/mc:latest
|
|
44
|
+
depends_on:
|
|
45
|
+
minio:
|
|
46
|
+
condition: service_healthy
|
|
47
|
+
entrypoint:
|
|
48
|
+
- /bin/sh
|
|
49
|
+
- -c
|
|
50
|
+
- >
|
|
51
|
+
mc alias set local http://minio:9000
|
|
52
|
+
"$${MINIO_ROOT_USER}" "$${MINIO_ROOT_PASSWORD}" &&
|
|
53
|
+
mc mb --ignore-existing "local/$${OTA_STORAGE_BUCKET}"
|
|
54
|
+
environment:
|
|
55
|
+
MINIO_ROOT_USER: ${MINIO_ROOT_USER:-expo_updates}
|
|
56
|
+
MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD:-expo_updates_local}
|
|
57
|
+
OTA_STORAGE_BUCKET: ${OTA_STORAGE_BUCKET:-expo-updates}
|
|
58
|
+
|
|
59
|
+
app:
|
|
60
|
+
build:
|
|
61
|
+
context: .
|
|
62
|
+
dockerfile: Dockerfile
|
|
63
|
+
restart: unless-stopped
|
|
64
|
+
depends_on:
|
|
65
|
+
postgres:
|
|
66
|
+
condition: service_healthy
|
|
67
|
+
minio-init:
|
|
68
|
+
condition: service_completed_successfully
|
|
69
|
+
environment:
|
|
70
|
+
DATABASE_PROVIDER: pg
|
|
71
|
+
DATABASE_URL: postgresql://${POSTGRES_USER:-expo_updates}:${POSTGRES_PASSWORD:-expo_updates_local}@postgres:5432/${POSTGRES_DB:-expo_updates}
|
|
72
|
+
DATABASE_SSL: "false"
|
|
73
|
+
R2_ENDPOINT: http://minio:9000
|
|
74
|
+
R2_ACCESS_KEY_ID: ${MINIO_ROOT_USER:-expo_updates}
|
|
75
|
+
R2_SECRET_ACCESS_KEY: ${MINIO_ROOT_PASSWORD:-expo_updates_local}
|
|
76
|
+
R2_BUCKET: ${OTA_STORAGE_BUCKET:-expo-updates}
|
|
77
|
+
R2_REGION: us-east-1
|
|
78
|
+
S3_FORCE_PATH_STYLE: "true"
|
|
79
|
+
OTA_STORAGE_BUCKET: ${OTA_STORAGE_BUCKET:-expo-updates}
|
|
80
|
+
OTA_PUBLIC_BASE_URL: ${OTA_PUBLIC_BASE_URL:-http://localhost:3000}
|
|
81
|
+
OTA_CDN_BASE_URL: ${OTA_CDN_BASE_URL:-}
|
|
82
|
+
CODE_SIGNING_PRIVATE_KEY: ${CODE_SIGNING_PRIVATE_KEY:-}
|
|
83
|
+
CODE_SIGNING_PRIVATE_KEY_PATH: /run/secrets/ota/code-signing-private-key.pem
|
|
84
|
+
volumes:
|
|
85
|
+
- ./secrets:/run/secrets/ota:ro
|
|
86
|
+
ports:
|
|
87
|
+
- "${OTA_HTTP_PORT:-3000}:3000"
|
|
88
|
+
healthcheck:
|
|
89
|
+
test:
|
|
90
|
+
[
|
|
91
|
+
"CMD-SHELL",
|
|
92
|
+
"wget -qO- http://127.0.0.1:3000/api/health >/dev/null || exit 1",
|
|
93
|
+
]
|
|
94
|
+
interval: 10s
|
|
95
|
+
timeout: 5s
|
|
96
|
+
retries: 20
|
|
97
|
+
|
|
98
|
+
volumes:
|
|
99
|
+
postgres-data:
|
|
100
|
+
minio-data:
|