mirror of
https://github.com/community-scripts/ProxmoxVE
synced 2025-02-04 23:10:16 +00:00
Breaking Change: Homarr (#1825)
This commit is contained in:
parent
b973ca9d8d
commit
dae705056c
38
ct/homarr.sh
38
ct/homarr.sh
@ -32,46 +32,46 @@ function update_script() {
|
|||||||
msg_error "No ${APP} Installation Found!"
|
msg_error "No ${APP} Installation Found!"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
RELEASE=$(curl -s https://api.github.com/repos/ajnart/homarr/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
|
if [[ -f /opt/homarr/database/db.sqlite ]]; then
|
||||||
|
msg_error "Old Homarr detected due to existing database file (/opt/homarr/database/db.sqlite)."
|
||||||
|
msg_error "Update not supported. Refer to:"
|
||||||
|
msg_error " - https://github.com/community-scripts/ProxmoxVE/discussions/1551"
|
||||||
|
msg_error " - https://homarr.dev/docs/getting-started/after-the-installation/#importing-a-zip-from-version-before-100"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
RELEASE=$(curl -s https://api.github.com/repos/homarr-labs/homarr/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
|
||||||
if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
|
if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
|
||||||
|
|
||||||
msg_info "Stopping Services"
|
msg_info "Stopping Services"
|
||||||
systemctl stop homarr
|
systemctl stop homarr
|
||||||
msg_ok "Services Stopped"
|
msg_ok "Services Stopped"
|
||||||
|
|
||||||
msg_info "Backing up Data"
|
msg_info "Backup Data"
|
||||||
mkdir -p /opt/homarr-data-backup
|
mkdir -p /opt/homarr-data-backup
|
||||||
cp /opt/homarr/.env /opt/homarr-data-backup/.env
|
cp /opt/homarr/.env /opt/homarr-data-backup/.env
|
||||||
cp /opt/homarr/database/db.sqlite /opt/homarr-data-backup/db.sqlite
|
msg_ok "Backup Data"
|
||||||
cp -r /opt/homarr/data/configs /opt/homarr-data-backup/configs
|
|
||||||
msg_ok "Backed up Data"
|
|
||||||
|
|
||||||
msg_info "Updating ${APP} to ${RELEASE}"
|
msg_info "Updating ${APP} to v${RELEASE}"
|
||||||
wget -q "https://github.com/ajnart/homarr/archive/refs/tags/v${RELEASE}.zip"
|
wget -q "https://github.com/homarr-labs/homarr/archive/refs/tags/v${RELEASE}.zip"
|
||||||
unzip -q v${RELEASE}.zip
|
unzip -q v${RELEASE}.zip
|
||||||
rm -rf v${RELEASE}.zip
|
rm -rf v${RELEASE}.zip
|
||||||
rm -rf /opt/homarr
|
rm -rf /opt/homarr
|
||||||
mv homarr-${RELEASE} /opt/homarr
|
mv homarr-${RELEASE} /opt/homarr
|
||||||
mv /opt/homarr-data-backup/.env /opt/homarr/.env
|
mv /opt/homarr-data-backup/.env /opt/homarr/.env
|
||||||
cd /opt/homarr
|
cd /opt/homarr
|
||||||
yarn install &>/dev/null
|
pnpm run db:migration:sqlite:run &>/dev/null
|
||||||
yarn build &>/dev/null
|
pnpm build &>/dev/null
|
||||||
|
mkdir build
|
||||||
|
cp ./node_modules/better-sqlite3/build/Release/better_sqlite3.node ./build/better_sqlite3.node
|
||||||
echo "${RELEASE}" >/opt/${APP}_version.txt
|
echo "${RELEASE}" >/opt/${APP}_version.txt
|
||||||
msg_ok "Updated ${APP}"
|
msg_ok "Updated ${APP}"
|
||||||
|
|
||||||
msg_info "Restoring Data"
|
|
||||||
rm -rf /opt/homarr/data/configs
|
|
||||||
mv /opt/homarr-data-backup/configs /opt/homarr/data/configs
|
|
||||||
mv /opt/homarr-data-backup/db.sqlite /opt/homarr/database/db.sqlite
|
|
||||||
yarn db:migrate &>/dev/null
|
|
||||||
rm -rf /opt/homarr-data-backup
|
|
||||||
msg_ok "Restored Data"
|
|
||||||
|
|
||||||
msg_info "Starting Services"
|
msg_info "Starting Services"
|
||||||
systemctl start homarr
|
systemctl start homarr
|
||||||
msg_ok "Started Services"
|
msg_ok "Started Services"
|
||||||
msg_ok "Updated Successfully"
|
msg_ok "Updated Successfully"
|
||||||
else
|
else
|
||||||
msg_ok "No update required. ${APP} is already at ${RELEASE}"
|
msg_ok "No update required. ${APP} is already at v${RELEASE}"
|
||||||
fi
|
fi
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
@ -83,4 +83,4 @@ description
|
|||||||
msg_ok "Completed Successfully!\n"
|
msg_ok "Completed Successfully!\n"
|
||||||
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
|
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
|
||||||
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
|
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
|
||||||
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:3000${CL}"
|
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:3000${CL}"
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# Copyright (c) 2021-2025 tteck
|
# Copyright (c) 2021-2025 community-scripts ORG
|
||||||
# Author: tteck (tteckster)
|
# Author: MickLesk (Canbiz)
|
||||||
# Co-Author: MickLesk (Canbiz)
|
|
||||||
# License: MIT
|
# License: MIT
|
||||||
# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||||
# Source: https://github.com/ajnart/homarr
|
# Source: https://github.com/ajnart/homarr
|
||||||
@ -20,6 +19,7 @@ $STD apt-get install -y \
|
|||||||
sudo \
|
sudo \
|
||||||
mc \
|
mc \
|
||||||
curl \
|
curl \
|
||||||
|
redis-server \
|
||||||
ca-certificates \
|
ca-certificates \
|
||||||
gnupg \
|
gnupg \
|
||||||
make \
|
make \
|
||||||
@ -30,32 +30,40 @@ msg_ok "Installed Dependencies"
|
|||||||
msg_info "Setting up Node.js Repository"
|
msg_info "Setting up Node.js Repository"
|
||||||
mkdir -p /etc/apt/keyrings
|
mkdir -p /etc/apt/keyrings
|
||||||
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
|
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
|
||||||
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
|
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
|
||||||
msg_ok "Set up Node.js Repository"
|
msg_ok "Set up Node.js Repository"
|
||||||
|
|
||||||
msg_info "Installing Node.js/Yarn"
|
msg_info "Installing Node.js/pnpm"
|
||||||
$STD apt-get update
|
$STD apt-get update
|
||||||
$STD apt-get install -y nodejs
|
$STD apt-get install -y nodejs
|
||||||
$STD npm install -g yarn
|
$STD npm install -g pnpm
|
||||||
msg_ok "Installed Node.js/Yarn"
|
msg_ok "Installed Node.js/pnpm"
|
||||||
|
|
||||||
msg_info "Installing Homarr (Patience)"
|
msg_info "Installing Homarr (Patience)"
|
||||||
RELEASE=$(curl -s https://api.github.com/repos/ajnart/homarr/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
|
cd /opt
|
||||||
wget -q "https://github.com/ajnart/homarr/archive/refs/tags/v${RELEASE}.zip"
|
RELEASE=$(curl -s https://api.github.com/repos/homarr-labs/homarr/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
|
||||||
|
wget -q "https://github.com/homarr-labs/homarr/archive/refs/tags/v${RELEASE}.zip"
|
||||||
unzip -q v${RELEASE}.zip
|
unzip -q v${RELEASE}.zip
|
||||||
rm -rf v${RELEASE}.zip
|
|
||||||
mv homarr-${RELEASE} /opt/homarr
|
mv homarr-${RELEASE} /opt/homarr
|
||||||
|
mkdir -p /opt/homarr_db
|
||||||
|
touch /opt/homarr_db/db.sqlite
|
||||||
|
AUTH_SECRET="$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | cut -c1-13)"
|
||||||
|
SECRET_ENCRYPTION_KEY="$(openssl rand -base64 32 | tr -dc 'a-zA-Z0-9' | cut -c1-32)"
|
||||||
|
|
||||||
cat <<EOF >/opt/homarr/.env
|
cat <<EOF >/opt/homarr/.env
|
||||||
DATABASE_URL="file:./database/db.sqlite"
|
AUTH_SECRET="${AUTH_SECRET}"
|
||||||
NEXTAUTH_URL="http://localhost:3000"
|
DB_DRIVER='better-sqlite3'
|
||||||
NEXTAUTH_SECRET="$(openssl rand -base64 32)"
|
SECRET_ENCRYPTION_KEY="${SECRET_ENCRYPTION_KEY}"
|
||||||
NEXT_PUBLIC_DISABLE_ANALYTICS="true"
|
DB_URL='/opt/homarr_db/db.sqlite'
|
||||||
DEFAULT_COLOR_SCHEME="dark"
|
TURBO_TELEMETRY_DISABLED=1
|
||||||
|
NODE_OPTIONS='-r @homarr/log/override'
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
cd /opt/homarr
|
cd /opt/homarr
|
||||||
$STD yarn install
|
$STD pnpm run db:migration:sqlite:run
|
||||||
$STD yarn build
|
$STD pnpm build
|
||||||
$STD yarn db:migrate
|
mkdir build
|
||||||
|
cp ./node_modules/better-sqlite3/build/Release/better_sqlite3.node ./build/better_sqlite3.node
|
||||||
echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt"
|
echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt"
|
||||||
msg_ok "Installed Homarr"
|
msg_ok "Installed Homarr"
|
||||||
|
|
||||||
@ -69,18 +77,19 @@ After=network.target
|
|||||||
Type=exec
|
Type=exec
|
||||||
WorkingDirectory=/opt/homarr
|
WorkingDirectory=/opt/homarr
|
||||||
EnvironmentFile=-/opt/homarr/.env
|
EnvironmentFile=-/opt/homarr/.env
|
||||||
ExecStart=/usr/bin/yarn start
|
ExecStart=/usr/bin/pnpm start
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
EOF
|
EOF
|
||||||
systemctl enable -q --now homarr.service
|
systemctl enable -q --now homarr
|
||||||
msg_ok "Created Service"
|
msg_ok "Created Service"
|
||||||
|
|
||||||
motd_ssh
|
motd_ssh
|
||||||
customize
|
customize
|
||||||
|
|
||||||
msg_info "Cleaning up"
|
msg_info "Cleaning up"
|
||||||
|
rm -rf /opt/v${RELEASE}.zip
|
||||||
$STD apt-get -y autoremove
|
$STD apt-get -y autoremove
|
||||||
$STD apt-get -y autoclean
|
$STD apt-get -y autoclean
|
||||||
msg_ok "Cleaned"
|
msg_ok "Cleaned"
|
||||||
|
Loading…
Reference in New Issue
Block a user