This commit is contained in:
parent
9c0ea08d17
commit
5ea7e69f5a
2 changed files with 22 additions and 23 deletions
|
|
@ -11,10 +11,10 @@ services:
|
|||
DB_USER: drupal
|
||||
DB_PASS: drupal
|
||||
SITE_NAME: "Riverside Therapeutics"
|
||||
ADMIN_PASS: "${ADMIN_PASS:-admin}"
|
||||
HASH_SALT: "${HASH_SALT:-replace-this-in-production-with-a-long-random-string}"
|
||||
ADMIN_PASS: "${ADMIN_PASS:?ADMIN_PASS is required}"
|
||||
HASH_SALT: "${HASH_SALT:?HASH_SALT is required}"
|
||||
DEBUG: "${DEBUG:-true}"
|
||||
POSTMARK_API_KEY: "${POSTMARK_API_KEY:-}"
|
||||
POSTMARK_API_KEY: "${POSTMARK_API_KEY:?POSTMARK_API_KEY is required}"
|
||||
BASE_URL: "${BASE_URL:-http://localhost:8080}"
|
||||
volumes:
|
||||
- ./web/sites/default/files:/var/www/html/web/sites/default/files
|
||||
|
|
|
|||
|
|
@ -4,6 +4,14 @@ DB_HOST="${DB_HOST:-postgres}"
|
|||
DB_USER="${DB_USER:-drupal}"
|
||||
DB_NAME="${DB_NAME:-drupal}"
|
||||
|
||||
for var in SITE_NAME ADMIN_PASS; do
|
||||
eval val=\$$var
|
||||
if [ -z "$val" ]; then
|
||||
echo "[entrypoint] FATAL: $var is required."
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
echo "[entrypoint] Waiting for PostgreSQL at ${DB_HOST}..."
|
||||
until pg_isready -h "$DB_HOST" -U "$DB_USER" -d "$DB_NAME" -q; do
|
||||
sleep 1
|
||||
|
|
@ -18,23 +26,17 @@ HAS_TABLES=$($DRUSH sql:query \
|
|||
"SELECT COUNT(*) FROM information_schema.tables WHERE table_schema='public' AND table_name='users';" \
|
||||
2>/dev/null || echo "0")
|
||||
|
||||
IS_SETUP=$($DRUSH sql:query \
|
||||
"SELECT COUNT(*) FROM config WHERE name='core.extension' AND data LIKE '%riverside_pt%';" \
|
||||
2>/dev/null || echo "0")
|
||||
|
||||
if [ "$HAS_TABLES" != "1" ]; then
|
||||
echo "[entrypoint] Fresh database, installing Drupal..."
|
||||
$DRUSH site:install standard \
|
||||
--site-name="${SITE_NAME:-Portfolio}" \
|
||||
--site-name="$SITE_NAME" \
|
||||
--account-name=admin \
|
||||
--account-pass="${ADMIN_PASS:-admin}" \
|
||||
--account-pass="$ADMIN_PASS" \
|
||||
-y || { echo "[entrypoint] FATAL: site:install failed."; exit 1; }
|
||||
echo "[entrypoint] Drupal installed."
|
||||
fi
|
||||
|
||||
if [ "$IS_SETUP" != "1" ]; then
|
||||
echo "[entrypoint] Running first-time setup..."
|
||||
|
||||
echo "[entrypoint] Enabling required modules..."
|
||||
$DRUSH en -y views views_ui field_ui text options link datetime && \
|
||||
echo "[entrypoint] Core modules enabled." || echo "[entrypoint] WARNING: core modules failed."
|
||||
$DRUSH en -y webform webform_ui && \
|
||||
|
|
@ -44,9 +46,6 @@ if [ "$IS_SETUP" != "1" ]; then
|
|||
$DRUSH en -y riverside_pt && \
|
||||
echo "[entrypoint] riverside_pt enabled." || echo "[entrypoint] WARNING: riverside_pt failed."
|
||||
|
||||
echo "[entrypoint] First-time setup complete."
|
||||
fi
|
||||
|
||||
$DRUSH theme:enable starterkit_theme claro_compact -y && \
|
||||
$DRUSH config:set system.theme default starterkit_theme -y && \
|
||||
$DRUSH config:set system.theme admin claro_compact -y && \
|
||||
|
|
|
|||
Loading…
Reference in a new issue