From 5bd4cfa345961025695b14a17b048ec282979133 Mon Sep 17 00:00:00 2001 From: MickLesk Date: Sun, 22 Feb 2026 13:58:47 +0100 Subject: [PATCH] feat: add SeaweedFS CT script + update AI.md with apt/dependency rules MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add ct/seaweedfs.sh, install/seaweedfs-install.sh, seaweedfs.json - AI.md: add anti-pattern #22 (apt-get → apt) - AI.md: add anti-pattern #23 (core packages as dependencies) - AI.md: fix template to use apt instead of apt-get - AI.md: add checklist items for apt and core dependencies --- ct/seaweedfs.sh | 54 +++++++++++++++++++++++++++++ docs/AI.md | 45 +++++++++++++++++++++++- frontend/public/json/seaweedfs.json | 48 +++++++++++++++++++++++++ install/seaweedfs-install.sh | 51 +++++++++++++++++++++++++++ 4 files changed, 197 insertions(+), 1 deletion(-) create mode 100644 ct/seaweedfs.sh create mode 100644 frontend/public/json/seaweedfs.json create mode 100644 install/seaweedfs-install.sh diff --git a/ct/seaweedfs.sh b/ct/seaweedfs.sh new file mode 100644 index 000000000..0c7bbaf55 --- /dev/null +++ b/ct/seaweedfs.sh @@ -0,0 +1,54 @@ +#!/usr/bin/env bash +source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func) +# Copyright (c) 2021-2026 community-scripts ORG +# Author: MickLesk (CanbiZ) +# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE +# Source: https://github.com/seaweedfs/seaweedfs + +APP="SeaweedFS" +var_tags="${var_tags:-storage;s3;filesystem}" +var_cpu="${var_cpu:-2}" +var_ram="${var_ram:-2048}" +var_disk="${var_disk:-16}" +var_os="${var_os:-debian}" +var_version="${var_version:-13}" +var_unprivileged="${var_unprivileged:-1}" + +header_info "$APP" +variables +color +catch_errors + +function update_script() { + header_info + check_container_storage + check_container_resources + + if [[ ! -f /opt/seaweedfs/weed ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + + if check_for_gh_release "seaweedfs" "seaweedfs/seaweedfs"; then + msg_info "Stopping Service" + systemctl stop seaweedfs + msg_ok "Stopped Service" + + fetch_and_deploy_gh_release "seaweedfs" "seaweedfs/seaweedfs" "prebuild" "latest" "/opt/seaweedfs" "linux_amd64.tar.gz" + + msg_info "Starting Service" + systemctl start seaweedfs + msg_ok "Started Service" + msg_ok "Updated successfully!" + fi + exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}" +echo -e "${INFO}${YW} Access it using the following URL:${CL}" +echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:9333${CL}" diff --git a/docs/AI.md b/docs/AI.md index 1f32f9808..48e551ba8 100644 --- a/docs/AI.md +++ b/docs/AI.md @@ -112,7 +112,7 @@ network_check update_os msg_info "Installing Dependencies" -$STD apt-get install -y \ +$STD apt install -y \ dependency1 \ dependency2 msg_ok "Installed Dependencies" @@ -545,6 +545,47 @@ port: 3000 EOF ``` +### 22. Using `apt-get` Instead of `apt` +```bash +# ❌ WRONG - apt-get is not the project convention +$STD apt-get install -y nginx +$STD apt-get update + +# ✅ CORRECT - always use apt (consistent with tools.func) +$STD apt install -y nginx +$STD apt update +``` + +### 23. Listing Core/Pre-installed Packages as Dependencies +```bash +# ❌ WRONG - curl is already installed by _bootstrap() in install.func +# sudo is already available in LXC, mc is not a dependency +msg_info "Installing Dependencies" +$STD apt install -y \ + curl \ + sudo \ + mc \ + fuse3 +msg_ok "Installed Dependencies" + +# ✅ CORRECT - only list packages that are actually needed by the application +msg_info "Installing Dependencies" +$STD apt install -y fuse3 +msg_ok "Installed Dependencies" +``` + +**Packages that must NOT be listed as dependencies (already available):** +- `curl` — installed by `_bootstrap()` in `install.func` +- `sudo` — base LXC package (and scripts run as root anyway) +- `wget` — base Debian LXC package +- `gnupg` / `gpg` — base Debian package +- `ca-certificates` — base Debian package +- `apt-transport-https` — obsolete on Debian 12+ +- `jq` — auto-installed by `ensure_dependencies` in `tools.func` when needed +- `mc` — not a dependency, personal preference tool + +**When to omit the dependency block entirely:** If the app only needs packages provided by `setup_*` helpers (e.g., Node.js, PostgreSQL, Go) or is a prebuilt binary with no native deps, skip the "Installing Dependencies" block completely. + --- ## 📝 Important Rules @@ -655,6 +696,8 @@ cleanup_lxc - [ ] No redundant variables - [ ] No hardcoded versions for external tools (use `fetch_and_deploy_gh_release` or `get_latest_github_release`) - [ ] `$STD` before all apt/npm/build commands +- [ ] `apt` used (NOT `apt-get`) — consistent with `tools.func` +- [ ] No core packages listed as dependencies (`curl`, `sudo`, `wget`, `jq`, `mc` are pre-installed) - [ ] `msg_info`/`msg_ok`/`msg_error` for logging (only for custom code) - [ ] Correct script structure followed - [ ] Update function present and functional diff --git a/frontend/public/json/seaweedfs.json b/frontend/public/json/seaweedfs.json new file mode 100644 index 000000000..ad9f4d555 --- /dev/null +++ b/frontend/public/json/seaweedfs.json @@ -0,0 +1,48 @@ +{ + "name": "SeaweedFS", + "slug": "seaweedfs", + "categories": [ + 11 + ], + "date_created": "2026-02-22", + "type": "ct", + "updateable": true, + "privileged": false, + "interface_port": 9333, + "documentation": "https://github.com/seaweedfs/seaweedfs/wiki", + "website": "https://seaweedfs.com/", + "logo": "https://cdn.jsdelivr.net/gh/selfhst/icons@main/webp/seaweedfs.webp", + "config_path": "", + "description": "SeaweedFS is a fast distributed storage system for blobs, objects, files, and data lakes, with O(1) disk seek, S3 API, FUSE mount, WebDAV, and cloud tiering support.", + "install_methods": [ + { + "type": "default", + "script": "ct/seaweedfs.sh", + "resources": { + "cpu": 2, + "ram": 2048, + "hdd": 16, + "os": "Debian", + "version": "13" + } + } + ], + "default_credentials": { + "username": null, + "password": null + }, + "notes": [ + { + "text": "Master UI available at port 9333, Filer UI at port 8888, S3 API at port 8333.", + "type": "info" + }, + { + "text": "Data is stored in /opt/seaweedfs-data.", + "type": "info" + }, + { + "text": "FUSE mounting requires fuse3 (pre-installed).", + "type": "info" + } + ] +} \ No newline at end of file diff --git a/install/seaweedfs-install.sh b/install/seaweedfs-install.sh new file mode 100644 index 000000000..bc6338273 --- /dev/null +++ b/install/seaweedfs-install.sh @@ -0,0 +1,51 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2026 community-scripts ORG +# Author: MickLesk (CanbiZ) +# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE +# Source: https://github.com/seaweedfs/seaweedfs + +source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +msg_info "Installing Dependencies" +$STD apt install -y \ + fuse3 +msg_ok "Installed Dependencies" + +fetch_and_deploy_gh_release "seaweedfs" "seaweedfs/seaweedfs" "prebuild" "latest" "/opt/seaweedfs" "linux_amd64.tar.gz" + +msg_info "Setting up SeaweedFS" +mkdir -p /opt/seaweedfs-data +ln -sf /opt/seaweedfs/weed /usr/local/bin/weed +msg_ok "Set up SeaweedFS" + +msg_info "Creating Service" +cat </etc/systemd/system/seaweedfs.service +[Unit] +Description=SeaweedFS Server +After=network.target + +[Service] +Type=simple +User=root +WorkingDirectory=/opt/seaweedfs +ExecStart=/opt/seaweedfs/weed server -dir=/opt/seaweedfs-data -master.port=9333 -volume.port=8080 -filer -s3 +Restart=on-failure +RestartSec=5 +LimitNOFILE=65536 + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now seaweedfs +msg_ok "Created Service" + +motd_ssh +customize +cleanup_lxc