This commit is contained in:
CanbiZ 2025-07-29 13:08:05 +02:00
parent 35a1225c3e
commit 2c883bd928
2 changed files with 124 additions and 0 deletions

44
ct/kanba.sh Normal file
View File

@ -0,0 +1,44 @@
#!/usr/bin/env bash
source <(curl -s https://git.community-scripts.org/community-scripts/ProxmoxVED/raw/branch/main/misc/build.func)
# Copyright (c) 2021-2025 community-scripts ORG
# Author: MickLesk (CanbiZ)
# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE
# Source: https://github.com/Kanba-co/kanba
APP="Kanba"
var_tags="${var_tags:-kanban}"
var_cpu="${var_cpu:-1}"
var_ram="${var_ram:-2048}"
var_disk="${var_disk:-5}"
var_os="${var_os:-debian}"
var_version="${var_version:-12}"
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 /var ]]; then
msg_error "No ${APP} Installation Found!"
exit
fi
msg_info "Updating $APP LXC"
$STD apt-get update
$STD apt-get -y upgrade
msg_ok "Updated $APP LXC"
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}:3000${CL}"

80
install/kanba-install.sh Normal file
View File

@ -0,0 +1,80 @@
#!/usr/bin/env bash
# Copyright (c) 2021-2025 community-scripts ORG
# Author: MickLesk (CanbiZ)
# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE
# Source: https://github.com/Kanba-co/kanba
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
color
verb_ip6
catch_errors
setting_up_container
network_check
update_os
NODE_VERSION="22" NODE_MODULE="npx" setup_nodejs
fetch_and_deploy_gh_release "kanba" "Kanba-co/kanba" "tarball" "latest" "/opt/kanba"
POSTGRES_VERSION="16" setup_postgresql
msg_info "Set up PostgreSQL Database"
DB_NAME=kanba_db
DB_USER=kanba_usr
DB_PASS="$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | cut -c1-13)"
DB_URL="postgresql://${DB_USER}:${DB_PASS}@localhost:5432/${DB_NAME}"
$STD sudo -u postgres psql -c "CREATE ROLE $DB_USER WITH LOGIN PASSWORD '$DB_PASS';"
$STD sudo -u postgres psql -c "CREATE DATABASE $DB_NAME WITH OWNER $DB_USER ENCODING 'UTF8' TEMPLATE template0;"
$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET client_encoding TO 'utf8';"
$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET default_transaction_isolation TO 'read committed';"
$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET timezone TO 'UTC';"
{
echo "Kanba-Credentials"
echo "Kanba Database Name: $DB_NAME"
echo "Kanba Database User: $DB_USER"
echo "Kanba Database Password: $DB_PASS"
} >>~/kanba.creds
msg_ok "Set up PostgreSQL Database"
msg_info "Preparing .env.local"
cd /opt/kanba
cp .env.example .env.local
sed -i "s|^DATABASE_PROVIDER=.*|DATABASE_PROVIDER=postgresql|" .env.local
sed -i "s|^DATABASE_URL=.*|DATABASE_URL=${DB_URL}|" .env.local
sed -i "s|^NEXT_PUBLIC_SITE_URL=.*|NEXT_PUBLIC_SITE_URL=http://localhost:3000|" .env.local
sed -i "s|^NEXTAUTH_URL=.*|NEXTAUTH_URL=http://localhost:3000|" .env.local
sed -i "s|^NEXTAUTH_SECRET=.*|NEXTAUTH_SECRET=$(openssl rand -hex 32)|" .env.local
msg_ok "Prepared .env.local"
msg_info "Installing Kanba"
$STD npm install
$STD npx prisma generate
$STD npx prisma migrate deploy
$STD npm run build
msg_ok "Installed Kanba"
msg_info "Creating systemd Service"
cat <<EOF >/etc/systemd/system/kanba.service
[Unit]
Description=Kanba - Lightweight Trello Alternative
After=network.target postgresql.service
[Service]
Type=simple
WorkingDirectory=/opt/kanba
EnvironmentFile=/opt/kanba/.env.local
ExecStart=/usr/bin/npx next start -p 3000
Restart=always
[Install]
WantedBy=multi-user.target
EOF
systemctl enable -q --now kanba
msg_ok "Created systemd Service"
motd_ssh
customize
msg_info "Cleaning up"
$STD apt-get -y autoremove
$STD apt-get -y autoclean
msg_ok "Cleaned"