From dd5be08eb416fceec83711366554cd4692b8396e Mon Sep 17 00:00:00 2001 From: "push-app-to-main[bot]" <203845782+push-app-to-main[bot]@users.noreply.github.com> Date: Fri, 13 Nov 2026 09:11:37 +0100 Subject: [PATCH] Add convex (ct) (#18658) Co-authored-by: push-app-to-main[bot] <203845782+push-app-to-main[bot]@users.noreply.github.com> --- ct/convex.sh | 58 ++++++++++++++++++++++++++ install/convex-install.sh | 88 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 146 insertions(+) create mode 100644 ct/convex.sh create mode 100644 install/convex-install.sh diff --git a/ct/convex.sh b/ct/convex.sh new file mode 100644 index 000000000..30142a815 --- /dev/null +++ b/ct/convex.sh @@ -0,0 +1,58 @@ +#!/usr/bin/env bash +_cs_boot="${COMMUNITY_SCRIPTS_CORE_DIR:-$(dirname "${BASH_SOURCE[0]}")/../../core}/core/build.func" +source "$_cs_boot" 2>/dev/null || source <(curl -fsSL "${COMMUNITY_SCRIPTS_CORE_URL:-https://raw.githubusercontent.com/community-scripts/core/main}/core/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/get-convex/convex-backend + +APP="Convex" +var_tags="${var_tags:-backend;database;realtime}" +var_cpu="${var_cpu:-2}" +var_ram="${var_ram:-1024}" +var_disk="${var_disk:-4}" +var_os="${var_os:-debian}" +var_version="${var_version:-13}" +var_arm64="${var_arm64:-yes}" +var_unprivileged="${var_unprivileged:-1}" + +header_info "$APP" +variables +color +catch_errors + +function update_script() { + header_info + check_container_storage + check_container_resources + + if [[ ! -d /opt/convex ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + + if check_for_gh_release "convex" "get-convex/convex-backend"; then + msg_info "Stopping Convex" + systemctl stop convex + msg_ok "Stopped Convex" + + CLEAN_INSTALL=1 fetch_and_deploy_gh_release "convex" "get-convex/convex-backend" "prebuild" "latest" "/opt/convex" "convex-local-backend-$(arch_resolve "x86_64" "aarch64")-unknown-linux-gnu.zip" + CLEAN_INSTALL=1 fetch_and_deploy_gh_release "convex-dashboard" "get-convex/convex-backend" "prebuild" "$(cat ~/.convex)" "/opt/convex-dashboard" "dashboard.zip" + + msg_info "Starting Convex" + systemctl start convex + msg_ok "Started Convex" + 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 the dashboard using the following URL:${CL}" +echo -e "${GATEWAY}${BGN}http://${IP}:6791${CL}" +echo -e "${INFO}${YW}Deployment URL: http://${IP}:3210, admin key in /opt/convex_data/.env${CL}" diff --git a/install/convex-install.sh b/install/convex-install.sh new file mode 100644 index 000000000..c0ae39a9a --- /dev/null +++ b/install/convex-install.sh @@ -0,0 +1,88 @@ +#!/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/get-convex/convex-backend + +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 nginx +msg_ok "Installed Dependencies" + +NODE_VERSION="24" setup_nodejs + +fetch_and_deploy_gh_release "convex" "get-convex/convex-backend" "prebuild" "latest" "/opt/convex" "convex-local-backend-$(arch_resolve "x86_64" "aarch64")-unknown-linux-gnu.zip" +fetch_and_deploy_gh_release "convex-dashboard" "get-convex/convex-backend" "prebuild" "$(cat ~/.convex)" "/opt/convex-dashboard" "dashboard.zip" + +msg_info "Configuring Convex" +mkdir -p /opt/convex_data/storage /opt/convex_data/tmp +INSTANCE_SECRET=$(openssl rand -hex 32) +ADMIN_KEY=$(/opt/convex/convex-local-backend keygen admin-key --instance-name convex-self-hosted --instance-secret "$INSTANCE_SECRET") +cat </opt/convex_data/.env +INSTANCE_NAME=convex-self-hosted +INSTANCE_SECRET=${INSTANCE_SECRET} +CONVEX_SELF_HOSTED_ADMIN_KEY="${ADMIN_KEY}" +CONVEX_CLOUD_ORIGIN=http://${LOCAL_IP}:3210 +CONVEX_SITE_ORIGIN=http://${LOCAL_IP}:3211 +TMPDIR=/opt/convex_data/tmp +RUST_LOG=info +DOCUMENT_RETENTION_DELAY=172800 +DISABLE_METRICS_ENDPOINT=true +APPLICATION_MAX_CONCURRENT_MUTATIONS=16 +APPLICATION_MAX_CONCURRENT_QUERIES=16 +APPLICATION_MAX_CONCURRENT_V8_ACTIONS=16 +APPLICATION_MAX_CONCURRENT_NODE_ACTIONS=16 +EOF +chmod 600 /opt/convex_data/.env +msg_ok "Configured Convex" + +msg_info "Configuring Nginx" +cat </etc/nginx/sites-available/convex-dashboard +server { + listen 6791; + server_name _; + root /opt/convex-dashboard; + index index.html; + + location / { + try_files \$uri \$uri.html \$uri/ =404; + } +} +EOF +nginx_enable_site "convex-dashboard" +msg_ok "Configured Nginx" + +msg_info "Creating Service" +cat </etc/systemd/system/convex.service +[Unit] +Description=Convex Backend +After=network-online.target +Wants=network-online.target + +[Service] +Type=simple +WorkingDirectory=/opt/convex_data +EnvironmentFile=/opt/convex_data/.env +ExecStart=/opt/convex/convex-local-backend --instance-name \${INSTANCE_NAME} --instance-secret \${INSTANCE_SECRET} --port 3210 --site-proxy-port 3211 --convex-origin \${CONVEX_CLOUD_ORIGIN} --convex-site \${CONVEX_SITE_ORIGIN} --local-storage /opt/convex_data/storage /opt/convex_data/db.sqlite3 +KillSignal=SIGINT +TimeoutStopSec=10 +Restart=on-failure +RestartSec=5 + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now convex +msg_ok "Created Service" + +motd_ssh +customize +cleanup_lxc