From 763aa10b177823ffb6fff5584fc1cbbb86017e4c Mon Sep 17 00:00:00 2001 From: martabal <74269598+martabal@users.noreply.github.com> Date: Mon, 19 Feb 2024 00:50:16 +0100 Subject: [PATCH 1/3] fix: bash scripts --- install.sh | 4 +-- server/start-microservices.sh | 1 + server/start-server.sh | 1 + server/start.sh | 55 ++++++++++------------------------- 4 files changed, 19 insertions(+), 42 deletions(-) diff --git a/install.sh b/install.sh index 1625fa080cc3b..fc894ce21e578 100755 --- a/install.sh +++ b/install.sh @@ -38,9 +38,9 @@ populate_upload_location() { start_docker_compose() { echo "Starting Immich's docker containers" - if docker compose > /dev/null 2>&1; then + if docker compose >/dev/null 2>&1; then docker_bin="docker compose" - elif docker-compose > /dev/null 2>&1; then + elif docker-compose >/dev/null 2>&1; then docker_bin="docker-compose" else echo "Cannot find \`docker compose\` or \`docker-compose\`." diff --git a/server/start-microservices.sh b/server/start-microservices.sh index efdafaac020d8..e1909663f0264 100755 --- a/server/start-microservices.sh +++ b/server/start-microservices.sh @@ -1,2 +1,3 @@ #!/usr/bin/env sh + ./start.sh microservices diff --git a/server/start-server.sh b/server/start-server.sh index acbbb82b99ca4..bdffd72a02a9c 100755 --- a/server/start-server.sh +++ b/server/start-server.sh @@ -1,2 +1,3 @@ #!/usr/bin/env sh + ./start.sh immich diff --git a/server/start.sh b/server/start.sh index 268989dda03b2..9dba2e2922083 100755 --- a/server/start.sh +++ b/server/start.sh @@ -1,42 +1,17 @@ -#!/usr/bin/env sh - -lib_path="/usr/lib/$(arch)-linux-gnu/libmimalloc.so.2" -export LD_PRELOAD="$lib_path" - -if [ "$DB_URL_FILE" ]; then - DB_URL_CONTENT=$(cat "$DB_URL_FILE") - export DB_URL="$DB_URL_CONTENT" - unset DB_URL_FILE -fi - -if [ "$DB_HOSTNAME_FILE" ]; then - DB_HOSTNAME_CONTENT=$(cat "$DB_HOSTNAME_FILE") - export DB_HOSTNAME="$DB_HOSTNAME_CONTENT" - unset DB_HOSTNAME_FILE -fi - -if [ "$DB_DATABASE_NAME_FILE" ]; then - DB_DATABASE_CONTENT=$(cat "$DB_DATABASE_NAME_FILE") - export DB_DATABASE_NAME="$DB_DATABASE_CONTENT" - unset DB_DATABASE_NAME_FILE -fi - -if [ "$DB_USERNAME_FILE" ]; then - DB_USERNAME_CONTENT=$(cat "$DB_USERNAME_FILE") - export DB_USERNAME="$DB_USERNAME_CONTENT" - unset DB_USERNAME_FILE -fi - -if [ "$DB_PASSWORD_FILE" ]; then - DB_PASSWORD_CONTENT=$(cat "$DB_PASSWORD_FILE") - export DB_PASSWORD="$DB_PASSWORD_CONTENT" - unset DB_PASSWORD_FILE -fi - -if [ "$REDIS_PASSWORD_FILE" ]; then - REDIS_PASSWORD_CONTENT=$(cat "$REDIS_PASSWORD_FILE") - export DB_PASSWORD="$REDIS_PASSWORD_CONTENT" - unset REDIS_PASSWORD_FILE -fi +#!/usr/bin/env bash + +read_file_and_export() { + if [ -n "${!1}" ]; then + content="$(cat "${!1}")" + export "$2"="${content}" + unset "$1" + fi +} +read_file_and_export "DB_URL_FILE" "DB_URL" +read_file_and_export "DB_HOSTNAME_FILE" "DB_HOSTNAME" +read_file_and_export "DB_DATABASE_NAME_FILE" "DB_DATABASE_NAME" +read_file_and_export "DB_USERNAME_FILE" "DB_USERNAME" +read_file_and_export "DB_PASSWORD_FILE" "DB_PASSWORD" +read_file_and_export "REDIS_PASSWORD_FILE" "REDIS_PASSWORD" exec node /usr/src/app/dist/main "$@" From 37e522d4570063b07466284f8a175eeb1bf945ba Mon Sep 17 00:00:00 2001 From: martabal <74269598+martabal@users.noreply.github.com> Date: Mon, 19 Feb 2024 01:07:29 +0100 Subject: [PATCH 2/3] fix: use bash --- server/start-microservices.sh | 2 +- server/start-server.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/server/start-microservices.sh b/server/start-microservices.sh index e1909663f0264..c9e2cb42fba51 100755 --- a/server/start-microservices.sh +++ b/server/start-microservices.sh @@ -1,3 +1,3 @@ -#!/usr/bin/env sh +#!/usr/bin/env bash ./start.sh microservices diff --git a/server/start-server.sh b/server/start-server.sh index bdffd72a02a9c..7ef959f63cdcd 100755 --- a/server/start-server.sh +++ b/server/start-server.sh @@ -1,3 +1,3 @@ -#!/usr/bin/env sh +#!/usr/bin/env bash ./start.sh immich From 11f0c3e0c0477176d10c003ae2a04142894ab196 Mon Sep 17 00:00:00 2001 From: martabal <74269598+martabal@users.noreply.github.com> Date: Mon, 19 Feb 2024 01:25:48 +0100 Subject: [PATCH 3/3] fix: e2e --- server/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/Dockerfile b/server/Dockerfile index eb62b8812a4d5..1331ea6d48d80 100644 --- a/server/Dockerfile +++ b/server/Dockerfile @@ -59,4 +59,4 @@ COPY LICENSE /LICENSE ENV PATH="${PATH}:/usr/src/app/bin" VOLUME /usr/src/app/upload EXPOSE 3001 -ENTRYPOINT ["tini", "--", "/bin/sh"] +ENTRYPOINT ["tini", "--", "/bin/bash"]