Skip to content
Open
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
24 changes: 19 additions & 5 deletions Docker/frappe/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,23 @@
#!/bin/bash

source /scripts/helper-function.sh

# Activate NVM to make node available in PATH
if [[ -d "$NVM_DIR" ]]; then
# Check if NODE_VERSIONS is set
if [[ -z "${NODE_VERSIONS:-}" ]]; then
echo "[ERROR] NODE_VERSIONS environment variable is not set" >&2
exit 1
fi
export NODE_VERSION="${NODE_VERSIONS%% *}"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
fi

# Activate pyenv to make python available in PATH
if [[ -d "$PYENV_ROOT" ]]; then
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init --path)"
fi

cleanup() {
echo "Received signal SIGTERM, stopping..."
if [ -n "$running_script_pid" ]; then
Expand All @@ -21,20 +37,19 @@ fi
[[ "${SERVICE_NAME:-}" ]] || emer "[ERROR] Please provide SERVICE_NAME environment variable."

echo "Setting up user"

update_uid_gid "${USERID}" "${USERGROUP}" "frappe" "frappe"

SOCK_DIR='/fm-sockets'
SOCK_SERVICE_PATH="$SOCK_DIR/$SERVICE_NAME.sock"

echo "Setting supervisord sock directory to $SOCK_SERVICE_PATH"

mkdir -p $SOCK_DIR

chown "$USERID:$USERGROUP" $SOCK_DIR /opt/user /opt/user/conf.d

rm -rf "$SOCK_SERVICE_PATH"

sed -i "s/\opt\/user\/supervisor\.sock/fm-sockets\/${SERVICE_NAME}\.sock/g" /opt/user/supervisord.conf

echo "supervisord configured $?"

if [ "$#" -gt 0 ]; then
Expand All @@ -46,5 +61,4 @@ else
fi

configure_workspace

wait $running_script_pid