File structure of a DKAN-Tools-based project

One of the many reasons for using DKTL is to create a clear separation between the code specific to a particular DKAN site (i.e. "custom code") and the dependencies we pull in from other sources (primarily, DKAN core and Drupal core). Keep all of your custom code in the src directory and symlink the overrides to the appropriate directory inside docroot. This will make maintaining your DKAN site much easier. DKAN Tools will set up the symlinks for you.

To accomplish this separation, DKAN Tools projects will have the following basic directory structure, created when we run dktl init.

├── backups           # Optional for local development, see the DB backups section
├── docroot           # Drupal core
|   └── modules
|       └── contrib
|           └── dkan # The upstream DKAN core codebase
|
├── src               # Site-specific configuration, code and files.
│   ├── modules       # Symlinked to docroot/modules/custom
│   ├── script        # Deployment script and other misc utilities
|   └── site          # Symlinked to docroot/sites/default
│   │   └── files     # The main site files
│   ├── test          # Custom tests
|   └── themes        # Symlinked to docroot/themes/custom
└── dktl.yml          # DKAN Tools configuration

The src/site folder

Most configuration in Drupal sites is placed in the /sites/default directory.

The /src/site folder will replace /docroot/sites/default once Drupal is installed. /src/site should then contain all of the configuration that will be in /docroot/sites/default.

DKTL should have already provided some things in /src/site: settings.php contains some generalized code that is meant to load any other setting files present, as long as they follow the settings.\<something>.php pattern. All of the special settings that you previously had in settings.php or other drupal configuration files should live in settings.custom.php or a similarly-named file in /src/site.

The src/test folder (custom tests)

DKAN Tools supports custom Cypress tests found in the src/test/cypress directory.

To run custom tests:

dktl test:cypress