diff --git a/bitnami/appsmith/1/debian-11/Dockerfile b/bitnami/appsmith/1/debian-11/Dockerfile index 66042aac4090..cfb54c5f5f48 100644 --- a/bitnami/appsmith/1/debian-11/Dockerfile +++ b/bitnami/appsmith/1/debian-11/Dockerfile @@ -3,10 +3,10 @@ FROM docker.io/bitnami/minideb:bullseye ARG TARGETARCH LABEL org.opencontainers.image.base.name="docker.io/bitnami/minideb:bullseye" \ - org.opencontainers.image.created="2023-03-21T21:39:45Z" \ + org.opencontainers.image.created="2023-03-24T23:37:52Z" \ org.opencontainers.image.description="Application packaged by VMware, Inc" \ org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.ref.name="1.9.12-debian-11-r2" \ + org.opencontainers.image.ref.name="1.9.12-debian-11-r3" \ org.opencontainers.image.title="appsmith" \ org.opencontainers.image.vendor="VMware, Inc." \ org.opencontainers.image.version="1.9.12" diff --git a/bitnami/appsmith/1/debian-11/prebuildfs/opt/bitnami/scripts/libservice.sh b/bitnami/appsmith/1/debian-11/prebuildfs/opt/bitnami/scripts/libservice.sh index 2d4b7af6fd3a..6fcb304d34cc 100644 --- a/bitnami/appsmith/1/debian-11/prebuildfs/opt/bitnami/scripts/libservice.sh +++ b/bitnami/appsmith/1/debian-11/prebuildfs/opt/bitnami/scripts/libservice.sh @@ -395,7 +395,7 @@ PartOf=bitnami.service Type=${type} EOF if [[ -n "$working_directory" ]]; then - cat >> "$service_file" <<< "WorkingDirectory=$working_directory" + cat >> "$service_file" <<< "WorkingDirectory=${working_directory}" fi if [[ -n "$exec_start_pre" ]]; then # This variable may contain multiple ExecStartPre= directives diff --git a/bitnami/appsmith/1/debian-11/prebuildfs/opt/bitnami/scripts/libwebserver.sh b/bitnami/appsmith/1/debian-11/prebuildfs/opt/bitnami/scripts/libwebserver.sh index 818c2158032b..5860791219cf 100644 --- a/bitnami/appsmith/1/debian-11/prebuildfs/opt/bitnami/scripts/libwebserver.sh +++ b/bitnami/appsmith/1/debian-11/prebuildfs/opt/bitnami/scripts/libwebserver.sh @@ -112,7 +112,11 @@ is_web_server_running() { ######################### web_server_start() { info "Starting $(web_server_type) in background" - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/start.sh" + if [[ "$BITNAMI_SERVICE_MANAGER" = "monit" ]]; then + "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/start.sh" + elif [[ "$BITNAMI_SERVICE_MANAGER" = "systemd" ]]; then + systemctl start "bitnami.$(web_server_type).service" + fi } ######################## @@ -126,7 +130,11 @@ web_server_start() { ######################### web_server_stop() { info "Stopping $(web_server_type)" - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/stop.sh" + if [[ "$BITNAMI_SERVICE_MANAGER" = "monit" ]]; then + "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/stop.sh" + elif [[ "$BITNAMI_SERVICE_MANAGER" = "systemd" ]]; then + systemctl stop "bitnami.$(web_server_type).service" + fi } ######################## @@ -140,7 +148,11 @@ web_server_stop() { ######################### web_server_restart() { info "Restarting $(web_server_type)" - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/restart.sh" + if [[ "$BITNAMI_SERVICE_MANAGER" = "monit" ]]; then + "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/restart.sh" + elif [[ "$BITNAMI_SERVICE_MANAGER" = "systemd" ]]; then + systemctl restart "bitnami.$(web_server_type).service" + fi } ######################## @@ -153,7 +165,11 @@ web_server_restart() { # None ######################### web_server_reload() { - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/reload.sh" + if [[ "$BITNAMI_SERVICE_MANAGER" = "monit" ]]; then + "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/reload.sh" + elif [[ "$BITNAMI_SERVICE_MANAGER" = "systemd" ]]; then + systemctl reload "bitnami.$(web_server_type).service" + fi } ######################## diff --git a/bitnami/appsmith/1/debian-11/rootfs/opt/bitnami/scripts/appsmith/run.sh b/bitnami/appsmith/1/debian-11/rootfs/opt/bitnami/scripts/appsmith/run.sh index f029dfe6a0ad..2568379bdef9 100755 --- a/bitnami/appsmith/1/debian-11/rootfs/opt/bitnami/scripts/appsmith/run.sh +++ b/bitnami/appsmith/1/debian-11/rootfs/opt/bitnami/scripts/appsmith/run.sh @@ -18,11 +18,13 @@ set -o pipefail # We need to load in the environment the Appsmith configuration file in order # for the application to work. Using a similar approach as the upstream container -# https://github.com/appsmithorg/appsmith/blob/release/deploy/docker/entrypoint.sh#L57-L62 +# https://github.com/appsmithorg/appsmith/blob/v1.9.12/deploy/docker/entrypoint.sh#L58-L63 set -a -eval "$(grep -v "=$" "$APPSMITH_CONF_FILE")" +. "$APPSMITH_CONF_FILE" set +a +appsmith_unset_unused_variables + declare -a cmd=() declare -a args=() diff --git a/bitnami/appsmith/1/debian-11/rootfs/opt/bitnami/scripts/libappsmith.sh b/bitnami/appsmith/1/debian-11/rootfs/opt/bitnami/scripts/libappsmith.sh index 098cd38658df..42dc965cb717 100644 --- a/bitnami/appsmith/1/debian-11/rootfs/opt/bitnami/scripts/libappsmith.sh +++ b/bitnami/appsmith/1/debian-11/rootfs/opt/bitnami/scripts/libappsmith.sh @@ -387,16 +387,20 @@ appsmith_initialize() { appsmith_backend_start_bg() { local -r log_file="${1:-"${APPSMITH_LOG_FILE}"}" info "Starting Appsmith backend in background" + + is_appsmith_backend_running && return + # We need to load in the environment the Appsmith configuration file in order # for the application to work. Using a similar approach as the upstream container. # We also need to load only those environment variables that are not empty, otherwise # the Appsmith daemon crashes on startup because of not allowed empty values. - # https://github.com/appsmithorg/appsmith/blob/release/deploy/docker/entrypoint.sh#L57-L62 + # https://github.com/appsmithorg/appsmith/blob/v1.9.12/deploy/docker/entrypoint.sh#L58-L63 set -a - eval "$(grep -v "=$" "$APPSMITH_CONF_FILE")" + . "$APPSMITH_CONF_FILE" set +a - is_appsmith_backend_running && return + appsmith_unset_unused_variables + cd "${APPSMITH_BASE_DIR}/backend" || exit 1 local -r cmd=("java") local -r args=("-Dserver.port=${APPSMITH_API_PORT}" "-Dappsmith.admin.envfile=${APPSMITH_CONF_FILE}" "-Djava.security.egd=file:/dev/./urandom" "-jar" "${APPSMITH_BASE_DIR}/backend/server.jar") @@ -415,3 +419,38 @@ appsmith_backend_start_bg() { fi info "Appsmith started successfully" } + +######################## +# Unset environment variables that may cause Appsmith to crash during initialization +# https://github.com/appsmithorg/appsmith/blob/v1.9.12/deploy/docker/entrypoint.sh#L83-L109 +# Arguments: +# None +# Returns: +# None +######################### +appsmith_unset_unused_variables() { + info "Unsetting unused environment variables" + if [[ -z "${APPSMITH_MAIL_ENABLED}" ]]; then + unset APPSMITH_MAIL_ENABLED + fi + + if [[ -z "${APPSMITH_OAUTH2_GITHUB_CLIENT_ID}" ]] || [[ -z "${APPSMITH_OAUTH2_GITHUB_CLIENT_SECRET}" ]]; then + unset APPSMITH_OAUTH2_GITHUB_CLIENT_ID + unset APPSMITH_OAUTH2_GITHUB_CLIENT_SECRET + fi + + if [[ -z "${APPSMITH_OAUTH2_GOOGLE_CLIENT_ID}" ]] || [[ -z "${APPSMITH_OAUTH2_GOOGLE_CLIENT_SECRET}" ]]; then + unset APPSMITH_OAUTH2_GOOGLE_CLIENT_ID + unset APPSMITH_OAUTH2_GOOGLE_CLIENT_SECRET + fi + + if [[ -z "${APPSMITH_GOOGLE_MAPS_API_KEY}" ]]; then + unset APPSMITH_GOOGLE_MAPS_API_KEY + fi + + if [[ -z "${APPSMITH_RECAPTCHA_SITE_KEY}" ]] || [[ -z "${APPSMITH_RECAPTCHA_SECRET_KEY}" ]] || [[ -z "${APPSMITH_RECAPTCHA_ENABLED}" ]]; then + unset APPSMITH_RECAPTCHA_SITE_KEY + unset APPSMITH_RECAPTCHA_SECRET_KEY + unset APPSMITH_RECAPTCHA_ENABLED + fi +}