mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-12-05 06:04:11 +01:00
Kan v0.8.0 split the app into apps/web and apps/api. The web app proxies all API and auth calls to a separate API process on port 4000, which the script neither built nor started, so sign-up failed with 502. - Bundle the API with apps/api/build.mjs and run it as kan-api.service - Order kan.service after kan-api.service - Update: build the API, stop/start both services, and create the API service on existing installs - Use TRELLO_APP_SECRET, the name upstream reads
115 lines
3.3 KiB
Bash
115 lines
3.3 KiB
Bash
#!/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/kanbn/kan
|
|
|
|
APP="Kan"
|
|
var_tags="${var_tags:-project-management;kanban}"
|
|
var_cpu="${var_cpu:-4}"
|
|
var_ram="${var_ram:-4096}"
|
|
var_disk="${var_disk:-12}"
|
|
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/kan ]]; then
|
|
msg_error "No ${APP} Installation Found!"
|
|
exit
|
|
fi
|
|
|
|
if [[ ! -f /etc/systemd/system/kan-api.service ]]; then
|
|
msg_info "Creating API Service"
|
|
cat <<EOF >/etc/systemd/system/kan-api.service
|
|
[Unit]
|
|
Description=Kan API
|
|
After=network.target postgresql.service
|
|
Requires=postgresql.service
|
|
|
|
[Service]
|
|
Type=simple
|
|
User=root
|
|
WorkingDirectory=/opt/kan/apps/api/dist
|
|
EnvironmentFile=/opt/kan/.env
|
|
ExecStart=/usr/bin/node main.mjs
|
|
Restart=on-failure
|
|
RestartSec=5
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
EOF
|
|
systemctl daemon-reload
|
|
if [[ -f /opt/kan/apps/api/build.mjs ]]; then
|
|
cd /opt/kan/apps/api
|
|
$STD node build.mjs
|
|
systemctl enable -q --now kan-api
|
|
fi
|
|
msg_ok "Created API Service"
|
|
fi
|
|
|
|
if check_for_gh_tag "kan" "kanbn/kan"; then
|
|
NODE_VERSION="24" NODE_MODULE="pnpm" setup_nodejs
|
|
|
|
msg_info "Stopping Services"
|
|
systemctl stop kan kan-api
|
|
msg_ok "Stopped Services"
|
|
|
|
create_backup /opt/kan/.env
|
|
CLEAN_INSTALL=1 fetch_and_deploy_gh_tag "kan" "kanbn/kan" "latest"
|
|
restore_backup
|
|
|
|
msg_info "Building Application"
|
|
cd /opt/kan
|
|
set -a && source /opt/kan/.env && set +a
|
|
export NEXT_PUBLIC_USE_STANDALONE_OUTPUT=true
|
|
$STD pnpm install --ignore-scripts --prod=false
|
|
export CI=true
|
|
find /opt/kan/packages /opt/kan/apps -name 'tsconfig.json' -exec sed -i 's|"@kan/tsconfig/|"../../tooling/typescript/|g' {} +
|
|
$STD pnpm build --filter=@kan/web
|
|
cd /opt/kan/apps/api
|
|
$STD node build.mjs
|
|
unset NEXT_PUBLIC_USE_STANDALONE_OUTPUT CI
|
|
msg_ok "Built Application"
|
|
|
|
msg_info "Setting up Standalone"
|
|
mkdir -p /opt/kan/apps/web/.next/standalone/apps/web/.next/static
|
|
cp -r /opt/kan/apps/web/.next/static/* /opt/kan/apps/web/.next/standalone/apps/web/.next/static/
|
|
cp -r /opt/kan/apps/web/public /opt/kan/apps/web/.next/standalone/apps/web/public
|
|
msg_ok "Set up Standalone"
|
|
|
|
msg_info "Running Database Migrations"
|
|
cd /opt/kan/packages/db
|
|
$STD pnpm exec drizzle-kit migrate
|
|
msg_ok "Ran Database Migrations"
|
|
|
|
msg_info "Starting Services"
|
|
systemctl enable -q --now kan-api
|
|
systemctl start kan
|
|
msg_ok "Started Services"
|
|
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 "${GATEWAY}${BGN}http://${IP}:3000${CL}"
|