Skip to content

Commit 1789d18

Browse files
authored
Fix homarr (#2369)
* fix homarr script * Update homarr-install.sh * Update homarr-install.sh * Update homarr-install.sh * Update homarr-install.sh * Update homarr-install.sh * Update homarr-install.sh * Update homarr-install.sh * Update homarr-install.sh * fix nginx hostname * Update homarr-install.sh * Update homarr-install.sh * Update homarr.sh * Update homarr-install.sh * Update homarr.sh * Update install.func * Update homarr.sh * Update homarr.sh * Update homarr-install.sh * Update homarr-install.sh * Update homarr-install.sh * Update build.func * Update homarr-install.sh * Update homarr-install.sh * Update homarr-install.sh * Update homarr-install.sh * Update homarr-install.sh * Update homarr-install.sh * Update homarr.json * Update homarr-install.sh * Update homarr-install.sh * Update homarr.sh * Update homarr.sh * Update homarr.sh * Update homarr.sh * Update homarr.sh * Update homarr.sh * Update homarr.sh * Update homarr.sh * Update install.func * Update build.func * Update homarr-install.sh * fix comments
1 parent f0ca0c3 commit 1789d18

File tree

3 files changed

+66
-19
lines changed

3 files changed

+66
-19
lines changed

ct/homarr.sh

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env bash
22
source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
33
# Copyright (c) 2021-2025 tteck
4-
# Author: tteck (tteckster) | Co-Author: MickLesk (Canbiz)
4+
# Author: tteck (tteckster) | Co-Author: MickLesk (Canbiz) | Co-Author: CrazyWolf13
55
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
66
# Source: https://homarr.dev/
77

@@ -15,6 +15,7 @@ var_version="12"
1515
var_unprivileged="1"
1616

1717
header_info "$APP"
18+
1819
variables
1920
color
2021
catch_errors
@@ -37,7 +38,7 @@ fi
3738
RELEASE=$(curl -s https://api.github.com/repos/homarr-labs/homarr/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
3839
if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
3940

40-
msg_info "Stopping Services"
41+
msg_info "Stopping Services (Patience)"
4142
systemctl stop homarr
4243
msg_ok "Services Stopped"
4344

@@ -55,9 +56,23 @@ fi
5556
mv /opt/homarr-data-backup/.env /opt/homarr/.env
5657
cd /opt/homarr
5758
pnpm install &>/dev/null
58-
pnpm run db:migration:sqlite:run &>/dev/null
5959
pnpm build &>/dev/null
60-
mkdir build
60+
cp /opt/homarr/apps/nextjs/next.config.ts .
61+
cp /opt/homarr/apps/nextjs/package.json .
62+
cp -r /opt/homarr/packages/db/migrations /opt/homarr_db/migrations
63+
cp -r /opt/homarr/apps/nextjs/.next/standalone/* /opt/homarr
64+
mkdir -p /appdata/redis
65+
cp /opt/homarr/packages/redis/redis.conf /opt/homarr/redis.conf
66+
rm /etc/nginx/nginx.conf
67+
mkdir -p /etc/nginx/templates
68+
cp /opt/homarr/nginx.conf /etc/nginx/templates/nginx.conf
69+
70+
mkdir -p /opt/homarr/apps/cli
71+
cp /opt/homarr/packages/cli/cli.cjs /opt/homarr/apps/cli/cli.cjs
72+
echo $'#!/bin/bash\ncd /opt/homarr/apps/cli && node ./cli.cjs "$@"' > /usr/bin/homarr
73+
chmod +x /usr/bin/homarr
74+
75+
mkdir /opt/homarr/build
6176
cp ./node_modules/better-sqlite3/build/Release/better_sqlite3.node ./build/better_sqlite3.node
6277
echo "${RELEASE}" >/opt/${APP}_version.txt
6378
msg_ok "Updated ${APP}"
@@ -79,4 +94,4 @@ description
7994
msg_ok "Completed Successfully!\n"
8095
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
8196
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
82-
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:3000${CL}"
97+
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:7575${CL}"

install/homarr-install.sh

Lines changed: 45 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Copyright (c) 2021-2025 community-scripts ORG
44
# Author: MickLesk (Canbiz)
55
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6-
# Source: https://github.com/ajnart/homarr
6+
# Source: https://github.com/homarr-labs/homarr
77

88
source /dev/stdin <<< "$FUNCTIONS_FILE_PATH"
99
color
@@ -20,10 +20,13 @@ $STD apt-get install -y \
2020
curl \
2121
redis-server \
2222
ca-certificates \
23-
gnupg \
23+
gpg \
2424
make \
2525
g++ \
26-
build-essential
26+
build-essential \
27+
nginx \
28+
gettext \
29+
openssl
2730
msg_ok "Installed Dependencies"
2831

2932
msg_info "Setting up Node.js Repository"
@@ -46,27 +49,56 @@ unzip -q v${RELEASE}.zip
4649
mv homarr-${RELEASE} /opt/homarr
4750
mkdir -p /opt/homarr_db
4851
touch /opt/homarr_db/db.sqlite
49-
AUTH_SECRET="$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | cut -c1-13)"
5052
SECRET_ENCRYPTION_KEY="$(openssl rand -hex 32)"
51-
53+
cd /opt/homarr
5254
cat <<EOF >/opt/homarr/.env
53-
AUTH_SECRET='${AUTH_SECRET}'
5455
DB_DRIVER='better-sqlite3'
56+
DB_DIALECT='sqlite'
5557
SECRET_ENCRYPTION_KEY='${SECRET_ENCRYPTION_KEY}'
5658
DB_URL='/opt/homarr_db/db.sqlite'
5759
TURBO_TELEMETRY_DISABLED=1
60+
AUTH_PROVIDERS='credentials'
61+
NODE_ENV='production'
5862
EOF
59-
60-
cd /opt/homarr
6163
$STD pnpm install
62-
$STD pnpm run db:migration:sqlite:run
6364
$STD pnpm build
64-
mkdir build
65+
msg_ok "Installed Homarr"
66+
67+
msg_info "Copying build and config files"
68+
cp /opt/homarr/apps/nextjs/next.config.ts .
69+
cp /opt/homarr/apps/nextjs/package.json .
70+
cp -r /opt/homarr/packages/db/migrations /opt/homarr_db/migrations
71+
cp -r /opt/homarr/apps/nextjs/.next/standalone/* /opt/homarr
72+
mkdir -p /appdata/redis
73+
cp /opt/homarr/packages/redis/redis.conf /opt/homarr/redis.conf
74+
mkdir -p /etc/nginx/templates
75+
rm /etc/nginx/nginx.conf
76+
cp /opt/homarr/nginx.conf /etc/nginx/templates/nginx.conf
77+
mkdir -p /opt/homarr/apps/cli
78+
cp /opt/homarr/packages/cli/cli.cjs /opt/homarr/apps/cli/cli.cjs
79+
echo $'#!/bin/bash\ncd /opt/homarr/apps/cli && node ./cli.cjs "$@"' > /usr/bin/homarr
80+
chmod +x /usr/bin/homarr
81+
mkdir /opt/homarr/build
6582
cp ./node_modules/better-sqlite3/build/Release/better_sqlite3.node ./build/better_sqlite3.node
6683
echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt"
67-
msg_ok "Installed Homarr"
84+
msg_ok "Finished copying"
6885

69-
msg_info "Creating Service"
86+
msg_info "Creating Services"
87+
cat <<'EOF' >/opt/run_homarr.sh
88+
#!/bin/bash
89+
export DB_DIALECT='sqlite'
90+
export AUTH_SECRET=$(openssl rand -base64 32)
91+
node /opt/homarr_db/migrations/$DB_DIALECT/migrate.cjs /opt/homarr_db/migrations/$DB_DIALECT
92+
export HOSTNAME=$(ip route get 1.1.1.1 | grep -oP 'src \K[^ ]+')
93+
envsubst '${HOSTNAME}' < /etc/nginx/templates/nginx.conf > /etc/nginx/nginx.conf
94+
nginx -g 'daemon off;' &
95+
redis-server /opt/homarr/packages/redis/redis.conf &
96+
node apps/tasks/tasks.cjs &
97+
node apps/websocket/wssServer.cjs &
98+
node apps/nextjs/server.js & PID=$!
99+
wait $PID
100+
EOF
101+
chmod +x /opt/run_homarr.sh
70102
cat <<EOF >/etc/systemd/system/homarr.service
71103
[Unit]
72104
Description=Homarr Service
@@ -76,7 +108,7 @@ After=network.target
76108
Type=exec
77109
WorkingDirectory=/opt/homarr
78110
EnvironmentFile=-/opt/homarr/.env
79-
ExecStart=/usr/bin/pnpm start
111+
ExecStart=/opt/run_homarr.sh
80112
81113
[Install]
82114
WantedBy=multi-user.target

json/homarr.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"type": "ct",
99
"updateable": true,
1010
"privileged": false,
11-
"interface_port": 3000,
11+
"interface_port": 7575,
1212
"documentation": null,
1313
"website": "https://homarr.dev/",
1414
"logo": "https://raw.githubusercontent.com/loganmarchione/homelab-svg-assets/main/assets/homarr.svg",

0 commit comments

Comments
 (0)