Files
ProxmoxVE/install/homarr-install.sh
T

90 lines
2.5 KiB
Bash
Raw Normal View History

2023-08-16 08:56:17 -04:00
#!/usr/bin/env bash
# Copyright (c) 2021-2026 community-scripts ORG
2025-12-14 23:56:45 +01:00
# Author: MickLesk (CanbiZ) | Co-Author: CrazyWolf13
2025-01-28 16:50:30 +01:00
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
2025-02-14 12:09:35 +01:00
# Source: https://github.com/homarr-labs/homarr
2023-08-16 08:56:17 -04:00
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
2023-08-16 08:56:17 -04:00
color
verb_ip6
catch_errors
setting_up_container
network_check
update_os
msg_info "Installing Dependencies"
$STD apt install -y \
2025-01-28 16:32:44 +01:00
redis-server \
2025-02-14 12:09:35 +01:00
nginx \
gettext \
2025-12-19 22:43:40 +01:00
openssl
2023-08-16 08:56:17 -04:00
msg_ok "Installed Dependencies"
NODE_VERSION=$(curl -s https://raw.githubusercontent.com/homarr-labs/homarr/dev/package.json | jq -r '.engines.node | split(">=")[1] | split(".")[0]')
setup_nodejs
fetch_and_deploy_gh_release "homarr" "homarr-labs/homarr" "prebuild" "latest" "/opt/homarr" "build-debian-$(arch_resolve).tar.gz"
2023-08-16 08:56:17 -04:00
2025-12-14 23:56:45 +01:00
msg_info "Installing Homarr"
2025-01-28 16:32:44 +01:00
mkdir -p /opt/homarr_db
touch /opt/homarr_db/db.sqlite
2025-01-28 16:59:27 +01:00
SECRET_ENCRYPTION_KEY="$(openssl rand -hex 32)"
2025-02-14 12:09:35 +01:00
cd /opt/homarr
2025-12-14 23:56:45 +01:00
cat <<EOF >/opt/homarr.env
2025-01-28 16:32:44 +01:00
DB_DRIVER='better-sqlite3'
2025-02-14 12:09:35 +01:00
DB_DIALECT='sqlite'
2025-01-28 16:59:27 +01:00
SECRET_ENCRYPTION_KEY='${SECRET_ENCRYPTION_KEY}'
2025-01-28 16:32:44 +01:00
DB_URL='/opt/homarr_db/db.sqlite'
TURBO_TELEMETRY_DISABLED=1
2025-02-14 12:09:35 +01:00
AUTH_PROVIDERS='credentials'
NODE_ENV='production'
2025-12-14 23:56:45 +01:00
REDIS_IS_EXTERNAL='true'
2024-04-14 23:53:22 -04:00
EOF
2025-02-14 12:09:35 +01:00
msg_ok "Installed Homarr"
2025-12-14 23:56:45 +01:00
msg_info "Copying config files"
2025-02-14 12:09:35 +01:00
mkdir -p /appdata/redis
2025-12-14 23:56:45 +01:00
chown -R redis:redis /appdata/redis
chmod 744 /appdata/redis
cp /opt/homarr/redis.conf /etc/redis/redis.conf
sed -i -e '$a\' /etc/redis/redis.conf
grep -q '^bind 127.0.0.1 -::1$' /etc/redis/redis.conf || echo "bind 127.0.0.1 -::1" >>/etc/redis/redis.conf
2026-07-01 15:36:12 +02:00
rm -f /etc/nginx/nginx.conf
2025-12-14 23:56:45 +01:00
mkdir -p /etc/nginx/templates
2025-02-14 12:09:35 +01:00
cp /opt/homarr/nginx.conf /etc/nginx/templates/nginx.conf
2026-07-05 22:28:00 +02:00
echo $'#!/bin/bash\nset -a\nsource /opt/homarr.env\nset +a\ncd /opt/homarr/apps/cli && node ./cli.cjs "$@"' >/usr/bin/homarr
2025-02-14 12:09:35 +01:00
chmod +x /usr/bin/homarr
2025-12-14 23:56:45 +01:00
msg_ok "Copied config files"
2023-08-16 08:56:17 -04:00
2025-02-14 12:09:35 +01:00
msg_info "Creating Services"
2025-12-14 23:56:45 +01:00
mkdir -p /etc/systemd/system/redis-server.service.d/
cat <<EOF >/etc/systemd/system/redis-server.service.d/override.conf
[Service]
ReadWritePaths=-/appdata/redis -/var/lib/redis -/var/log/redis -/var/run/redis -/etc/redis
2025-02-14 12:09:35 +01:00
EOF
2023-08-16 08:56:17 -04:00
cat <<EOF >/etc/systemd/system/homarr.service
[Unit]
2025-12-19 22:43:40 +01:00
Requires=redis-server.service
After=redis-server.service
2023-08-16 08:56:17 -04:00
Description=Homarr Service
After=network.target
[Service]
Type=exec
WorkingDirectory=/opt/homarr
2025-12-14 23:56:45 +01:00
EnvironmentFile=-/opt/homarr.env
ExecStart=/opt/homarr/run.sh
2023-08-16 08:56:17 -04:00
[Install]
WantedBy=multi-user.target
EOF
2025-12-14 23:56:45 +01:00
chmod +x /opt/homarr/run.sh
2025-12-19 22:43:40 +01:00
systemctl enable -q --now redis-server
2025-01-28 16:32:44 +01:00
systemctl enable -q --now homarr
systemctl disable -q --now nginx
2025-12-14 23:56:45 +01:00
msg_ok "Created Services"
2023-08-16 08:56:17 -04:00
motd_ssh
customize
cleanup_lxc