Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: shell scripts #7189

Merged
merged 3 commits into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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\`."
Expand Down
2 changes: 1 addition & 1 deletion server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
3 changes: 2 additions & 1 deletion server/start-microservices.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
#!/usr/bin/env sh
#!/usr/bin/env bash

./start.sh microservices
3 changes: 2 additions & 1 deletion server/start-server.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
#!/usr/bin/env sh
#!/usr/bin/env bash

./start.sh immich
55 changes: 15 additions & 40 deletions server/start.sh
Original file line number Diff line number Diff line change
@@ -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 "$@"
Loading