Skip to content

Commit 5ac6fc0

Browse files
authored
Merge pull request #2221 from opastorello/add-jumpserver
New script: JumpServer
2 parents 0871943 + 55aee69 commit 5ac6fc0

3 files changed

Lines changed: 554 additions & 0 deletions

File tree

‎ct/jumpserver.sh‎

Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
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+
5+
# Copyright (c) 2021-2026 community-scripts ORG
6+
# Author: Nícolas Pastorello (opastorello)
7+
# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE
8+
# Source: https://www.jumpserver.org/ | Github: https://github.com/jumpserver/jumpserver
9+
10+
APP="JumpServer"
11+
var_tags="${var_tags:-bastion-host;pam}"
12+
var_cpu="${var_cpu:-4}"
13+
var_ram="${var_ram:-8192}"
14+
var_disk="${var_disk:-50}"
15+
var_os="${var_os:-debian}"
16+
var_version="${var_version:-13}"
17+
var_unprivileged="${var_unprivileged:-1}"
18+
#var_arm64="${var_arm64:-no}" # unset = ask the user; every component builds from source with arm64-capable toolchains, but the stack has only been run on amd64
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/jumpserver ]]; then
31+
msg_error "No ${APP} Installation Found!"
32+
exit
33+
fi
34+
35+
if check_for_gh_tag "guacd" "apache/guacamole-server"; then
36+
msg_info "Stopping guacd"
37+
systemctl stop guacd
38+
msg_ok "Stopped guacd"
39+
40+
CLEAN_INSTALL=1 fetch_and_deploy_gh_tag "guacd" "apache/guacamole-server"
41+
42+
msg_info "Building guacd"
43+
cd /opt/guacd
44+
$STD autoreconf -fi
45+
# FreeRDP 3.6+ deprecates APIs guacd still calls, which -Werror turns into build failures
46+
$STD ./configure --with-systemd-dir=/etc/systemd/system --disable-guacenc CFLAGS="-O2 -Wno-error=deprecated-declarations"
47+
$STD make -j"$(nproc)"
48+
$STD make install
49+
$STD ldconfig
50+
systemctl daemon-reload
51+
systemctl start guacd
52+
msg_ok "Built guacd"
53+
fi
54+
55+
if check_for_gh_release "jumpserver" "jumpserver/jumpserver" "" "" "v5."; then
56+
msg_info "Stopping Services"
57+
systemctl stop jumpserver koko
58+
msg_ok "Stopped Services"
59+
60+
create_backup /opt/jumpserver/config.yml /opt/jumpserver/data /opt/koko/config.yml /opt/koko/data
61+
62+
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "jumpserver" "jumpserver/jumpserver" "tarball" "latest" "" "" "v5."
63+
JMS_TAG="v$(<~/.jumpserver)"
64+
CLEAN_INSTALL=1 fetch_and_deploy_gh_tag "koko" "jumpserver/koko" "$JMS_TAG"
65+
66+
restore_backup
67+
68+
msg_info "Updating Python Environment"
69+
cd /opt/jumpserver
70+
$STD bash requirements/static_files.sh
71+
$STD uv venv --python 3.14
72+
$STD uv pip install -r pyproject.toml
73+
JMS_GALAXY_RETRIES=3
74+
until ANSIBLE_COLLECTIONS_PATHS="/opt/jumpserver/.venv/lib/python3.14/site-packages/ansible_collections" $STD .venv/bin/ansible-galaxy collection install -r requirements/collections.yml --force --ignore-certs; do
75+
JMS_GALAXY_RETRIES=$((JMS_GALAXY_RETRIES - 1))
76+
if ((JMS_GALAXY_RETRIES <= 0)); then
77+
msg_error "ansible-galaxy collection install failed after 3 attempts (Ansible Galaxy may be unreachable)"
78+
exit 1
79+
fi
80+
sleep 15
81+
done
82+
cd /opt/jumpserver/apps
83+
$STD ../.venv/bin/python3 manage.py compilemessages
84+
msg_ok "Updated Python Environment"
85+
86+
GHOSTTY_COMMIT=$(grep -oP 'libghostty-vt:ghostty-\K[0-9a-f]+' /opt/koko/Dockerfile-base)
87+
ZIG_VERSION=$(grep -oP 'libghostty-vt:ghostty-[0-9a-f]+-zig-\K[0-9.]+' /opt/koko/Dockerfile-base)
88+
USQL_VERSION=$(grep -oP 'ARG USQL_VERSION=\K\S+' /opt/koko/Dockerfile-base)
89+
K8S_BUNDLE_VERSION=$(grep -oP 'ARG K8S_BUNDLE_VERSION=\K\S+' /opt/koko/Dockerfile-base)
90+
GO_VERSION=$(grep -oP '^go \K\S+' /opt/koko/go.mod) setup_go
91+
92+
if [[ "$(cat ~/.libghostty-vt 2>/dev/null)" != "$GHOSTTY_COMMIT" ]]; then
93+
fetch_and_deploy_from_url "https://ziglang.org/download/${ZIG_VERSION}/zig-$(arch_resolve x86_64 aarch64)-linux-${ZIG_VERSION}.tar.xz" "/opt/zig"
94+
fetch_and_deploy_from_url "https://github.com/ghostty-org/ghostty/archive/${GHOSTTY_COMMIT}.tar.gz" "/opt/ghostty"
95+
96+
msg_info "Building libghostty-vt"
97+
rm -rf /opt/libghostty-vt
98+
cd /opt/ghostty
99+
$STD /opt/zig/zig build -Demit-lib-vt -Doptimize=ReleaseFast -Dcpu=baseline --prefix /opt/libghostty-vt
100+
rm -rf /opt/ghostty /opt/zig ~/.cache/zig
101+
echo "$GHOSTTY_COMMIT" >~/.libghostty-vt
102+
msg_ok "Built libghostty-vt"
103+
fi
104+
105+
msg_info "Building KoKo"
106+
cd /opt/koko
107+
export PKG_CONFIG_PATH=/opt/libghostty-vt/share/pkgconfig
108+
$STD make build VERSION="$JMS_TAG"
109+
mv build/koko koko
110+
rm -rf build
111+
msg_ok "Built KoKo"
112+
113+
fetch_and_deploy_gh_release "usql" "jumpserver-dev/usql" "prebuild" "$USQL_VERSION" "/opt/usql" "usql-*-linux-$(arch_resolve amd64 arm64).tar.gz"
114+
fetch_and_deploy_gh_release "k8s-bundle" "jumpserver-dev/k8s-bundle" "binary" "$K8S_BUNDLE_VERSION" "" "k8s-bundle_$(arch_resolve amd64 arm64).deb"
115+
116+
NODE_VERSION="24" NODE_MODULE="corepack" setup_nodejs
117+
118+
# Lina and Luna sources are deleted after each build, so their version
119+
# markers must not let the fetch be skipped
120+
rm -f ~/.lina ~/.luna
121+
122+
CLEAN_INSTALL=1 fetch_and_deploy_gh_tag "lina" "jumpserver/lina" "$JMS_TAG" "/opt/lina-src"
123+
124+
msg_info "Building Lina"
125+
cd /opt/lina-src
126+
$STD yarn install --immutable
127+
$STD yarn build:prod
128+
rm -rf /opt/lina
129+
mv lina /opt/lina
130+
rm -rf /opt/lina-src
131+
msg_ok "Built Lina"
132+
133+
CLEAN_INSTALL=1 fetch_and_deploy_gh_tag "luna" "jumpserver/luna" "$JMS_TAG" "/opt/luna-src"
134+
135+
msg_info "Building Luna"
136+
cd /opt/luna-src
137+
# NUXT_TELEMETRY_DISABLED stops nuxt generate from waiting on a consent prompt
138+
export ELECTRON_SKIP_BINARY_DOWNLOAD=1 PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 HUSKY=0 NUXT_TELEMETRY_DISABLED=1
139+
$STD pnpm --filter jumpserver-web... install --frozen-lockfile --config.node-linker=isolated
140+
$STD pnpm --config.node-linker=isolated --filter jumpserver-web web:generate
141+
rm -rf /opt/luna
142+
mv .output/public /opt/luna
143+
rm -rf /opt/luna-src
144+
msg_ok "Built Luna"
145+
146+
msg_info "Starting Services"
147+
systemctl start jumpserver koko
148+
msg_ok "Started Services"
149+
msg_ok "Updated successfully!"
150+
fi
151+
exit
152+
}
153+
154+
start
155+
build_container
156+
description
157+
158+
msg_ok "Completed Successfully!\n"
159+
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
160+
echo -e "${INFO}${YW}Access it using the following URL:${CL}"
161+
echo -e "${GATEWAY}${BGN}http://${IP}${CL}"
162+
echo -e "${INFO}${YW}SSH bastion (character protocols): ${CL}${BGN}ssh -p 2222 <user>@${IP}${CL}"
163+
echo -e "${INFO}${YW}Login credentials: ~/jumpserver.creds (inside the container)${CL}"

0 commit comments

Comments
 (0)