|
| 1 | +#!/usr/bin/env bash |
| 2 | +_cs_boot="${COMMUNITY_SCRIPTS_CORE_DIR:-$(dirname "${BASH_SOURCE[0]}")/../../core}/core/build.func" |
| 3 | +source "$_cs_boot" 2>/dev/null || source <(curl -fsSL "${COMMUNITY_SCRIPTS_CORE_URL:-https://raw.githubusercontent.com/community-scripts/core/main}/core/build.func") |
| 4 | +# Copyright (c) 2021-2026 community-scripts ORG |
| 5 | +# Author: Brandon Visca (visbran) |
| 6 | +# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE |
| 7 | +# Source: https://github.com/every-app/open-seo |
| 8 | + |
| 9 | +APP="OpenSEO" |
| 10 | +var_tags="${var_tags:-seo;analytics;marketing}" |
| 11 | +var_cpu="${var_cpu:-2}" |
| 12 | +var_ram="${var_ram:-4096}" |
| 13 | +var_disk="${var_disk:-10}" |
| 14 | +var_os="${var_os:-debian}" |
| 15 | +var_version="${var_version:-13}" |
| 16 | +#var_arm64="${var_arm64:-no}" # unset = ask the user; set yes/no only when verified |
| 17 | +var_unprivileged="${var_unprivileged:-1}" |
| 18 | +export var_dataforseo_api_key="${var_dataforseo_api_key:-}" |
| 19 | + |
| 20 | +header_info "$APP" |
| 21 | +variables |
| 22 | +color |
| 23 | +catch_errors |
| 24 | + |
| 25 | +function update_script() { |
| 26 | + header_info |
| 27 | + check_container_storage |
| 28 | + check_container_resources |
| 29 | + |
| 30 | + if [[ ! -d /opt/openseo ]]; then |
| 31 | + msg_error "No ${APP} Installation Found!" |
| 32 | + exit |
| 33 | + fi |
| 34 | + |
| 35 | + if check_for_gh_release "openseo" "every-app/open-seo"; then |
| 36 | + msg_info "Stopping OpenSEO" |
| 37 | + systemctl stop openseo |
| 38 | + msg_ok "Stopped OpenSEO" |
| 39 | + |
| 40 | + create_backup /opt/openseo/.env /opt/openseo/.wrangler |
| 41 | + |
| 42 | + CLEAN_INSTALL=1 fetch_and_deploy_gh_release "openseo" "every-app/open-seo" "tarball" |
| 43 | + |
| 44 | + restore_backup |
| 45 | + |
| 46 | + PNPM_VERSION=$(sed -n 's/.*"packageManager": "pnpm@\([^"+]*\).*/\1/p' /opt/openseo/package.json) |
| 47 | + NODE_VERSION="22" NODE_MODULE="pnpm@${PNPM_VERSION:-10.30.1}" setup_nodejs |
| 48 | + |
| 49 | + msg_info "Building OpenSEO" |
| 50 | + cd /opt/openseo |
| 51 | + $STD pnpm install --frozen-lockfile |
| 52 | + # The Cloudflare vite plugin serializes the whole process env into .dev.vars; run with a clean env so it only sees /opt/openseo/.env |
| 53 | + $STD env -i PATH="$PATH" HOME=/root pnpm run db:migrate:local |
| 54 | + $STD env -i PATH="$PATH" HOME=/root pnpm run build |
| 55 | + msg_ok "Built OpenSEO" |
| 56 | + |
| 57 | + msg_info "Starting OpenSEO" |
| 58 | + systemctl start openseo |
| 59 | + msg_ok "Started OpenSEO" |
| 60 | + msg_ok "Updated successfully!" |
| 61 | + fi |
| 62 | + exit |
| 63 | +} |
| 64 | + |
| 65 | +start |
| 66 | +build_container |
| 67 | +description |
| 68 | + |
| 69 | +msg_ok "Completed Successfully!\n" |
| 70 | +echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}" |
| 71 | +echo -e "${INFO}${YW} Access it using the following URL:${CL}" |
| 72 | +echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:3001${CL}" |
0 commit comments