Skip to content

Commit

Permalink
Inception - allow to pass environment variables for the metadata data…
Browse files Browse the repository at this point in the history
…base behind Inception + do not overwrite settings.properties if it exists
  • Loading branch information
jwijffels committed Nov 30, 2024
1 parent 6da86cb commit ff45601
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 7 deletions.
8 changes: 8 additions & 0 deletions inception/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ ARG INCEPTION_PASSWORD="provide-supersecret-key"
ENV INCEPTION_HOST=${INCEPTION_HOST}
ENV INCEPTION_USERNAME=${INCEPTION_USERNAME}
ENV INCEPTION_PASSWORD=${INCEPTION_PASSWORD}
## Settings for the metadata database behind Inception
ENV INCEPTION_DB_URL=
ENV INCEPTION_DB_USERNAME=
ENV INCEPTION_DB_PASSWORD=
ENV INCEPTION_DB_DIALECT=
ENV INCEPTION_DB_DRIVER=

##
## Combine Minio + Inception with supervisord
Expand All @@ -52,7 +58,9 @@ RUN set -ex \
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY start_minio.sh /usr/bin/start_minio.sh
COPY start_inception.sh /usr/bin/start_inception.sh
COPY start_mariadb.sh /usr/bin/start_mariadb.sh
RUN chmod +x /usr/bin/start_minio.sh
RUN chmod +x /usr/bin/start_inception.sh
RUN chmod +x /usr/bin/start_mariadb.sh

CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
19 changes: 15 additions & 4 deletions inception/start_inception.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
#! /bin/bash

###############################################################################################
## Defining the Inception properties
## - encrypt the admin password
## - define all the other inception properties
##
echo "------- Encrypting Inception admin password ------"
#env
export INCEPTION_PASSWORD=$(htpasswd -bnBC 10 "" $INCEPTION_PASSWORD | tr -d ':\n')

echo "------- Defining inception properties ------"
if [ ! -f /export/settings.properties ]; then
echo "------- Defining inception properties file ------"
cat <<EOF >/export/settings.properties
##
## Login settings
Expand Down Expand Up @@ -44,13 +49,19 @@ websocket.enabled=true
##
## Disable some warnings
##
warnings.embeddedDatabase=true
telemetry.auto-respond=REJECT
warnings.embeddedDatabase=false
EOF
sed -i 's|INCEPTION_USERNAME|'"$INCEPTION_USERNAME"'|g' /export/settings.properties
sed -i 's|INCEPTION_PASSWORD|{bcrypt}'"$INCEPTION_PASSWORD"'|g' /export/settings.properties
sed -i 's|INCEPTION_HOST|'"$INCEPTION_HOST"'|g' /export/settings.properties
else
echo "------- Existing inception properties file ------"
fi
cat /export/settings.properties

###############################################################################################
## Launch Inception
##
echo "------- Launching Inception ------"
java "-Xmx750m" -Djava.awt.headless=true -Dinception.home=/export -jar inception-app-standalone.jar
java "-Xmx750m" -Djava.awt.headless=true -Dinception.home=/export -jar /opt/inception/inception-app-standalone.jar
5 changes: 2 additions & 3 deletions inception/supervisord.conf
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,5 @@ redirect_stderr=true
autostart=true
autorestart=true
command=/usr/bin/start_inception.sh
environment=INCEPTION_USERNAME="%(ENV_INCEPTION_USERNAME)s",INCEPTION_PASSWORD="%(ENV_INCEPTION_PASSWORD)s"
#command=/opt/inception/launch.sh java "-Xmx750m" -Djava.awt.headless=true -Dinception.home=/export -jar inception-app-standalone.jar ${INCEPTION_ARGUMENTS}
#command=java "-Xmx750m" -Djava.awt.headless=true -Dinception.home=/export -jar inception-app-standalone.jar
environment=INCEPTION_USERNAME="%(ENV_INCEPTION_USERNAME)s",INCEPTION_PASSWORD="%(ENV_INCEPTION_PASSWORD)s",INCEPTION_DB_URL="%(ENV_INCEPTION_DB_URL)s",INCEPTION_DB_USERNAME="%(ENV_INCEPTION_DB_USERNAME)s",INCEPTION_DB_PASSWORD="%(ENV_INCEPTION_DB_PASSWORD)s",INCEPTION_DB_DIALECT="%(ENV_INCEPTION_DB_DIALECT)s",INCEPTION_DB_DRIVER="%(ENV_INCEPTION_DB_DRIVER)s"

0 comments on commit ff45601

Please sign in to comment.