diff options
| author | Jan-Hendrik Willms <tleilax+studip@gmail.com> | 2023-02-09 10:57:24 +0000 |
|---|---|---|
| committer | Jan-Hendrik Willms <tleilax+studip@gmail.com> | 2023-02-09 10:57:24 +0000 |
| commit | 9c9a398d27949e29422e2ef5621911c886d8dd18 (patch) | |
| tree | 5a3d89501923b03127d9bf071c1b9ec3c6ca3abe /docker/studip/docker-entrypoint.sh | |
| parent | 880749963518e8d07608d75372ffe54a5e062f76 (diff) | |
5.1: adjust gitlab ci pipeline configuring to include checks and tests, re #2116biest-02063
Merge request studip/studip!1372
Diffstat (limited to 'docker/studip/docker-entrypoint.sh')
| -rw-r--r-- | docker/studip/docker-entrypoint.sh | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/docker/studip/docker-entrypoint.sh b/docker/studip/docker-entrypoint.sh new file mode 100644 index 0000000..bafc2fe --- /dev/null +++ b/docker/studip/docker-entrypoint.sh @@ -0,0 +1,44 @@ +#!/bin/bash +set -e + +STUDIP='/var/www/studip' +CONFIGFILE="$STUDIP/config/config_local.inc.php" +DOCKERCONFIGFILE="/config/config_local.inc.php" +CONF="$STUDIP/config/config.inc.php" + +# Check if we have a config +if [ ! -f $CONFIGFILE ]; then + echo "Setting up new config" + cp "$DOCKERCONFIGFILE" "$CONFIGFILE" + cp "$CONF.dist" "$CONF" +fi + +# wait until MySQL is really available +maxcounter=45 + +counter=1 +while ! mysql -u $MYSQL_USER -h $MYSQL_HOST -p$MYSQL_PASSWORD -e "show databases;" > /dev/null 2>&1; do + sleep 1 + counter=`expr $counter + 1` + if [ $counter -gt $maxcounter ]; then + echo "We have been waiting for MySQL too long already; failing." >&2 + exit 1 + fi; +done + +sh $STUDIP/.gitlab/scripts/install_db.sh + +if [ ! -z $AUTO_MIGRATE ]; then + echo "Migrate Instance" + # If migrate fails start instance anyway + php "$STUDIP/cli/studip migrate" || true + echo "Migration finished" +fi + +# first arg is `-f` or `--some-option` +if [ "${1#-}" != "$1" ]; then + set -- apache2-foreground "$@" +fi + +exec "$@" + |
