Skip to content

Commit 4aabbef

Browse files
authored
fix: homarr db migration (#2575)
* Update homarr.sh * Update homarr-install.sh
1 parent 6daeb7e commit 4aabbef

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

ct/homarr.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ if [[ ! -f /opt/run_homarr.sh ]]; then
4343
sed -i '/^DB_DIALECT=/d' /opt/homarr/.env && echo "DB_DIALECT='sqlite'" >> /opt/homarr/.env
4444
cat <<'EOF' >/opt/run_homarr.sh
4545
#!/bin/bash
46+
set -a
47+
source /opt/homarr/.env
48+
set +a
4649
export DB_DIALECT='sqlite'
4750
export AUTH_SECRET=$(openssl rand -base64 32)
4851
node /opt/homarr_db/migrations/$DB_DIALECT/migrate.cjs /opt/homarr_db/migrations/$DB_DIALECT
@@ -85,6 +88,25 @@ fi
8588
msg_ok "Backup Data"
8689

8790
msg_info "Updating and rebuilding ${APP} to v${RELEASE} (Patience)"
91+
rm /opt/run_homarr.sh
92+
cat <<'EOF' >/opt/run_homarr.sh
93+
#!/bin/bash
94+
set -a
95+
source /opt/homarr/.env
96+
set +a
97+
export DB_DIALECT='sqlite'
98+
export AUTH_SECRET=$(openssl rand -base64 32)
99+
node /opt/homarr_db/migrations/$DB_DIALECT/migrate.cjs /opt/homarr_db/migrations/$DB_DIALECT
100+
export HOSTNAME=$(ip route get 1.1.1.1 | grep -oP 'src \K[^ ]+')
101+
envsubst '${HOSTNAME}' < /etc/nginx/templates/nginx.conf > /etc/nginx/nginx.conf
102+
nginx -g 'daemon off;' &
103+
redis-server /opt/homarr/packages/redis/redis.conf &
104+
node apps/tasks/tasks.cjs &
105+
node apps/websocket/wssServer.cjs &
106+
node apps/nextjs/server.js & PID=$!
107+
wait $PID
108+
EOF
109+
chmod +x /opt/run_homarr.sh
88110
wget -q "https://github.com/homarr-labs/homarr/archive/refs/tags/v${RELEASE}.zip"
89111
unzip -q v${RELEASE}.zip
90112
rm -rf v${RELEASE}.zip

install/homarr-install.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ msg_ok "Finished copying"
8686
msg_info "Creating Services"
8787
cat <<'EOF' >/opt/run_homarr.sh
8888
#!/bin/bash
89+
set -a
90+
source /opt/homarr/.env
91+
set +a
8992
export DB_DIALECT='sqlite'
9093
export AUTH_SECRET=$(openssl rand -base64 32)
9194
node /opt/homarr_db/migrations/$DB_DIALECT/migrate.cjs /opt/homarr_db/migrations/$DB_DIALECT

0 commit comments

Comments
 (0)