Skip to content

Latest commit

 

History

History
43 lines (37 loc) · 2.62 KB

how_to_use.md

File metadata and controls

43 lines (37 loc) · 2.62 KB

How to use Docker4Drupal with custom codebase

This explanation is intended for those Drupal installation based in custom source code. For this, its going to be required a database dump and a source code directory (generated with the drush archive-dump command).

The 'drush archive-dump' does a backup your code, files, and database into a single file, a compressed .tgz file. This .tgz file mainly contains (1) a directory with the Drupal instance source code (containing the content from the "/var/www/html/web/" directory in server), (2) a SQL file with a database dump.

Let's call the dumpfile as $DRUPAL_DMP.

In order to use your data with this docker project, you must do the followings steps:

  1. Make a git clone of the project in $D4D_DIR.
  2. Copy your web/ codebase in "data/" project directory.
cp $DRUPAL_DMP/web $D4D_DIR/data
  1. Copy your SQL dump file in "mariadb-init" directory.
cp $DRUPAL_DMP/$DB_DUMP.sql $D4D_DIR/mariadb-init
  1. Modify the variables in the $D4D_DIR/.env file.
    • The values of DB_NAME, DB_USER, and DB_PASSWORD variables must be the same as in specified in the $D4D_DIR/data/web/sites/default/settings.php.
    • Optionally, you may modify the PROJECT_NAME and PROJECT_BASE_URL variables.
  2. Now you can create the Drupal containers (using the make target defined at docker.mk file).
make up
  1. Now you should be able to access to your Drupal application at http://drupal.docker.localhost:8000 location (or the port setted at TRAEFIK_PORT variable in the .env file) .
    127.0.0.1    drupal.docker.localhost

Vinculate services to an existing network

If you want to make this services reachables from another network, you can specify the name of this network on the DOCKER_EXTERNAL_NETWORK_NAME environment variable (specified in the .env file). Then you must uncomment the following lines in the docker-compose.yml file:

### Configure this option if you want to add this services to an external network...
networks:
  default:
    external:
      name: ${DOCKER_EXTERNAL_NETWORK_NAME}