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_USER: drupal
|
||||||
DB_PASS: drupal
|
DB_PASS: drupal
|
||||||
SITE_NAME: "Riverside Therapeutics"
|
SITE_NAME: "Riverside Therapeutics"
|
||||||
ADMIN_PASS: "${ADMIN_PASS:-admin}"
|
ADMIN_PASS: "${ADMIN_PASS:?ADMIN_PASS is required}"
|
||||||
HASH_SALT: "${HASH_SALT:-replace-this-in-production-with-a-long-random-string}"
|
HASH_SALT: "${HASH_SALT:?HASH_SALT is required}"
|
||||||
DEBUG: "${DEBUG:-true}"
|
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}"
|
BASE_URL: "${BASE_URL:-http://localhost:8080}"
|
||||||
volumes:
|
volumes:
|
||||||
- ./web/sites/default/files:/var/www/html/web/sites/default/files
|
- ./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_USER="${DB_USER:-drupal}"
|
||||||
DB_NAME="${DB_NAME:-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}..."
|
echo "[entrypoint] Waiting for PostgreSQL at ${DB_HOST}..."
|
||||||
until pg_isready -h "$DB_HOST" -U "$DB_USER" -d "$DB_NAME" -q; do
|
until pg_isready -h "$DB_HOST" -U "$DB_USER" -d "$DB_NAME" -q; do
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
@ -18,35 +26,26 @@ HAS_TABLES=$($DRUSH sql:query \
|
||||||
"SELECT COUNT(*) FROM information_schema.tables WHERE table_schema='public' AND table_name='users';" \
|
"SELECT COUNT(*) FROM information_schema.tables WHERE table_schema='public' AND table_name='users';" \
|
||||||
2>/dev/null || echo "0")
|
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
|
if [ "$HAS_TABLES" != "1" ]; then
|
||||||
echo "[entrypoint] Fresh database, installing Drupal..."
|
echo "[entrypoint] Fresh database, installing Drupal..."
|
||||||
$DRUSH site:install standard \
|
$DRUSH site:install standard \
|
||||||
--site-name="${SITE_NAME:-Portfolio}" \
|
--site-name="$SITE_NAME" \
|
||||||
--account-name=admin \
|
--account-name=admin \
|
||||||
--account-pass="${ADMIN_PASS:-admin}" \
|
--account-pass="$ADMIN_PASS" \
|
||||||
-y || { echo "[entrypoint] FATAL: site:install failed."; exit 1; }
|
-y || { echo "[entrypoint] FATAL: site:install failed."; exit 1; }
|
||||||
echo "[entrypoint] Drupal installed."
|
echo "[entrypoint] Drupal installed."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$IS_SETUP" != "1" ]; then
|
echo "[entrypoint] Enabling required modules..."
|
||||||
echo "[entrypoint] Running first-time setup..."
|
$DRUSH en -y views views_ui field_ui text options link datetime && \
|
||||||
|
|
||||||
$DRUSH en -y views views_ui field_ui text options link datetime && \
|
|
||||||
echo "[entrypoint] Core modules enabled." || echo "[entrypoint] WARNING: core modules failed."
|
echo "[entrypoint] Core modules enabled." || echo "[entrypoint] WARNING: core modules failed."
|
||||||
$DRUSH en -y webform webform_ui && \
|
$DRUSH en -y webform webform_ui && \
|
||||||
echo "[entrypoint] Webform enabled." || echo "[entrypoint] WARNING: webform failed."
|
echo "[entrypoint] Webform enabled." || echo "[entrypoint] WARNING: webform failed."
|
||||||
$DRUSH en -y symfony_mailer && \
|
$DRUSH en -y symfony_mailer && \
|
||||||
echo "[entrypoint] Mailer enabled." || echo "[entrypoint] WARNING: symfony_mailer failed."
|
echo "[entrypoint] Mailer enabled." || echo "[entrypoint] WARNING: symfony_mailer failed."
|
||||||
$DRUSH en -y riverside_pt && \
|
$DRUSH en -y riverside_pt && \
|
||||||
echo "[entrypoint] riverside_pt enabled." || echo "[entrypoint] WARNING: riverside_pt failed."
|
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 theme:enable starterkit_theme claro_compact -y && \
|
||||||
$DRUSH config:set system.theme default starterkit_theme -y && \
|
$DRUSH config:set system.theme default starterkit_theme -y && \
|
||||||
$DRUSH config:set system.theme admin claro_compact -y && \
|
$DRUSH config:set system.theme admin claro_compact -y && \
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue