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