From 4aabbefcc8d1ea69ab7091904017f3d7470799cf Mon Sep 17 00:00:00 2001 From: Tobias <96661824+CrazyWolf13@users.noreply.github.com> Date: Mon, 24 Feb 2025 08:23:54 +0100 Subject: [PATCH] fix: homarr db migration (#2575) * Update homarr.sh * Update homarr-install.sh --- ct/homarr.sh | 22 ++++++++++++++++++++++ install/homarr-install.sh | 3 +++ 2 files changed, 25 insertions(+) diff --git a/ct/homarr.sh b/ct/homarr.sh index 4dbb9654..f459717c 100644 --- a/ct/homarr.sh +++ b/ct/homarr.sh @@ -43,6 +43,9 @@ if [[ ! -f /opt/run_homarr.sh ]]; then sed -i '/^DB_DIALECT=/d' /opt/homarr/.env && echo "DB_DIALECT='sqlite'" >> /opt/homarr/.env cat <<'EOF' >/opt/run_homarr.sh #!/bin/bash +set -a +source /opt/homarr/.env +set +a export DB_DIALECT='sqlite' export AUTH_SECRET=$(openssl rand -base64 32) node /opt/homarr_db/migrations/$DB_DIALECT/migrate.cjs /opt/homarr_db/migrations/$DB_DIALECT @@ -85,6 +88,25 @@ fi msg_ok "Backup Data" msg_info "Updating and rebuilding ${APP} to v${RELEASE} (Patience)" + rm /opt/run_homarr.sh + cat <<'EOF' >/opt/run_homarr.sh +#!/bin/bash +set -a +source /opt/homarr/.env +set +a +export DB_DIALECT='sqlite' +export AUTH_SECRET=$(openssl rand -base64 32) +node /opt/homarr_db/migrations/$DB_DIALECT/migrate.cjs /opt/homarr_db/migrations/$DB_DIALECT +export HOSTNAME=$(ip route get 1.1.1.1 | grep -oP 'src \K[^ ]+') +envsubst '${HOSTNAME}' < /etc/nginx/templates/nginx.conf > /etc/nginx/nginx.conf +nginx -g 'daemon off;' & +redis-server /opt/homarr/packages/redis/redis.conf & +node apps/tasks/tasks.cjs & +node apps/websocket/wssServer.cjs & +node apps/nextjs/server.js & PID=$! +wait $PID +EOF + chmod +x /opt/run_homarr.sh wget -q "https://github.com/homarr-labs/homarr/archive/refs/tags/v${RELEASE}.zip" unzip -q v${RELEASE}.zip rm -rf v${RELEASE}.zip diff --git a/install/homarr-install.sh b/install/homarr-install.sh index bb2aaae7..d7f49bfa 100644 --- a/install/homarr-install.sh +++ b/install/homarr-install.sh @@ -86,6 +86,9 @@ msg_ok "Finished copying" msg_info "Creating Services" cat <<'EOF' >/opt/run_homarr.sh #!/bin/bash +set -a +source /opt/homarr/.env +set +a export DB_DIALECT='sqlite' export AUTH_SECRET=$(openssl rand -base64 32) node /opt/homarr_db/migrations/$DB_DIALECT/migrate.cjs /opt/homarr_db/migrations/$DB_DIALECT