/wdrupal

Drupal modules collection

Primary LanguageCSS

WDrupal

Drupal modules and themes collection

Test

docker pull drupal

docker run --name dew-drupal -p 8090:80 -d drupal

docker exec -it dew-drupal /bin/bash

Install sqlite and Drush

apt update

apt install sqlite3

composer require drush/drush

drush sql:cli

.tables

pragma table_info('node');

.header on

.mode column 

select * from node;

select nid,vid,type,title from node_field_data;

select * from path_alias;

.quit

To export data:

.output /opt/drupal/table.sql

.dump [table]

.quit

Modify init script

The entrypoint of Drupal container is:

/usr/local/bin/docker-php-entrypoint

#!/bin/sh
set -e

# first arg is `-f` or `--some-option`
if [ "${1#-}" != "$1" ]; then
  set -- apache2-foreground "$@"
fi

exec "$@"

You can add your init script after set -e. Below is an example.

# [DEW] check hosts
if grep -q 'wdrupal.dew.org' '/etc/hosts'; then
  echo 'wdrupal.dew.org is mapped in /etc/hosts'
else
  echo 'wdrupal.dew.org is NOT mapped in /etc/hosts'
  echo '10.2.2.2 wdrupal.dew.org' >> /etc/hosts
  echo 'wdrupal.dew.org added in /etc/hosts'
fi

# [DEW] check data folder
data_folder="/data01"
if [ -d "$data_folder" ]; then
  user_folder=$(stat -c %U "$data_folder")
  if [ "$user_folder" = "root" ]; then
    echo "$data_folder belongs to root"
    echo "change $data_folder permissions..."
    chmod -R a+rwx "$data_folder"
  else
    echo "$data_folder does NOT belong to root"
    echo "change $data_folder permissions..."
    chmod -R a+rwx "$data_folder"
  fi
else
  echo "The folder $data_folder does NOT exist"
  echo "create $data_folder..."
  mkdir -p "$data_folder"
  echo "change $data_folder permissions..."
  chmod -R a+rwx "$data_folder"
fi

Contributors