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