CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
sagemathinc

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

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