feat(startup): add the DB_WAIT environment var
parent
480775c328
commit
628b5a4fa0
|
@ -14,6 +14,7 @@ ENV GID=991 \
|
|||
DB_USER=flarum \
|
||||
DB_NAME=flarum \
|
||||
DB_PORT=3306 \
|
||||
DB_WAIT=false \
|
||||
FLARUM_TITLE=Docker-Flarum \
|
||||
DEBUG=false \
|
||||
LOG_TO_STDOUT=false \
|
||||
|
|
|
@ -53,6 +53,7 @@
|
|||
| **DB_PASS** | MariaDB database password | **required** | none
|
||||
| **DB_PREF** | Flarum tables prefix | *optional* | none
|
||||
| **DB_PORT** | MariaDB database port | *optional* | 3306
|
||||
| **DB_WAIT** | Wait database live | *optional* | false
|
||||
| **FLARUM_PORT** | Port to run Flarum on inside the container | *optional* | 8888
|
||||
| **UPLOAD_MAX_SIZE** | The maximum size of an uploaded file | *optional* | 50M
|
||||
| **PHP_MEMORY_LIMIT** | PHP memory limit | *optional* | 128M |
|
||||
|
|
|
@ -66,21 +66,23 @@ if [ -f '/flarum/app/extensions/composer.repositories.txt' ]; then
|
|||
fi
|
||||
|
||||
# Wait database live
|
||||
test_count=0
|
||||
test_db(){
|
||||
db-live-test --dsn "mysql:host=${DB_HOST};port=${DB_PORT};database=${DB_NAME}" \
|
||||
--user ${DB_USER} \
|
||||
--password ${DB_PASS}
|
||||
}
|
||||
echo "[INFO] Waiting for the database live..."
|
||||
until test_db; do
|
||||
if [ "${test_count}" = 40 ]; then
|
||||
echo "[ERROR] The database not live!" >&2
|
||||
exit 75
|
||||
fi
|
||||
test_count=$(($test_count + 1))
|
||||
sleep 1
|
||||
done
|
||||
if [ "${DB_WAIT}" = 'true' ]; then
|
||||
test_count=0
|
||||
test_db(){
|
||||
db-live-test --dsn "mysql:host=${DB_HOST};port=${DB_PORT};database=${DB_NAME}" \
|
||||
--user ${DB_USER} \
|
||||
--password ${DB_PASS}
|
||||
}
|
||||
echo "[INFO] Waiting for the database live..."
|
||||
until test_db; do
|
||||
if [ "${test_count}" = 40 ]; then
|
||||
echo "[ERROR] The database not live!" >&2
|
||||
exit 75
|
||||
fi
|
||||
test_count=$(($test_count + 1))
|
||||
sleep 1
|
||||
done
|
||||
fi
|
||||
|
||||
# if installation was performed before
|
||||
if [ -e '/flarum/app/public/assets/rev-manifest.json' ] || [ -e '/flarum/app/public/assets/._flarum-installed.lock' ] ; then
|
||||
|
|
Loading…
Reference in New Issue