Skip to content

Commit 1f9c670

Browse files
push-app-to-main[bot]CrazyWolf13MickLesk
authored
Kan (#14776)
* Add kan (ct) * add: tarball mode * Update kan-install.sh * Update install/kan-install.sh Co-authored-by: Tobias <96661824+CrazyWolf13@users.noreply.github.com> --------- Co-authored-by: push-app-to-main[bot] <203845782+push-app-to-main[bot]@users.noreply.github.com> Co-authored-by: Tobias <96661824+CrazyWolf13@users.noreply.github.com> Co-authored-by: CanbiZ (MickLesk) <47820557+MickLesk@users.noreply.github.com>
1 parent fdfb603 commit 1f9c670

3 files changed

Lines changed: 179 additions & 0 deletions

File tree

ct/headers/kan

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
__ __
2+
/ //_/___ _____
3+
/ ,< / __ `/ __ \
4+
/ /| / /_/ / / / /
5+
/_/ |_\__,_/_/ /_/
6+

ct/kan.sh

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
#!/usr/bin/env bash
2+
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
3+
# Copyright (c) 2021-2026 community-scripts ORG
4+
# Author: MickLesk (CanbiZ)
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://github.com/kanbn/kan
7+
8+
APP="Kan"
9+
var_tags="${var_tags:-project-management;kanban}"
10+
var_cpu="${var_cpu:-4}"
11+
var_ram="${var_ram:-4096}"
12+
var_disk="${var_disk:-12}"
13+
var_os="${var_os:-debian}"
14+
var_version="${var_version:-13}"
15+
var_arm64="${var_arm64:-no}"
16+
var_unprivileged="${var_unprivileged:-1}"
17+
18+
header_info "$APP"
19+
variables
20+
color
21+
catch_errors
22+
23+
function update_script() {
24+
header_info
25+
check_container_storage
26+
check_container_resources
27+
28+
if [[ ! -d /opt/kan ]]; then
29+
msg_error "No ${APP} Installation Found!"
30+
exit
31+
fi
32+
33+
if check_for_gh_tag "kan" "kanbn/kan"; then
34+
msg_info "Stopping Service"
35+
systemctl stop kan
36+
msg_ok "Stopped Service"
37+
38+
msg_info "Backing up Data"
39+
cp /opt/kan/.env /opt/kan.env.bak
40+
msg_ok "Backed up Data"
41+
42+
CLEAN_INSTALL=1 fetch_and_deploy_gh_tag "kan" "kanbn/kan" "tarball"
43+
44+
msg_info "Restoring Configuration"
45+
cp /opt/kan.env.bak /opt/kan/.env
46+
rm -f /opt/kan.env.bak
47+
msg_ok "Restored Configuration"
48+
49+
msg_info "Building Application"
50+
cd /opt/kan
51+
set -a && source /opt/kan/.env && set +a
52+
export NEXT_PUBLIC_USE_STANDALONE_OUTPUT=true CI=true
53+
$STD pnpm install
54+
$STD pnpm build --filter=@kan/web
55+
unset NEXT_PUBLIC_USE_STANDALONE_OUTPUT CI
56+
msg_ok "Built Application"
57+
58+
msg_info "Setting up Standalone"
59+
mkdir -p /opt/kan/apps/web/.next/standalone/apps/web/.next/static
60+
cp -r /opt/kan/apps/web/.next/static/* /opt/kan/apps/web/.next/standalone/apps/web/.next/static/
61+
cp -r /opt/kan/apps/web/public /opt/kan/apps/web/.next/standalone/apps/web/public
62+
msg_ok "Set up Standalone"
63+
64+
msg_info "Running Database Migrations"
65+
cd /opt/kan/packages/db
66+
$STD pnpm exec drizzle-kit migrate
67+
msg_ok "Ran Database Migrations"
68+
69+
msg_info "Starting Service"
70+
systemctl start kan
71+
msg_ok "Started Service"
72+
msg_ok "Updated successfully!"
73+
fi
74+
exit
75+
}
76+
77+
start
78+
build_container
79+
description
80+
81+
msg_ok "Completed Successfully!\n"
82+
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
83+
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
84+
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:3000${CL}"

install/kan-install.sh

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright (c) 2021-2026 community-scripts ORG
4+
# Author: MickLesk (CanbiZ)
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://github.com/kanbn/kan
7+
8+
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
9+
color
10+
verb_ip6
11+
catch_errors
12+
setting_up_container
13+
network_check
14+
update_os
15+
16+
msg_info "Installing Dependencies"
17+
$STD apt install -y \
18+
build-essential \
19+
git
20+
msg_ok "Installed Dependencies"
21+
22+
PG_VERSION="16" setup_postgresql
23+
PG_DB_NAME="kan" PG_DB_USER="kan" setup_postgresql_db
24+
NODE_VERSION="20" NODE_MODULE="pnpm" setup_nodejs
25+
26+
fetch_and_deploy_gh_tag "kan" "kanbn/kan" "tarball"
27+
28+
msg_info "Configuring Application"
29+
AUTH_SECRET=$(openssl rand -base64 32)
30+
cat <<EOF >/opt/kan/.env
31+
NEXT_PUBLIC_BASE_URL=http://${LOCAL_IP}:3000
32+
BETTER_AUTH_SECRET=${AUTH_SECRET}
33+
BETTER_AUTH_TRUSTED_ORIGINS=http://${LOCAL_IP}:3000
34+
POSTGRES_URL=postgres://${PG_DB_USER}:${PG_DB_PASS}@localhost:5432/${PG_DB_NAME}
35+
NEXT_PUBLIC_ALLOW_CREDENTIALS=true
36+
TRELLO_APP_API_KEY=
37+
TRELLO_APP_API_SECRET=
38+
HOSTNAME=0.0.0.0
39+
PORT=3000
40+
NODE_ENV=production
41+
EOF
42+
msg_ok "Configured Application"
43+
44+
msg_info "Building Application"
45+
cd /opt/kan
46+
set -a && source /opt/kan/.env && set +a
47+
export NEXT_PUBLIC_USE_STANDALONE_OUTPUT=true NEXT_PUBLIC_BASE_URL BETTER_AUTH_TRUSTED_ORIGINS NEXT_PUBLIC_ALLOW_CREDENTIALS BETTER_AUTH_SECRET
48+
export CI=true
49+
$STD pnpm install
50+
$STD pnpm build --filter=@kan/web
51+
unset NEXT_PUBLIC_USE_STANDALONE_OUTPUT CI
52+
msg_ok "Built Application"
53+
54+
msg_info "Setting up Standalone"
55+
mkdir -p /opt/kan/apps/web/.next/standalone/apps/web/.next/static
56+
cp -r /opt/kan/apps/web/.next/static/* /opt/kan/apps/web/.next/standalone/apps/web/.next/static/
57+
cp -r /opt/kan/apps/web/public /opt/kan/apps/web/.next/standalone/apps/web/public
58+
msg_ok "Set up Standalone"
59+
60+
msg_info "Running Database Migrations"
61+
cd /opt/kan/packages/db
62+
POSTGRES_URL="postgres://${PG_DB_USER}:${PG_DB_PASS}@localhost:5432/${PG_DB_NAME}" $STD pnpm exec drizzle-kit migrate
63+
msg_ok "Ran Database Migrations"
64+
65+
msg_info "Creating Service"
66+
cat <<EOF >/etc/systemd/system/kan.service
67+
[Unit]
68+
Description=Kan Board
69+
After=network.target postgresql.service
70+
Requires=postgresql.service
71+
72+
[Service]
73+
Type=simple
74+
User=root
75+
WorkingDirectory=/opt/kan/apps/web/.next/standalone
76+
EnvironmentFile=/opt/kan/.env
77+
ExecStart=/usr/bin/node apps/web/server.js
78+
Restart=on-failure
79+
RestartSec=5
80+
81+
[Install]
82+
WantedBy=multi-user.target
83+
EOF
84+
systemctl enable -q --now kan
85+
msg_ok "Created Service"
86+
87+
motd_ssh
88+
customize
89+
cleanup_lxc

0 commit comments

Comments
 (0)