feat!: release v2 (#6545)
Co-authored-by: Artur <145776561+arturict@users.noreply.github.com> Co-authored-by: arturict <arturict@users.noreply.github.com> Co-authored-by: Thomas <thomas@ajnart.fr> Co-authored-by: Afonso Jorge Ramos <afonsojorgeramos@gmail.com> Co-authored-by: Danura30082 <danura30082+github@gmail.com> Co-authored-by: Kushie <122986913+kushiemoon-dev@users.noreply.github.com> Co-authored-by: ajnart <thomas@ajnart.fr> Co-authored-by: ajnart <thomas@ajnart.dev> Co-authored-by: chenjun <chenjun@foxmail.com> Co-authored-by: Wikibear <wikibear@users.noreply.github.com> Co-authored-by: Bergasha <bergasha@gmail.com> Co-authored-by: leafyelin <43306196+leafyelin@users.noreply.github.com> Co-authored-by: Lucas Araujo <lucas.lra@gmail.com> Co-authored-by: GreenMonito <86085570+GreenMonito@users.noreply.github.com> Co-authored-by: Nerdy-Technician <roffo@nerdy-technician.social> Co-authored-by: Jun <34545896+jcstrong@users.noreply.github.com> Co-authored-by: Edmond Abraham <54119952+gitedmond@users.noreply.github.com> Co-authored-by: thrawnx <tight.bulb9384@fastmail.com> Co-authored-by: Chris <58918656+nordada@users.noreply.github.com> Co-authored-by: yi111 <153097222+Yi-111-a@users.noreply.github.com> Co-authored-by: Yanis <naamaneyanis@gmail.com> Co-authored-by: Wikibear <me@sej.de> Co-authored-by: alessiottavo <93441886+alessiottavo@users.noreply.github.com>
This commit is contained in:
3286 files changed
+284386
-139176
No files matched your search
+47
-21
@@ -1,5 +1,45 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
MIGRATION_PID=""
|
||||
NEXTJS_PID=""
|
||||
NGINX_PID=""
|
||||
REDIS_PID=""
|
||||
SHUTTING_DOWN=false
|
||||
|
||||
stop_process() {
|
||||
if [ -n "$1" ]; then
|
||||
kill -TERM "$1" 2>/dev/null
|
||||
wait "$1" 2>/dev/null
|
||||
fi
|
||||
}
|
||||
|
||||
terminate() {
|
||||
trap '' TERM INT
|
||||
SHUTTING_DOWN=true
|
||||
echo "Shutting down..."
|
||||
stop_process "$MIGRATION_PID"
|
||||
stop_process "$NEXTJS_PID"
|
||||
stop_process "$NGINX_PID"
|
||||
stop_process "$REDIS_PID"
|
||||
echo "Shutdown complete."
|
||||
exit 0
|
||||
}
|
||||
|
||||
# Install before migrations: a foreground child defers the shell's signal trap.
|
||||
trap terminate TERM INT
|
||||
|
||||
# Check before creating SQLite files or invoking a removed migration bundle.
|
||||
reject_mysql() {
|
||||
echo "ERROR: MySQL is no longer supported in v2. Use the MySQL-to-SQLite converter before starting Homarr."
|
||||
exit 1
|
||||
}
|
||||
case "$DB_DIALECT:$DB_DRIVER" in
|
||||
mysql:*|mariadb:*|*:mysql2|*:mysql|*:mariadb) reject_mysql ;;
|
||||
esac
|
||||
case "$DB_URL" in
|
||||
[mM][yY][sS][qQ][lL]:*|[mM][aA][rR][iI][aA][dD][bB]:*) reject_mysql ;;
|
||||
esac
|
||||
|
||||
# Create sub directories in volume
|
||||
mkdir -p /appdata/db
|
||||
mkdir -p /appdata/redis
|
||||
@@ -10,8 +50,12 @@ if [ "$DB_MIGRATIONS_DISABLED" = "true" ]; then
|
||||
echo "DB migrations are disabled, skipping"
|
||||
else
|
||||
echo "Running DB migrations"
|
||||
DISABLE_REDIS_LOGS=true node ./db/migrations/$DB_DIALECT/migrate.cjs ./db/migrations/$DB_DIALECT
|
||||
if [ $? -ne 0 ]; then
|
||||
DISABLE_REDIS_LOGS=true node ./db/migrations/$DB_DIALECT/migrate.cjs ./db/migrations/$DB_DIALECT &
|
||||
MIGRATION_PID=$!
|
||||
wait "$MIGRATION_PID"
|
||||
MIGRATION_EXIT_CODE=$?
|
||||
MIGRATION_PID=""
|
||||
if [ "$MIGRATION_EXIT_CODE" -ne 0 ]; then
|
||||
echo "ERROR: DB migrations failed, aborting startup"
|
||||
exit 1
|
||||
fi
|
||||
@@ -46,28 +90,10 @@ else
|
||||
REDIS_PID=$!
|
||||
fi
|
||||
|
||||
SHUTTING_DOWN=false
|
||||
|
||||
terminate() {
|
||||
SHUTTING_DOWN=true
|
||||
echo "Shutting down..."
|
||||
kill -TERM $NEXTJS_PID 2>/dev/null
|
||||
wait $NEXTJS_PID 2>/dev/null
|
||||
kill -TERM $NGINX_PID 2>/dev/null
|
||||
wait $NGINX_PID 2>/dev/null
|
||||
if [ -n "$REDIS_PID" ]; then
|
||||
kill -TERM $REDIS_PID 2>/dev/null
|
||||
wait $REDIS_PID 2>/dev/null
|
||||
fi
|
||||
echo "Shutdown complete."
|
||||
exit 0
|
||||
}
|
||||
|
||||
trap terminate TERM INT
|
||||
|
||||
# Next.js standalone uses HOSTNAME as its bind address. Docker's generated
|
||||
# hostname can be unresolvable, so bind explicitly while nginx uses loopback.
|
||||
export HOSTNAME=0.0.0.0
|
||||
export NODE_OPTIONS="--max-semi-space-size=4 ${NODE_OPTIONS:-}"
|
||||
node apps/nextjs/server.js &
|
||||
NEXTJS_PID=$!
|
||||
|
||||
|
||||
Reference in new issue
Block a user