From ab41e7717fe0df20a4ca516b918b64bd32753361 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Sun, 20 Sep 2020 14:57:29 +0200 Subject: docker: Always regenerated config files on container startup We should really regenerate the configs, run migrations and hooks during each container startup. Otherwise you really can't update anything at all. The only thing that we do not do multiple times is adding the admin user, but the add_user method already checks for that and simply displayed an error. Hiding that error is probably not worth the effort so we just add a quick explanatory comment before the potential error. Signed-off-by: Florian Pritz --- docker/add_user.sh | 1 + docker/filebin_starter.sh | 25 ++++++++++--------------- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/docker/add_user.sh b/docker/add_user.sh index 4342528ef..88618746d 100755 --- a/docker/add_user.sh +++ b/docker/add_user.sh @@ -1,4 +1,5 @@ #!/bin/bash cd ${FILEBIN_DIR} +echo "Creating initial user. If it exists, this will show an error message instead" printf "%s\n%s\n%s\n" admin ${FB_CONTACT_MAIL} admin | php index.php user add_user diff --git a/docker/filebin_starter.sh b/docker/filebin_starter.sh index 2fecc3fe3..38088537e 100755 --- a/docker/filebin_starter.sh +++ b/docker/filebin_starter.sh @@ -64,25 +64,20 @@ while ! nc "$FB_DB_HOSTNAME" 3306 /dev/null; do sleep 0.5 done +set_config +set_database_config +set_mail_config -if [[ ! -e $FILEBIN_DIR/application/config/config-local.php ]]; then - echo "no config found, new config will be generated" +CONTACT_INFO_FILE=${FILEBIN_DIR}/data/local/contact-info.php +cp $FILEBIN_DIR/data/local/examples/contact-info.php ${CONTACT_INFO_FILE} - set_config - set_database_config - set_mail_config +sed -i "s/John Doe/${FB_CONTACT_NAME}/" ${CONTACT_INFO_FILE} +sed -i "s/john.doe@example.com/${FB_CONTACT_MAIL}/" ${CONTACT_INFO_FILE} - CONTACT_INFO_FILE=${FILEBIN_DIR}/data/local/contact-info.php - cp $FILEBIN_DIR/data/local/examples/contact-info.php ${CONTACT_INFO_FILE} +${FILEBIN_DIR}/scripts/install-git-hooks.sh +${FILEBIN_DIR}/git-hooks/post-merge - sed -i "s/John Doe/${FB_CONTACT_NAME}/" ${CONTACT_INFO_FILE} - sed -i "s/john.doe@example.com/${FB_CONTACT_MAIL}/" ${CONTACT_INFO_FILE} - - ${FILEBIN_DIR}/scripts/install-git-hooks.sh - ${FILEBIN_DIR}/git-hooks/post-merge - - ${FILEBIN_HOME_DIR}/add_user.sh -fi +${FILEBIN_HOME_DIR}/add_user.sh cd $FILEBIN_DIR/public_html php -S 0.0.0.0:8080 -- cgit v1.2.3-24-g4f1b