Skip to content

Commit 93c320c

Browse files
committed
update
1 parent 42bee64 commit 93c320c

2 files changed

Lines changed: 37 additions & 53 deletions

File tree

ct/maintainerr.sh

Lines changed: 31 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -19,38 +19,6 @@ variables
1919
color
2020
catch_errors
2121

22-
function build_maintainerr() {
23-
NODE_VERSION="24" setup_nodejs
24-
msg_info "Preparing Build Runtime"
25-
export COREPACK_ENABLE_DOWNLOAD_PROMPT=0
26-
$STD corepack enable
27-
if [[ -f /opt/maintainerr/package.json ]]; then
28-
if command -v jq >/dev/null 2>&1; then
29-
yarn_spec=$(jq -r '.packageManager // empty' /opt/maintainerr/package.json 2>/dev/null || true)
30-
if [[ -n "$yarn_spec" && "$yarn_spec" == yarn@* ]]; then
31-
yarn_ver="${yarn_spec#yarn@}"
32-
yarn_ver="${yarn_ver%%+*}"
33-
$STD corepack prepare "yarn@${yarn_ver}" --activate || true
34-
fi
35-
fi
36-
fi
37-
msg_ok "Prepared Build Runtime"
38-
39-
msg_info "Building Maintainerr (Patience)"
40-
cd /opt/maintainerr || { msg_error "Failed to change to /opt/maintainerr"; return 1; }
41-
cat <<'EOF' >/opt/maintainerr/apps/ui/.env
42-
VITE_BASE_PATH=/__PATH_PREFIX__
43-
EOF
44-
export NODE_OPTIONS="--max-old-space-size=4096"
45-
$STD yarn install --immutable --network-timeout 99999999
46-
$STD yarn turbo build
47-
$STD yarn workspaces focus --all --production
48-
mkdir -p /opt/maintainerr/apps/server/dist/ui
49-
cp -a /opt/maintainerr/apps/ui/dist/. /opt/maintainerr/apps/server/dist/ui/
50-
ln -sfnT /opt/maintainerr /opt/app
51-
msg_ok "Built Maintainerr"
52-
}
53-
5422
function update_script() {
5523
header_info
5624
check_container_storage
@@ -66,11 +34,39 @@ function update_script() {
6634
systemctl stop maintainerr
6735
msg_ok "Stopped Service"
6836

69-
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "maintainerr" "Maintainerr/Maintainerr" "tarball" "latest" "/opt/maintainerr"
70-
build_maintainerr
37+
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "maintainerr" "Maintainerr/Maintainerr" "tarball"
38+
39+
NODE_VERSION="24" setup_nodejs
40+
msg_info "Preparing Build Runtime"
41+
export COREPACK_ENABLE_DOWNLOAD_PROMPT=0
42+
$STD corepack enable
43+
if [[ -f /opt/maintainerr/package.json ]]; then
44+
if command -v jq >/dev/null 2>&1; then
45+
yarn_spec=$(jq -r '.packageManager // empty' /opt/maintainerr/package.json 2>/dev/null || true)
46+
if [[ -n "$yarn_spec" && "$yarn_spec" == yarn@* ]]; then
47+
yarn_ver="${yarn_spec#yarn@}"
48+
yarn_ver="${yarn_ver%%+*}"
49+
$STD corepack prepare "yarn@${yarn_ver}" --activate || true
50+
fi
51+
fi
52+
fi
53+
msg_ok "Prepared Build Runtime"
54+
55+
msg_info "Building Maintainerr (Patience)"
56+
cd /opt/maintainerr || { msg_error "Failed to change to /opt/maintainerr"; exit 1; }
57+
cat <<EOF >/opt/maintainerr/apps/ui/.env
58+
VITE_BASE_PATH=/__PATH_PREFIX__
59+
EOF
60+
export NODE_OPTIONS="--max-old-space-size=4096"
61+
$STD yarn install --immutable --network-timeout 99999999
62+
$STD yarn turbo build
63+
$STD yarn workspaces focus --all --production
64+
mkdir -p /opt/maintainerr/apps/server/dist/ui
65+
cp -a /opt/maintainerr/apps/ui/dist/. /opt/maintainerr/apps/server/dist/ui/
66+
ln -sfnT /opt/maintainerr /opt/app
67+
msg_ok "Built Maintainerr"
7168

7269
msg_info "Starting Service"
73-
systemctl daemon-reload
7470
systemctl start maintainerr
7571
msg_ok "Started Service"
7672
msg_ok "Updated successfully!"

install/maintainerr-install.sh

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ network_check
1414
update_os
1515

1616
msg_info "Installing Dependencies"
17-
$STD apt-get install -y \
17+
$STD apt install -y \
1818
build-essential \
1919
python3
2020
msg_ok "Installed Dependencies"
2121

22-
fetch_and_deploy_gh_release "maintainerr" "Maintainerr/Maintainerr" "tarball" "latest" "/opt/maintainerr"
22+
fetch_and_deploy_gh_release "maintainerr" "Maintainerr/Maintainerr" "tarball"
2323

2424
NODE_VERSION="24" setup_nodejs
2525
msg_info "Preparing Build Runtime"
@@ -40,8 +40,8 @@ ln -sfnT /opt/maintainerr /opt/app
4040
msg_ok "Prepared Build Runtime"
4141

4242
msg_info "Building Maintainerr (Patience)"
43-
cd /opt/maintainerr || { msg_error "Failed to change to /opt/maintainerr"; exit 1; }
44-
cat <<'EOF' >/opt/maintainerr/apps/ui/.env
43+
cd /opt/maintainerr
44+
cat <<EOF >/opt/maintainerr/apps/ui/.env
4545
VITE_BASE_PATH=/__PATH_PREFIX__
4646
EOF
4747
export NODE_OPTIONS="--max-old-space-size=4096"
@@ -59,7 +59,6 @@ set -euo pipefail
5959
6060
BASE_PATH_REPLACE="${BASE_PATH:-}"
6161
UI_DIST_DIR="/opt/maintainerr/apps/server/dist/ui"
62-
BASE_PATH_MARKER="/opt/maintainerr/.base-path-applied"
6362
6463
if [[ ! -d "$UI_DIST_DIR" ]]; then
6564
echo "Missing UI build directory: $UI_DIST_DIR" >&2
@@ -73,16 +72,6 @@ if grep -R -q -- '/__PATH_PREFIX__' "$UI_DIST_DIR"; then
7372
echo "Failed to rewrite UI base paths under $UI_DIST_DIR" >&2
7473
exit 1
7574
fi
76-
printf '%s' "$BASE_PATH_REPLACE" >"$BASE_PATH_MARKER"
77-
elif [[ -f "$BASE_PATH_MARKER" ]]; then
78-
APPLIED_BASE_PATH="$(cat "$BASE_PATH_MARKER")"
79-
if [[ "$APPLIED_BASE_PATH" != "$BASE_PATH_REPLACE" ]]; then
80-
echo "BASE_PATH changed from '$APPLIED_BASE_PATH' to '$BASE_PATH_REPLACE', but UI assets were already rewritten. Rebuild Maintainerr to apply a new BASE_PATH." >&2
81-
exit 1
82-
fi
83-
else
84-
# Compatibility path for installs created before marker tracking existed.
85-
printf '%s' "$BASE_PATH_REPLACE" >"$BASE_PATH_MARKER"
8675
fi
8776
8877
exec npm run --prefix /opt/maintainerr/apps/server start
@@ -91,7 +80,7 @@ chmod +x /opt/maintainerr/start.sh
9180
msg_ok "Created Start Script"
9281

9382
msg_info "Configuring Maintainerr"
94-
cat <<'EOF' >/etc/maintainerr/maintainerr.conf
83+
cat <<EOF >/etc/maintainerr/maintainerr.conf
9584
UI_PORT=6246
9685
UI_HOSTNAME=0.0.0.0
9786
VERSION_TAG=stable
@@ -101,7 +90,7 @@ EOF
10190
msg_ok "Configured Maintainerr"
10291

10392
msg_info "Creating Service"
104-
cat <<'EOF' >/etc/systemd/system/maintainerr.service
93+
cat <<EOF >/etc/systemd/system/maintainerr.service
10594
[Unit]
10695
Description=Maintainerr Service
10796
Wants=network-online.target
@@ -119,7 +108,6 @@ ExecStart=/opt/maintainerr/start.sh
119108
[Install]
120109
WantedBy=multi-user.target
121110
EOF
122-
systemctl daemon-reload
123111
systemctl enable -q --now maintainerr
124112
msg_ok "Created Service"
125113

0 commit comments

Comments
 (0)