// Package appstore installs optional runtimes and services on demand. // // The panel no longer installs nginx or any language runtime during setup: the // operator picks a version in the app store and the installer runs a bounded, // transparent shell script as root. package appstore import "fmt" // Version is one selectable release of an application. type Version struct { Version string `json:"version"` Label string `json:"label"` Source string `json:"source"` } // AppDef is the static definition of an installable application. type AppDef struct { ID string `json:"id"` Name string `json:"name"` Summary string `json:"summary"` Category string `json:"category"` // Family limits an app to one package-manager family: "" or "any" means // both Debian and RHEL derivatives, "debian" / "rhel" restrict it. Family string `json:"family"` Note string `json:"note"` Versions []Version `json:"versions"` } // Installed describes one locally detected installation. type Installed struct { Version string `json:"version"` Path string `json:"path"` Active bool `json:"active"` Managed bool `json:"managed"` } // App is the API payload: definition plus local state. type App struct { AppDef Installed []Installed `json:"installed"` Running bool `json:"running"` Supported bool `json:"supported"` } var catalog = []AppDef{ { ID: "nginx", Name: "Nginx", Category: "web", Summary: "高性能 Web 服务器 / 反向代理,站点运行的基础", Note: "切换版本会重启 nginx,站点会有约 1 秒中断;安装时会从软件源解析实际的包修订号,并在 nginx -t 失败时自动处理发行版动态模块的 ABI 冲突。", // Keep the newest nginx.org stable branch first. The installer resolves // the distro revision (for example 1.30.6-1~bookworm) at install time, // so only the upstream x.y.z needs a bump here. Versions: []Version{ {Version: "1.30.6", Label: "1.30.6(最新稳定)", Source: "nginx.org 稳定源"}, {Version: "1.28.3", Label: "1.28.3(旧稳定)", Source: "nginx.org 稳定源"}, {Version: "1.26.3", Label: "1.26.3(旧稳定)", Source: "nginx.org 稳定源"}, }, }, { ID: "mysql", Name: "MySQL", Category: "database", Family: "any", Summary: "Oracle MySQL 官方社区版,MySQL 协议标准实现", Note: "支持 Debian/Ubuntu 与 RHEL/Rocky/Alma。8.x 使用官方源、数据目录 /var/lib/mysql;5.5/5.6/5.7 使用 Oracle 通用二进制(仅 x86_64,已 EOL,仅建议兼容旧应用),安装到 /www/server/mysql、数据目录 /www/server/mysql/data,安装器会自动补齐 libaio/ncurses 兼容库并在启动失败时打印 error.log。ARM64 无法运行这三个版本,建议改用 MariaDB 或自行用 Docker 运行 amd64 镜像。与 MariaDB 互斥;卸载均保留数据。Debian 下 root 使用本机 socket 认证;RHEL 初始密码写入 data/mysql_root_password.txt。", Versions: []Version{ {Version: "8.4", Label: "8.4(LTS)", Source: "MySQL 官方源"}, {Version: "8.0", Label: "8.0(稳定)", Source: "MySQL 官方源"}, {Version: "5.7.44", Label: "5.7.44(EOL·仅 x86_64)", Source: "Oracle 通用二进制"}, {Version: "5.6.51", Label: "5.6.51(EOL·仅 x86_64)", Source: "Oracle 通用二进制"}, {Version: "5.5.62", Label: "5.5.62(EOL·仅 x86_64)", Source: "Oracle 通用二进制"}, }, }, { ID: "mariadb", Name: "MariaDB", Category: "database", Family: "any", Summary: "MySQL 协议兼容的关系型数据库,轻量、Debian 默认", Note: "支持 Debian/Ubuntu 与 RHEL/Rocky/Alma。与 MySQL 互斥(同一 3306 与数据目录);数据目录 /var/lib/mysql 在卸载时保留。", Versions: []Version{ {Version: "11.8", Label: "11.8(最新)", Source: "MariaDB 官方源"}, {Version: "11.4", Label: "11.4(LTS)", Source: "MariaDB 官方源"}, {Version: "10.11", Label: "10.11(LTS)", Source: "MariaDB 官方源"}, }, }, { ID: "go", Name: "Go", Category: "runtime", Summary: "Go 编译与运行环境,供 Go 类型站点使用", Note: "安装到 /www/server/go/<版本>,current 指向最新安装。", Versions: []Version{ {Version: "1.27.3", Label: "1.27.3(最新)", Source: "go.dev"}, {Version: "1.26.10", Label: "1.26.10(上一稳定)", Source: "go.dev"}, }, }, { ID: "node", Name: "Node.js", Category: "runtime", Summary: "Node.js 运行时与 npm,供 Node 类型站点使用", Note: "安装到 /www/server/node/<版本>,站点 unit 的 PATH 已包含 current/bin。", Versions: []Version{ {Version: "26.12.1", Label: "26.12.1(Current)", Source: "nodejs.org"}, {Version: "24.22.1", Label: "24.22.1(LTS)", Source: "nodejs.org"}, {Version: "22.23.4", Label: "22.23.4(LTS)", Source: "nodejs.org"}, {Version: "20.20.2", Label: "20.20.2(维护期)", Source: "nodejs.org"}, }, }, { ID: "python", Name: "Python", Category: "runtime", Summary: "独立 Python 运行时(含 pip),不影响系统 Python", Note: "使用 python-build-standalone 独立构建,安装到 /www/server/python/<版本>。", Versions: []Version{ {Version: "3.14", Label: "3.14(最新补丁)", Source: "python-build-standalone"}, {Version: "3.13", Label: "3.13(最新补丁)", Source: "python-build-standalone"}, {Version: "3.12", Label: "3.12(最新补丁)", Source: "python-build-standalone"}, {Version: "3.11", Label: "3.11(最新补丁)", Source: "python-build-standalone"}, }, }, { ID: "phpmyadmin", Name: "phpMyAdmin", Category: "tool", Summary: "Web 端数据库管理工具", Note: "安装到 /www/wwwroot/phpmyadmin/<版本>,并自动创建 PHP 站点监听 0.0.0.0:16520:安装完成后直接访问 http://服务器IP:16520/(PHP 版本自动选择已安装的最高版)。需先安装 PHP。", Versions: []Version{ {Version: "5.2.2", Label: "5.2.2(稳定)", Source: "files.phpmyadmin.net"}, }, }, { ID: "php", Name: "PHP", Category: "runtime", Family: "any", Summary: "PHP-FPM 运行时及常用扩展,供 PHP 站点使用", Note: "Debian 使用 Sury 源(/run/php/php<版本>-fpm.sock);RHEL 使用 Remi 源(/run/php-fpm/www.sock)。", Versions: []Version{ {Version: "8.5", Label: "8.5(最新)", Source: "Sury"}, {Version: "8.4", Label: "8.4(稳定)", Source: "Sury"}, {Version: "8.3", Label: "8.3(稳定)", Source: "Sury"}, {Version: "8.2", Label: "8.2(LTS)", Source: "Sury"}, {Version: "8.1", Label: "8.1(旧稳定)", Source: "Sury"}, {Version: "8.0", Label: "8.0(EOL)", Source: "Sury"}, {Version: "7.4", Label: "7.4(EOL)", Source: "Sury"}, {Version: "7.3", Label: "7.3(EOL)", Source: "Sury"}, {Version: "7.2", Label: "7.2(EOL)", Source: "Sury"}, {Version: "7.1", Label: "7.1(EOL)", Source: "Sury"}, }, }, { ID: "git", Name: "Git", Category: "tool", Summary: "分布式版本控制工具", Note: "使用发行版软件源安装。", Versions: []Version{ {Version: "system", Label: "系统源最新", Source: "apt"}, }, }, { ID: "docker", Name: "Docker", Category: "runtime", Family: "any", Summary: "容器运行时与 Docker Compose,支持国内镜像加速", Note: "使用阿里云 Docker CE 镜像源安装 docker-ce、compose 插件;首次安装写入国内 registry mirror 与日志轮转配置。安装后可在 Docker 页面填写阿里云个人加速地址。", Versions: []Version{ {Version: "system", Label: "阿里云源最新稳定版", Source: "mirrors.aliyun.com/docker-ce"}, }, }, } var appIndex = func() map[string]AppDef { out := make(map[string]AppDef, len(catalog)) for _, app := range catalog { out[app.ID] = app } return out }() func lookupApp(id string) (AppDef, bool) { app, ok := appIndex[id] return app, ok } func lookupVersion(app AppDef, version string) (Version, bool) { for _, v := range app.Versions { if v.Version == version { return v, true } } return Version{}, false } // revision is the package suffix marker used by the nginx.org repository. func nginxPackageVersion(version, codename string) string { return fmt.Sprintf("%s-1~%s", version, codename) }