mirror of
https://github.com/ledgersmb/ledgersmb-docker.git
synced 2025-08-20 23:57:24 -04:00
Compare commits
No commits in common. "9c4c8c696638cd51ae180b3e49dcca48d7638b0b" and "82660ad113bd817c07c7ec64aad1b9eedfacc97d" have entirely different histories.
9c4c8c6966
...
82660ad113
@ -65,10 +65,8 @@ ENV POSTGRES_PORT=5432
|
||||
ENV DEFAULT_DB=lsmb
|
||||
|
||||
COPY start.sh /usr/local/bin/start.sh
|
||||
COPY config.sh /usr/local/bin/config.sh
|
||||
COPY run.sh /usr/local/bin/run.sh
|
||||
|
||||
RUN chmod +x /usr/local/bin/start.sh /usr/local/bin/config.sh /usr/local/bin/run.sh && \
|
||||
RUN chmod +x /usr/local/bin/start.sh && \
|
||||
mkdir -p /var/www && \
|
||||
mkdir -p /srv/ledgersmb/local/conf && \
|
||||
chown -R www-data /srv/ledgersmb/local
|
||||
|
168
config.sh
168
config.sh
@ -1,168 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
cd /srv/ledgersmb
|
||||
[[ -d ./local/conf/ ]] || mkdir ./local/conf/
|
||||
if [[ -n "$SSMTP_ROOT" ]]; then
|
||||
echo "\$SSMTP_ROOT set; parameter is deprecated and will be ignored"
|
||||
LSMB_HAVE_DEPRECATED=1
|
||||
fi
|
||||
if [[ -n "$SSMTP_FROMLINE_OVERRIDE" ]]; then
|
||||
echo "\$SSMTP_FROMLINE_OVERRIDE set; parameter is deprecated and will be ignored"
|
||||
LSMB_HAVE_DEPRECATED=1
|
||||
fi
|
||||
if [[ -n "$SSMTP_MAILHUB" ]]; then
|
||||
echo "\$SSMTP_MAILHUB set; parameter is deprecated"
|
||||
if [[ -z "$LSMB_MAIL_SMTPHOST" ]]; then
|
||||
echo " Deriving \$LSMB_MAIL_SMTPHOST setting from \$SSMTP_MAILHUB"
|
||||
LSMB_MAIL_SMTPHOST=${SSMTP_MAILHUB%:*}
|
||||
fi
|
||||
if [[ -z "$LSMB_MAIL_SMTPPORT" ]]; then
|
||||
echo " Deriving \$LSMB_MAIL_SMTPPORT setting from \$SSMTP_MAILHUB"
|
||||
LSMB_MAIL_SMTPPORT=${SSMTP_MAILHUB#*:}
|
||||
fi
|
||||
LSMB_HAVE_DEPRECATED=1
|
||||
fi
|
||||
if [[ -n "$SSMTP_HOSTNAME" ]]; then
|
||||
echo "\$SSMTP_HOSTNAME set; parameter is deprecated"
|
||||
if [[ -z "$LSMB_MAIL_SMTPSENDER_HOSTNAME" ]]; then
|
||||
echo " Deriving \$LSMB_MAIL_SMTPSENDER_HOSTNAME setting from \$SSMTP_HOSTNAME"
|
||||
LSMB_MAIL_SMTPSENDER_HOSTNAME=$SSMTP_HOSTNAME
|
||||
fi
|
||||
LSMB_HAVE_DEPRECATED=1
|
||||
fi
|
||||
if [[ -n "$SSMTP_USE_STARTTLS" ]]; then
|
||||
echo "\$SSMTP_USE_STARTTLS set; parameter is deprecated"
|
||||
if [[ -z "$LSMB_MAIL_SMTPTLS" ]]; then
|
||||
echo " Deriving \$LSMB_MAIL_SMTPTLS setting from \$SSMTP_USE_STARTTLS"
|
||||
LSMB_MAIL_SMTPTLS=$SSMTP_USE_STARTTLS
|
||||
fi
|
||||
LSMB_HAVE_DEPRECATED=1
|
||||
fi
|
||||
if [[ -n "$SSMTP_AUTH_USER" ]]; then
|
||||
echo "\$SSMTP_AUTH_USER set; parameter is deprecated"
|
||||
if [[ -z "$LSMB_MAIL_SMTPUSER" ]]; then
|
||||
echo " Deriving \$LSMB_MAIL_SMTPUSER setting from \$SSMTP_AUTH_USER"
|
||||
LSMB_MAIL_SMTPUSER=$SSMTP_AUTH_USER
|
||||
fi
|
||||
LSMB_HAVE_DEPRECATED=1
|
||||
fi
|
||||
if [[ -n "$SSMTP_AUTH_PASS" ]]; then
|
||||
echo "\$SSMTP_AUTH_PASS set; parameter is deprecated"
|
||||
if [[ -z "$LSMB_MAIL_SMTPPASS" ]]; then
|
||||
echo " Deriving \$LSMB_MAIL_SMTPPASS setting from \$SSMTP_AUTH_PASS"
|
||||
LSMB_MAIL_SMTPPASS=$SSMTP_AUTH_PASS
|
||||
fi
|
||||
LSMB_HAVE_DEPRECATED=1
|
||||
fi
|
||||
if [[ -n "$SSMTP_AUTH_METHOD" ]]; then
|
||||
echo "\$SSMTP_AUTH_METHOD set; parameter is deprecated"
|
||||
if [[ -z "$LSMB_MAIL_SMTPAUTHMECH" ]]; then
|
||||
echo " Deriving \$LSMB_MAIL_SMTPAUTHMECH setting from \$SSMTP_AUTH_METHOD"
|
||||
LSMB_MAIL_SMTPAUTHMECH=$SSMTP_AUTH_METHOD
|
||||
fi
|
||||
LSMB_HAVE_DEPRECATED=1
|
||||
fi
|
||||
|
||||
if [[ -n "$LSMB_HAVE_DEPRECATED" ]]; then
|
||||
echo "!!! DEPRECATED \$SSMTP_* PARAMETERS WILL BE REMOVED in the 1.9 image!!!"
|
||||
fi
|
||||
|
||||
if [[ ! -f ./local/conf/ledgersmb.yaml ]]; then
|
||||
if [[ "x$LSMB_MAIL_SMTPTLS" == "xyes" ]]; then
|
||||
tls_mode=starttls
|
||||
elif [[ "x$LSMB_MAIL_SMTPTLS" == "xraw" ]]; then
|
||||
tls_mode=ssl
|
||||
else
|
||||
tls_mode=none
|
||||
fi
|
||||
cat <<EOF >./local/conf/ledgersmb.yaml
|
||||
paths:
|
||||
\$class: Beam::Wire
|
||||
config:
|
||||
UI: ./UI/
|
||||
UI_cache: lsmb_templates/
|
||||
|
||||
db:
|
||||
\$class: LedgerSMB::Database::Factory
|
||||
connect_data:
|
||||
host: ${POSTGRES_HOST:-postgres}
|
||||
port: ${POSTGRES_PORT:-5432}
|
||||
|
||||
mail:
|
||||
transport:
|
||||
\$class: Email::Sender::Transport::SMTP
|
||||
ssl: $tls_mode
|
||||
|
||||
miscellaneous:
|
||||
\$class: Beam::Wire
|
||||
config:
|
||||
proxy_ip: ${PROXY_IP:-172.17.0.1/12}
|
||||
|
||||
ui:
|
||||
class: LedgerSMB::Template::UI
|
||||
method: new_UI
|
||||
lifecycle: eager
|
||||
args:
|
||||
cache:
|
||||
\$ref: paths/UI_cache
|
||||
root:
|
||||
\$ref: paths/UI
|
||||
EOF
|
||||
|
||||
if [[ -n "$LSMB_MAIL_SMTPHOST" ]]
|
||||
then
|
||||
if [[ "$LSMB_MAIL_SMTPHOST" == "__CONTAINER_GATEWAY__" ]]
|
||||
then
|
||||
LSMB_MAIL_SMTPHOST="$(ip route | awk '/default/ { print $3 }')"
|
||||
export LSMB_MAIL_SMTPHOST
|
||||
fi
|
||||
|
||||
cat <<EOF >./local/conf/ledgersmb.000.yaml
|
||||
mail:
|
||||
transport:
|
||||
host: $LSMB_MAIL_SMTPHOST
|
||||
EOF
|
||||
fi
|
||||
|
||||
if [[ -n "$LSMB_MAIL_SMTPPORT" ]]
|
||||
then
|
||||
cat <<EOF >./local/conf/ledgersmb.001.yaml
|
||||
mail:
|
||||
transport:
|
||||
port: $LSMB_MAIL_SMTPPORT
|
||||
EOF
|
||||
fi
|
||||
|
||||
if [[ -n "$LSMB_MAIL_SMTPSENDER_HOSTNAME" ]]
|
||||
then
|
||||
cat <<EOF >./local/conf/ledgersmb.002.yaml
|
||||
mail:
|
||||
transport:
|
||||
helo: $LSMB_MAIL_SMTPSENDER_HOSTNAME
|
||||
EOF
|
||||
fi
|
||||
|
||||
if [[ -n "$LSMB_MAIL_SMTPUSER" ]]
|
||||
then
|
||||
cat <<EOF >./local/conf/ledgersmb.003.yaml
|
||||
mail:
|
||||
transport:
|
||||
sasl_authenticator:
|
||||
\$class: Authen::SASL
|
||||
mechanism: $LSMB_MAIL_SMTPAUTHMECH
|
||||
callback:
|
||||
user: $LSMB_MAIL_SMTPUSER
|
||||
pass: $LSMB_MAIL_SMTPPASS
|
||||
EOF
|
||||
fi
|
||||
fi
|
||||
|
||||
LSMB_CONFIG_FILE=${LSMB_CONFIG_FILE:-./local/conf/ledgersmb.yaml}
|
||||
export LSMB_CONFIG_FILE
|
||||
echo "--------- LEDGERSMB CONFIGURATION: $LSMB_CONFIG_FILE"
|
||||
cat ${LSMB_CONFIG_FILE}
|
||||
echo '--------- LEDGERSMB CONFIGURATION --- END'
|
||||
|
||||
exit 0
|
9
run.sh
9
run.sh
@ -1,9 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
cd /srv/ledgersmb
|
||||
|
||||
# ':5762:' suppresses an uninitialized variable warning in starman
|
||||
# the last colon means "don't connect using tls"; without it, there's a warning
|
||||
exec starman --listen 0.0.0.0:5762 --workers ${LSMB_WORKERS:-5} \
|
||||
-I lib -I old/lib \
|
||||
--preload-app bin/ledgersmb-server.psgi
|
177
start.sh
177
start.sh
@ -1,6 +1,177 @@
|
||||
#!/bin/bash
|
||||
|
||||
home_dir="$(dirname $(readlink -f $BASH_SOURCE))"
|
||||
"$home_dir/config.sh" || { echo "Failed configuration" ; exit 1 }
|
||||
cd /srv/ledgersmb
|
||||
[[ -d ./local/conf/ ]] || mkdir ./local/conf/
|
||||
if [[ -n "$SSMTP_ROOT" ]]; then
|
||||
echo "\$SSMTP_ROOT set; parameter is deprecated and will be ignored"
|
||||
LSMB_HAVE_DEPRECATED=1
|
||||
fi
|
||||
if [[ -n "$SSMTP_FROMLINE_OVERRIDE" ]]; then
|
||||
echo "\$SSMTP_FROMLINE_OVERRIDE set; parameter is deprecated and will be ignored"
|
||||
LSMB_HAVE_DEPRECATED=1
|
||||
fi
|
||||
if [[ -n "$SSMTP_MAILHUB" ]]; then
|
||||
echo "\$SSMTP_MAILHUB set; parameter is deprecated"
|
||||
if [[ -z "$LSMB_MAIL_SMTPHOST" ]]; then
|
||||
echo " Deriving \$LSMB_MAIL_SMTPHOST setting from \$SSMTP_MAILHUB"
|
||||
LSMB_MAIL_SMTPHOST=${SSMTP_MAILHUB%:*}
|
||||
fi
|
||||
if [[ -z "$LSMB_MAIL_SMTPPORT" ]]; then
|
||||
echo " Deriving \$LSMB_MAIL_SMTPPORT setting from \$SSMTP_MAILHUB"
|
||||
LSMB_MAIL_SMTPPORT=${SSMTP_MAILHUB#*:}
|
||||
fi
|
||||
LSMB_HAVE_DEPRECATED=1
|
||||
fi
|
||||
if [[ -n "$SSMTP_HOSTNAME" ]]; then
|
||||
echo "\$SSMTP_HOSTNAME set; parameter is deprecated"
|
||||
if [[ -z "$LSMB_MAIL_SMTPSENDER_HOSTNAME" ]]; then
|
||||
echo " Deriving \$LSMB_MAIL_SMTPSENDER_HOSTNAME setting from \$SSMTP_HOSTNAME"
|
||||
LSMB_MAIL_SMTPSENDER_HOSTNAME=$SSMTP_HOSTNAME
|
||||
fi
|
||||
LSMB_HAVE_DEPRECATED=1
|
||||
fi
|
||||
if [[ -n "$SSMTP_USE_STARTTLS" ]]; then
|
||||
echo "\$SSMTP_USE_STARTTLS set; parameter is deprecated"
|
||||
if [[ -z "$LSMB_MAIL_SMTPTLS" ]]; then
|
||||
echo " Deriving \$LSMB_MAIL_SMTPSENDER_HOSTNAME setting from \$SSMTP_USE_STARTTLS"
|
||||
LSMB_MAIL_SMTPTLS=$SSMTP_USE_STARTTLS
|
||||
fi
|
||||
LSMB_HAVE_DEPRECATED=1
|
||||
fi
|
||||
if [[ -n "$SSMTP_AUTH_USER" ]]; then
|
||||
echo "\$SSMTP_AUTH_USER set; parameter is deprecated"
|
||||
if [[ -z "$LSMB_MAIL_SMTPUSER" ]]; then
|
||||
echo " Deriving \$LSMB_MAIL_SMTPUSER setting from \$SSMTP_AUTH_USER"
|
||||
LSMB_MAIL_SMTPUSER=$SSMTP_AUTH_USER
|
||||
fi
|
||||
LSMB_HAVE_DEPRECATED=1
|
||||
fi
|
||||
if [[ -n "$SSMTP_AUTH_PASS" ]]; then
|
||||
echo "\$SSMTP_AUTH_PASS set; parameter is deprecated"
|
||||
if [[ -z "$LSMB_MAIL_SMTPPASS" ]]; then
|
||||
echo " Deriving \$LSMB_MAIL_SMTPPASS setting from \$SSMTP_AUTH_PASS"
|
||||
LSMB_MAIL_SMTPPASS=$SSMTP_AUTH_PASS
|
||||
fi
|
||||
LSMB_HAVE_DEPRECATED=1
|
||||
fi
|
||||
if [[ -n "$SSMTP_AUTH_METHOD" ]]; then
|
||||
echo "\$SSMTP_AUTH_METHOD set; parameter is deprecated"
|
||||
if [[ -z "$LSMB_MAIL_SMTPAUTHMECH" ]]; then
|
||||
echo " Deriving \$LSMB_MAIL_SMTPAUTHMECH setting from \$SSMTP_AUTH_METHOD"
|
||||
LSMB_MAIL_SMTPAUTHMECH=$SSMTP_AUTH_METHOD
|
||||
fi
|
||||
LSMB_HAVE_DEPRECATED=1
|
||||
fi
|
||||
|
||||
exec "$home_dir/run.sh"
|
||||
if [[ -n "$LSMB_HAVE_DEPRECATED" ]]; then
|
||||
echo "!!! DEPRECATED \$SSMTP_* PARAMETERS WILL BE REMOVED in the 1.9 image!!!"
|
||||
fi
|
||||
|
||||
if [[ ! -f ./local/conf/ledgersmb.yaml ]]; then
|
||||
if [[ "x$LSMB_MAIL_SMTPTLS" == "xyes" ]]; then
|
||||
tls_mode=starttls
|
||||
elif [[ "x$LSMB_MAIL_SMTPTLS" == "xraw" ]]; then
|
||||
tls_mode=ssl
|
||||
else
|
||||
tls_mode=none
|
||||
fi
|
||||
cat <<EOF >./local/conf/ledgersmb.yaml
|
||||
paths:
|
||||
\$class: Beam::Wire
|
||||
config:
|
||||
UI: ./UI/
|
||||
UI_cache: lsmb_templates/
|
||||
|
||||
db:
|
||||
\$class: LedgerSMB::Database::Factory
|
||||
connect_data:
|
||||
host: ${POSTGRES_HOST:-postgres}
|
||||
port: ${POSTGRES_PORT:-5432}
|
||||
|
||||
mail:
|
||||
transport:
|
||||
\$class: Email::Sender::Transport::SMTP
|
||||
ssl: $tls_mode
|
||||
|
||||
miscellaneous:
|
||||
\$class: Beam::Wire
|
||||
config:
|
||||
proxy_ip: ${PROXY_IP:-172.17.0.1/12}
|
||||
|
||||
ui:
|
||||
class: LedgerSMB::Template::UI
|
||||
method: new_UI
|
||||
lifecycle: eager
|
||||
args:
|
||||
cache:
|
||||
\$ref: paths/UI_cache
|
||||
root:
|
||||
\$ref: paths/UI
|
||||
EOF
|
||||
|
||||
if [[ -n "$LSMB_MAIL_SMTPHOST" ]]
|
||||
then
|
||||
if [[ "$LSMB_MAIL_SMTPHOST" == "__CONTAINER_GATEWAY__" ]]
|
||||
then
|
||||
LSMB_MAIL_SMTPHOST="$(ip route | awk '/default/ { print $3 }')"
|
||||
export LSMB_MAIL_SMTPHOST
|
||||
fi
|
||||
|
||||
cat <<EOF >./local/conf/ledgersmb.000.yaml
|
||||
mail:
|
||||
transport:
|
||||
host: $LSMB_MAIL_SMTPHOST
|
||||
EOF
|
||||
fi
|
||||
|
||||
if [[ -n "$LSMB_MAIL_SMTPPORT" ]]
|
||||
then
|
||||
cat <<EOF >./local/conf/ledgersmb.001.yaml
|
||||
mail:
|
||||
transport:
|
||||
port: $LSMB_MAIL_SMTPPORT
|
||||
EOF
|
||||
fi
|
||||
|
||||
if [[ -n "$LSMB_MAIL_SMTPSENDER_HOSTNAME" ]]
|
||||
then
|
||||
cat <<EOF >./local/conf/ledgersmb.002.yaml
|
||||
mail:
|
||||
transport:
|
||||
helo: $LSMB_MAIL_SMTPSENDER_HOSTNAME
|
||||
EOF
|
||||
fi
|
||||
|
||||
if [[ -n "$LSMB_MAIL_SMTPUSER" ]]
|
||||
then
|
||||
cat <<EOF >./local/conf/ledgersmb.003.yaml
|
||||
mail:
|
||||
transport:
|
||||
sasl_authenticator:
|
||||
\$class: Authen::SASL
|
||||
mechanism: $LSMB_MAIL_SMTPAUTHMECH
|
||||
callback:
|
||||
user: $LSMB_MAIL_SMTPUSER
|
||||
pass: $LSMB_MAIL_SMTPPASS
|
||||
EOF
|
||||
fi
|
||||
fi
|
||||
|
||||
# start ledgersmb
|
||||
# --preload-app allows application initialization to kill the entire
|
||||
# starman instance (instead of just the worker, which will immediately
|
||||
# get restarted) on error; it also has a positive effect on memory use
|
||||
|
||||
LSMB_CONFIG_FILE=${LSMB_CONFIG_FILE:-./local/conf/ledgersmb.yaml}
|
||||
export LSMB_CONFIG_FILE
|
||||
echo '--------- LEDGERSMB CONFIGURATION: ledgersmb.conf'
|
||||
cat ${LSMB_CONFIG_FILE}
|
||||
echo '--------- LEDGERSMB CONFIGURATION --- END'
|
||||
|
||||
# ':5762:' suppresses an uninitialized variable warning in starman
|
||||
# the last colon means "don't connect using tls"; without it, there's a warning
|
||||
exec starman --listen 0.0.0.0:5762 --workers ${LSMB_WORKERS:-5} \
|
||||
-I /srv/ledgersmb/lib \
|
||||
-I /srv/ledgersmb/old/lib \
|
||||
-I /srv/ledgersmb/local/lib/perl5 \
|
||||
--preload-app bin/ledgersmb-server.psgi
|
||||
|
Loading…
Reference in New Issue
Block a user