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
88source /dev/stdin <<< " $FUNCTIONS_FILE_PATH"
99color
@@ -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
2730msg_ok " Installed Dependencies"
2831
2932msg_info " Setting up Node.js Repository"
@@ -46,27 +49,56 @@ unzip -q v${RELEASE}.zip
4649mv homarr-${RELEASE} /opt/homarr
4750mkdir -p /opt/homarr_db
4851touch /opt/homarr_db/db.sqlite
49- AUTH_SECRET=" $( openssl rand -base64 18 | tr -dc ' a-zA-Z0-9' | cut -c1-13) "
5052SECRET_ENCRYPTION_KEY=" $( openssl rand -hex 32) "
51-
53+ cd /opt/homarr
5254cat << EOF >/opt/homarr/.env
53- AUTH_SECRET='${AUTH_SECRET} '
5455DB_DRIVER='better-sqlite3'
56+ DB_DIALECT='sqlite'
5557SECRET_ENCRYPTION_KEY='${SECRET_ENCRYPTION_KEY} '
5658DB_URL='/opt/homarr_db/db.sqlite'
5759TURBO_TELEMETRY_DISABLED=1
60+ AUTH_PROVIDERS='credentials'
61+ NODE_ENV='production'
5862EOF
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\n cd /opt/homarr/apps/cli && node ./cli.cjs "$@"' > /usr/bin/homarr
80+ chmod +x /usr/bin/homarr
81+ mkdir /opt/homarr/build
6582cp ./node_modules/better-sqlite3/build/Release/better_sqlite3.node ./build/better_sqlite3.node
6683echo " ${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
70102cat << EOF >/etc/systemd/system/homarr.service
71103[Unit]
72104Description=Homarr Service
@@ -76,7 +108,7 @@ After=network.target
76108Type=exec
77109WorkingDirectory=/opt/homarr
78110EnvironmentFile=-/opt/homarr/.env
79- ExecStart=/usr/bin/pnpm start
111+ ExecStart=/opt/run_homarr.sh
80112
81113[Install]
82114WantedBy=multi-user.target
0 commit comments