Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemathinc
GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/util/compute-images.ts
1447 views
1
/*
2
* This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.
3
* License: MS-RSL – see LICENSE.md for details
4
*/
5
6
// this is tied to the back-end setup of cocalc.com and only used if
7
// the "/customize" endpoint does not send a suitable "software" field.
8
// check frontend/customize.tsx for more details.
9
10
//import { without } from "lodash";
11
import * as schema from "./db-schema";
12
13
// WARNING! Do not remove this from the public api. **It is used by kucalc
14
// in the (closed source) manage-actions Kubernetes backend.**
15
export const FALLBACK_COMPUTE_IMAGE = schema.FALLBACK_COMPUTE_IMAGE;
16
17
const DEFAULT_COMPUTE_IMAGE = schema.DEFAULT_COMPUTE_IMAGE;
18
19
// this array defines their ordering
20
const GROUPS = [
21
"Main",
22
"Ubuntu 24.04",
23
"Ubuntu 22.04",
24
"Ubuntu 20.04",
25
"Ubuntu 18.04", // empty
26
"Ubuntu 16.04", // empty
27
] as const;
28
29
type Group = (typeof GROUPS)[number];
30
31
// names of old images, that won't trigger the "upgrade banner", pointing to the most recent end-of-life image of that series
32
export const DISMISS_IMG_1804 = "ubuntu1804";
33
export const DISMISS_IMG_2004 = "ubuntu2004-eol";
34
// names of old images triggering the upgrade banner to 22.04
35
export const UBUNTU2004_DEPRECATED = "ubuntu2004";
36
export const UBUNTU2004_DEV = "ubuntu2004-dev";
37
export const UBUNTU2204_DEV = "ubuntu2204-dev";
38
// new Ubuntu 24.04 image, for development
39
export const UBUNTU2404_DEV = "ubuntu2404-dev";
40
export const UBUNTU2204 = "ubuntu2204";
41
42
export interface ComputeImage {
43
id: string; // the key under which it is stored in the database
44
title?: string;
45
short?: string; // a shorter title, show this when you also show the group
46
descr?: string;
47
group: string;
48
order?: number;
49
hidden?: boolean;
50
tag?: string;
51
registry?: string;
52
}
53
54
interface ComputeImageProd
55
extends Omit<ComputeImage, "id" | "tag" | "registry"> {
56
group: Group;
57
}
58
59
// NOTE: do not remove entries, to preserve rendering user-facing strings for older entries
60
// rather, mark them as {hidden: true}
61
const COMPUTE_IMAGES: { [key: string]: ComputeImageProd } = {
62
// "default" or "undefined" is what was used for "ubuntu1804" until summer 2020
63
// 2020: DEFAULT_COMPUTE_IMAGE has been "ubuntu2004" until december 2022.
64
// 2022: DEFAULT_COMPUTE_IMAGE is now "ubuntu2204" and "ubuntu2004" became EOL.
65
[DEFAULT_COMPUTE_IMAGE]: {
66
order: 0,
67
title: "Ubuntu 24.04 (Default)",
68
short: "Ubuntu 24.04 (Default)",
69
descr:
70
"Ubuntu 24.04-based software stack, regularly updated, newest software",
71
group: "Main",
72
},
73
[UBUNTU2204]: {
74
title: "Ubuntu 22.04 (until June 2025)",
75
short: "Ubuntu 22.04 (until June 2025)",
76
descr:
77
"Ubuntu 22.04-based software stack, superseded by 24.04 in June 2025",
78
group: "Main",
79
},
80
[UBUNTU2404_DEV]: {
81
title: "Ubuntu 24.04 (Testing)",
82
short: "Ubuntu 24.04 (Testing)",
83
descr: "Upcoming Ubuntu 24.04 based software stack",
84
group: "Ubuntu 24.04",
85
},
86
[UBUNTU2204_DEV]: {
87
title: "Ubuntu 22.04 (Testing)",
88
short: "Ubuntu 22.04 (Testing)",
89
descr: "Upcoming Ubuntu 22.04 based software stack",
90
group: "Ubuntu 22.04",
91
hidden: true,
92
},
93
default: {
94
order: 1,
95
title: "Ubuntu 18.04 (EndOfLife)",
96
short: "Ubuntu 18.04 (EndOfLife)",
97
descr: "Reached end of life in August 2020",
98
group: "Main",
99
hidden: true,
100
},
101
[DISMISS_IMG_1804]: {
102
// a synonym of "default", but with a specific functionality!
103
// we use it as a marker: if a "default" project (before the 20.04 upgrade) is set to stay at 18.04, this image is selected.
104
order: 2,
105
title: "Ubuntu 18.04 (EndOfLife)",
106
short: "Ubuntu 18.04 (EndOfLife)",
107
descr: "Reached end of life in August 2020",
108
group: "Main",
109
hidden: true,
110
},
111
[DISMISS_IMG_2004]: {
112
order: 1,
113
title: "Ubuntu 20.04 (EndOfLife)",
114
short: "Ubuntu 20.04 (EndOfLife)",
115
descr: "Reached end of life in May 2023",
116
group: "Main",
117
},
118
[UBUNTU2004_DEPRECATED]: {
119
order: 1,
120
title: "Ubuntu 20.04 (EndOfLife)",
121
short: "Ubuntu 20.04 (EndOfLife)",
122
descr: "Reached end of life in May 2023",
123
group: "Main",
124
hidden: true, // any project that is set to "ubuntu2004" will be shown a banner → either update to ubuntu2204 or keep ubuntu2004-eol
125
},
126
"ubuntu2404-2025-06-26": {
127
title: "Ubuntu 24.04 (2025-06-26)",
128
short: "2025-06-26",
129
descr: "Frozen on 2025-06-26 and no longer updated",
130
group: "Ubuntu 24.04",
131
},
132
"ubuntu2204-previous": {
133
title: "Ubuntu 22.04 (Previous)",
134
short: "Previous",
135
descr: "Slightly behind 22.04 (Current)",
136
group: "Ubuntu 22.04",
137
},
138
"ubuntu2004-previous": {
139
title: "Ubuntu 20.04 (Previous)",
140
short: "Previous",
141
descr: "Slightly behind 20.04 (Current)",
142
group: "Ubuntu 20.04",
143
hidden: true,
144
},
145
"ubuntu2204-2025-04-07": {
146
title: "Ubuntu 22.04 (2025-04-07)",
147
short: "2025-04-07",
148
descr: "Frozen on 2025-04-07 and no longer updated",
149
group: "Ubuntu 22.04",
150
},
151
"ubuntu2204-2024-11-25": {
152
title: "Ubuntu 22.04 (2024-11-25)",
153
short: "2024-11-25",
154
descr: "Frozen on 2024-11-25 and no longer updated",
155
group: "Ubuntu 22.04",
156
},
157
"ubuntu2204-2024-08-01": {
158
title: "Ubuntu 22.04 (2024-08-01)",
159
short: "2024-08-01",
160
descr: "Frozen on 2024-08-01 and no longer updated",
161
group: "Ubuntu 22.04",
162
hidden: true,
163
},
164
"ubuntu2204-2024-05-13": {
165
title: "Ubuntu 22.04 (2024-05-13)",
166
short: "2024-05-13",
167
descr: "Frozen on 2024-05-13 and no longer updated",
168
group: "Ubuntu 22.04",
169
hidden: true,
170
},
171
"ubuntu2204-2024-02-07": {
172
title: "Ubuntu 22.04 (2024-02-07)",
173
short: "2024-02-07",
174
descr: "Frozen on 2024-02-07 and no longer updated",
175
group: "Ubuntu 22.04",
176
},
177
"ubuntu2204-2023-01-09": {
178
title: "Ubuntu 22.04 (2023-01-09)",
179
short: "2023-01-09",
180
descr: "Frozen on 2023-01-09 and no longer updated",
181
group: "Ubuntu 22.04",
182
hidden: true,
183
},
184
"ubuntu2204-2023-04-19": {
185
title: "Ubuntu 22.04 (2023-04-19)",
186
short: "2023-04-19",
187
descr: "Frozen on 2023-04-19 and no longer updated",
188
group: "Ubuntu 22.04",
189
hidden: true,
190
},
191
"ubuntu2204-2023-05-15": {
192
title: "Ubuntu 22.04 (2023-05-15)",
193
short: "2023-05-15",
194
descr: "Frozen on 2023-05-15 and no longer updated",
195
group: "Ubuntu 22.04",
196
hidden: true,
197
},
198
"ubuntu2204-2023-09-11": {
199
title: "Ubuntu 22.04 (2023-09-11)",
200
short: "2023-09-11",
201
descr: "Frozen on 2023-09-11 and no longer updated",
202
group: "Ubuntu 22.04",
203
hidden: true,
204
},
205
[UBUNTU2004_DEV]: {
206
title: "Ubuntu 20.04 (Testing)",
207
short: "Testing",
208
descr: "Upcoming software changes – could be broken!",
209
group: "Ubuntu 20.04",
210
hidden: true,
211
},
212
"ubuntu2004-2020-10-28": {
213
title: "Ubuntu 20.04 (2020-10-28)",
214
short: "2020-10-28",
215
group: "Ubuntu 20.04",
216
descr: "Frozen on 2020-10-28 and no longer updated",
217
hidden: true,
218
},
219
"ubuntu2004-2020-12-09": {
220
title: "Ubuntu 20.04 (2020-12-09)",
221
short: "2020-12-09",
222
group: "Ubuntu 20.04",
223
descr: "Frozen on 2020-12-09 and no longer updated",
224
hidden: true,
225
},
226
"ubuntu2004-2021-02-01": {
227
title: "Ubuntu 20.04 (2021-02-01)",
228
short: "2021-02-01",
229
group: "Ubuntu 20.04",
230
descr: "Frozen on 2021-02-01 and no longer updated",
231
hidden: true,
232
},
233
"ubuntu2004-2021-05-31": {
234
title: "Ubuntu 20.04 (2021-05-31)",
235
short: "2021-05-31",
236
group: "Ubuntu 20.04",
237
descr: "Frozen on 2021-05-31 and no longer updated",
238
hidden: true,
239
},
240
"ubuntu2004-2021-08-13": {
241
title: "Ubuntu 20.04 (2021-08-13)",
242
short: "2021-08-13",
243
group: "Ubuntu 20.04",
244
descr: "Frozen on 2021-08-13 and no longer updated",
245
hidden: true,
246
},
247
"ubuntu2004-2021-10-10": {
248
title: "Ubuntu 20.04 (2021-10-10)",
249
short: "2021-10-10",
250
group: "Ubuntu 20.04",
251
descr: "Frozen on 2021-10-10 and no longer updated",
252
},
253
"ubuntu2004-2022-04-19": {
254
title: "Ubuntu 20.04 (2022-04-19)",
255
short: "2022-04-19",
256
group: "Ubuntu 20.04",
257
descr: "Frozen on 2022-04-19 and no longer updated",
258
hidden: true,
259
},
260
"ubuntu2004-2022-08-17": {
261
title: "Ubuntu 20.04 (2022-08-17)",
262
short: "2022-08-17",
263
group: "Ubuntu 20.04",
264
descr: "Frozen on 2022-08-17 and no longer updated",
265
hidden: true,
266
},
267
"ubuntu2004-2022-11-25": {
268
title: "Ubuntu 20.04 (2022-11-25)",
269
short: "2022-11-25",
270
group: "Ubuntu 20.04",
271
descr: "Frozen on 2022-11-25 and no longer updated",
272
},
273
previous: {
274
order: -2,
275
title: "Ubuntu 18.04 (Previous)",
276
short: "Previous",
277
descr: "Reached end of life in August 2020",
278
group: "Ubuntu 18.04",
279
hidden: true,
280
},
281
exp: {
282
order: -1,
283
title: "Ubuntu 18.04 (Experimental)",
284
short: "Experimental",
285
descr: "Reached end of life in August 2020",
286
group: "Ubuntu 18.04",
287
hidden: true,
288
},
289
"stable-2018-08-27": {
290
title: "Ubuntu 18.04 @ 2018-08-27",
291
short: "2018-08-27",
292
descr: "Frozen on 2018-08-27 and no longer updated",
293
group: "Ubuntu 18.04",
294
hidden: true,
295
},
296
"stable-2019-01-12": {
297
title: "Ubuntu 18.04 @ 2019-01-12",
298
short: "2019-01-12",
299
descr: "Frozen on 2019-01-12 and no longer updated",
300
group: "Ubuntu 18.04",
301
hidden: true,
302
},
303
"stable-2019-07-15": {
304
title: "Ubuntu 18.04 @ 2019-07-15",
305
short: "2019-07-15",
306
descr: "Frozen on 2019-07-15 and no longer updated",
307
group: "Ubuntu 18.04",
308
hidden: true,
309
},
310
"stable-2019-10-25_ro": {
311
title: "Ubuntu 18.04 @ 2019-10-25",
312
short: "2019-10-25",
313
descr: "Frozen on 2019-10-25 and no longer updated",
314
group: "Ubuntu 18.04",
315
hidden: true,
316
},
317
"stable-2019-12-15_ro": {
318
title: "Ubuntu 18.04 @ 2019-12-15",
319
short: "2019-12-15",
320
descr: "Frozen on 2019-12-15 and no longer updated",
321
group: "Ubuntu 18.04",
322
hidden: true,
323
},
324
"stable-2020-01-26_ro": {
325
title: "Ubuntu 18.04 @ 2020-01-26",
326
short: "2020-01-26",
327
descr: "Frozen on 2020-01-26 and no longer updated",
328
group: "Ubuntu 18.04",
329
hidden: true,
330
},
331
"stable-2020-07-31": {
332
title: "Ubuntu 18.04 @ 2020-07-31",
333
short: "2020-07-31",
334
descr: "Frozen on 2020-07-31 and no longer updated",
335
group: "Ubuntu 18.04",
336
hidden: true,
337
},
338
old: {
339
order: 10,
340
title: "Old Ubuntu 16.04",
341
short: "Old software image",
342
descr: "In use until Summer 2018. No longer maintained!",
343
group: "Ubuntu 16.04",
344
hidden: true,
345
},
346
} as const;
347
348
export const FALLBACK_SOFTWARE_ENV = {
349
default: DEFAULT_COMPUTE_IMAGE,
350
groups: GROUPS, // without(GROUPS, "Ubuntu 18.04", "Ubuntu 16.04"),
351
environments: COMPUTE_IMAGES,
352
} as const;
353
354
// this is purely fallback for the case, where the new software env code runs on-prem
355
// but no software is setup. it assumes projects were created with the DEFAULT_COMPUTE_IMAGE.
356
export const FALLBACK_ONPREM_ENV = {
357
default: DEFAULT_COMPUTE_IMAGE,
358
groups: ["Standard"],
359
environments: {
360
[DEFAULT_COMPUTE_IMAGE]: {
361
title: "Standard",
362
group: "Standard",
363
},
364
},
365
} as const;
366
367