diff --git a/ct/headers/storybook b/ct/headers/storybook new file mode 100644 index 000000000..a0e7f1e8a --- /dev/null +++ b/ct/headers/storybook @@ -0,0 +1,6 @@ + _____ __ __ __ + / ___// /_____ _______ __/ /_ ____ ____ / /__ + \__ \/ __/ __ \/ ___/ / / / __ \/ __ \/ __ \/ //_/ + ___/ / /_/ /_/ / / / /_/ / /_/ / /_/ / /_/ / ,< +/____/\__/\____/_/ \__, /_.___/\____/\____/_/|_| + /____/ diff --git a/ct/storybook.sh b/ct/storybook.sh new file mode 100644 index 000000000..06e89cf3d --- /dev/null +++ b/ct/storybook.sh @@ -0,0 +1,54 @@ +#!/usr/bin/env bash +source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) + +# Copyright (c) 2021-2026 community-scripts ORG +# Author: MickLesk (CanbiZ) +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://github.com/storybookjs/storybook + +APP="Storybook" +var_tags="${var_tags:-dev-tools;frontend;ui}" +var_cpu="${var_cpu:-2}" +var_ram="${var_ram:-2048}" +var_disk="${var_disk:-8}" +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/storybook/.projectpath ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + + PROJECT_PATH=$(cat /opt/storybook/.projectpath) + + if [[ ! -d "$PROJECT_PATH" ]]; then + msg_error "Project directory not found: $PROJECT_PATH" + exit + fi + + msg_info "Updating Storybook" + cd "$PROJECT_PATH" + $STD npx storybook@latest upgrade --yes + msg_ok "Updated Storybook" + 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}:6006${CL}" diff --git a/install/storybook-install.sh b/install/storybook-install.sh new file mode 100644 index 000000000..1d1e4a66b --- /dev/null +++ b/install/storybook-install.sh @@ -0,0 +1,55 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2026 community-scripts ORG +# Author: MickLesk (CanbiZ) +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://github.com/storybookjs/storybook + +source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +NODE_VERSION="24" NODE_MODULE="pnpm" setup_nodejs + +msg_info "Preparing Storybook" +mkdir -p /opt/storybook +cd /opt/storybook +msg_ok "Important: Interactive configuration will start now." + +npx -y storybook@latest init --yes --no-dev +PROJECT_PATH=$(find /opt/storybook -maxdepth 2 -name ".storybook" -type d 2>/dev/null | head -n1 | xargs dirname) + +if [[ -z "$PROJECT_PATH" ]]; then + PROJECT_PATH="/opt/storybook" +fi + +cd "$PROJECT_PATH" +echo "$PROJECT_PATH" >/opt/storybook/.projectpath + +msg_info "Creating Service" +cat </etc/systemd/system/storybook.service +[Unit] +Description=Storybook Dev Server +After=network.target + +[Service] +Type=simple +User=root +WorkingDirectory=${PROJECT_PATH} +ExecStart=/usr/bin/npx storybook dev --host 0.0.0.0 --port 6006 --no-open +Restart=on-failure +RestartSec=5 + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now storybook +msg_ok "Created Service" + +motd_ssh +customize +cleanup_lxc