Skip to content

Commit dae7050

Browse files
authored
Breaking Change: Homarr (#1825)
1 parent b973ca9 commit dae7050

File tree

2 files changed

+48
-39
lines changed

2 files changed

+48
-39
lines changed

ct/homarr.sh

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -32,46 +32,46 @@ function update_script() {
3232
msg_error "No ${APP} Installation Found!"
3333
exit
3434
fi
35-
RELEASE=$(curl -s https://api.github.com/repos/ajnart/homarr/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
35+
if [[ -f /opt/homarr/database/db.sqlite ]]; then
36+
msg_error "Old Homarr detected due to existing database file (/opt/homarr/database/db.sqlite)."
37+
msg_error "Update not supported. Refer to:"
38+
msg_error " - https://github.com/community-scripts/ProxmoxVE/discussions/1551"
39+
msg_error " - https://homarr.dev/docs/getting-started/after-the-installation/#importing-a-zip-from-version-before-100"
40+
exit 1
41+
fi
42+
RELEASE=$(curl -s https://api.github.com/repos/homarr-labs/homarr/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
3643
if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
44+
3745
msg_info "Stopping Services"
3846
systemctl stop homarr
3947
msg_ok "Services Stopped"
4048

41-
msg_info "Backing up Data"
49+
msg_info "Backup Data"
4250
mkdir -p /opt/homarr-data-backup
4351
cp /opt/homarr/.env /opt/homarr-data-backup/.env
44-
cp /opt/homarr/database/db.sqlite /opt/homarr-data-backup/db.sqlite
45-
cp -r /opt/homarr/data/configs /opt/homarr-data-backup/configs
46-
msg_ok "Backed up Data"
52+
msg_ok "Backup Data"
4753

48-
msg_info "Updating ${APP} to ${RELEASE}"
49-
wget -q "https://github.com/ajnart/homarr/archive/refs/tags/v${RELEASE}.zip"
54+
msg_info "Updating ${APP} to v${RELEASE}"
55+
wget -q "https://github.com/homarr-labs/homarr/archive/refs/tags/v${RELEASE}.zip"
5056
unzip -q v${RELEASE}.zip
5157
rm -rf v${RELEASE}.zip
5258
rm -rf /opt/homarr
5359
mv homarr-${RELEASE} /opt/homarr
5460
mv /opt/homarr-data-backup/.env /opt/homarr/.env
5561
cd /opt/homarr
56-
yarn install &>/dev/null
57-
yarn build &>/dev/null
62+
pnpm run db:migration:sqlite:run &>/dev/null
63+
pnpm build &>/dev/null
64+
mkdir build
65+
cp ./node_modules/better-sqlite3/build/Release/better_sqlite3.node ./build/better_sqlite3.node
5866
echo "${RELEASE}" >/opt/${APP}_version.txt
5967
msg_ok "Updated ${APP}"
6068

61-
msg_info "Restoring Data"
62-
rm -rf /opt/homarr/data/configs
63-
mv /opt/homarr-data-backup/configs /opt/homarr/data/configs
64-
mv /opt/homarr-data-backup/db.sqlite /opt/homarr/database/db.sqlite
65-
yarn db:migrate &>/dev/null
66-
rm -rf /opt/homarr-data-backup
67-
msg_ok "Restored Data"
68-
6969
msg_info "Starting Services"
7070
systemctl start homarr
7171
msg_ok "Started Services"
7272
msg_ok "Updated Successfully"
7373
else
74-
msg_ok "No update required. ${APP} is already at ${RELEASE}"
74+
msg_ok "No update required. ${APP} is already at v${RELEASE}"
7575
fi
7676
exit
7777
}
@@ -83,4 +83,4 @@ description
8383
msg_ok "Completed Successfully!\n"
8484
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
8585
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
86-
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:3000${CL}"
86+
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:3000${CL}"

install/homarr-install.sh

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
#!/usr/bin/env bash
22

3-
# Copyright (c) 2021-2025 tteck
4-
# Author: tteck (tteckster)
5-
# Co-Author: MickLesk (Canbiz)
3+
# Copyright (c) 2021-2025 community-scripts ORG
4+
# Author: MickLesk (Canbiz)
65
# License: MIT
76
# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
87
# Source: https://github.com/ajnart/homarr
@@ -20,6 +19,7 @@ $STD apt-get install -y \
2019
sudo \
2120
mc \
2221
curl \
22+
redis-server \
2323
ca-certificates \
2424
gnupg \
2525
make \
@@ -30,32 +30,40 @@ msg_ok "Installed Dependencies"
3030
msg_info "Setting up Node.js Repository"
3131
mkdir -p /etc/apt/keyrings
3232
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
33-
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" >/etc/apt/sources.list.d/nodesource.list
33+
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_22.x nodistro main" >/etc/apt/sources.list.d/nodesource.list
3434
msg_ok "Set up Node.js Repository"
3535

36-
msg_info "Installing Node.js/Yarn"
36+
msg_info "Installing Node.js/pnpm"
3737
$STD apt-get update
3838
$STD apt-get install -y nodejs
39-
$STD npm install -g yarn
40-
msg_ok "Installed Node.js/Yarn"
39+
$STD npm install -g pnpm
40+
msg_ok "Installed Node.js/pnpm"
4141

4242
msg_info "Installing Homarr (Patience)"
43-
RELEASE=$(curl -s https://api.github.com/repos/ajnart/homarr/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
44-
wget -q "https://github.com/ajnart/homarr/archive/refs/tags/v${RELEASE}.zip"
43+
cd /opt
44+
RELEASE=$(curl -s https://api.github.com/repos/homarr-labs/homarr/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
45+
wget -q "https://github.com/homarr-labs/homarr/archive/refs/tags/v${RELEASE}.zip"
4546
unzip -q v${RELEASE}.zip
46-
rm -rf v${RELEASE}.zip
4747
mv homarr-${RELEASE} /opt/homarr
48+
mkdir -p /opt/homarr_db
49+
touch /opt/homarr_db/db.sqlite
50+
AUTH_SECRET="$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | cut -c1-13)"
51+
SECRET_ENCRYPTION_KEY="$(openssl rand -base64 32 | tr -dc 'a-zA-Z0-9' | cut -c1-32)"
52+
4853
cat <<EOF >/opt/homarr/.env
49-
DATABASE_URL="file:./database/db.sqlite"
50-
NEXTAUTH_URL="http://localhost:3000"
51-
NEXTAUTH_SECRET="$(openssl rand -base64 32)"
52-
NEXT_PUBLIC_DISABLE_ANALYTICS="true"
53-
DEFAULT_COLOR_SCHEME="dark"
54+
AUTH_SECRET="${AUTH_SECRET}"
55+
DB_DRIVER='better-sqlite3'
56+
SECRET_ENCRYPTION_KEY="${SECRET_ENCRYPTION_KEY}"
57+
DB_URL='/opt/homarr_db/db.sqlite'
58+
TURBO_TELEMETRY_DISABLED=1
59+
NODE_OPTIONS='-r @homarr/log/override'
5460
EOF
61+
5562
cd /opt/homarr
56-
$STD yarn install
57-
$STD yarn build
58-
$STD yarn db:migrate
63+
$STD pnpm run db:migration:sqlite:run
64+
$STD pnpm build
65+
mkdir build
66+
cp ./node_modules/better-sqlite3/build/Release/better_sqlite3.node ./build/better_sqlite3.node
5967
echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt"
6068
msg_ok "Installed Homarr"
6169

@@ -69,18 +77,19 @@ After=network.target
6977
Type=exec
7078
WorkingDirectory=/opt/homarr
7179
EnvironmentFile=-/opt/homarr/.env
72-
ExecStart=/usr/bin/yarn start
80+
ExecStart=/usr/bin/pnpm start
7381
7482
[Install]
7583
WantedBy=multi-user.target
7684
EOF
77-
systemctl enable -q --now homarr.service
85+
systemctl enable -q --now homarr
7886
msg_ok "Created Service"
7987

8088
motd_ssh
8189
customize
8290

8391
msg_info "Cleaning up"
92+
rm -rf /opt/v${RELEASE}.zip
8493
$STD apt-get -y autoremove
8594
$STD apt-get -y autoclean
8695
msg_ok "Cleaned"

0 commit comments

Comments
 (0)