tylerfahey / docksal-pack
Scaffolds Docksal into your Drupal site.
Installs: 205
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 1
Open Issues: 0
Language:Shell
pkg:composer/tylerfahey/docksal-pack
This package is auto-updated.
Last update: 2025-10-13 20:34:24 UTC
README
Install Docksal
https://docs.docksal.io/getting-started/setup/
Optional: Install Terminus for use with Pantheon
https://pantheon.io/docs/terminus/install
Optional: Setup an alias in your .zshrc / .bash_profile shell:
Quickly get new projects setup with a docksalize shell shortcut:
alias docksalize=git clone https://github.com/twfahey1/docksalize.git .docksal
Configuring the docroot
- If you have your site inside another folder, e.g.
web, set that in thedocksal.envas theDOCROOTsetting. Otherwise, leave it as the default.setting.
Initialize containers.
fin up
Helpful container commands
fin bash- SSH into the container and run commands from within the CLI container.fin project reset- Deletes and restarts the containers, will wipe out database, but can be helpful for environments that get into buggy states, e.g. switching container images, corrupt database, etc.fin db create [whatever]- Create a new database within the database container. By default it will have one, but in cases of adding secondary database for certain applicationsfin db import --db=['whatever'] [path_to_db]- Related to above, import a DB dump into a specific DB on the project DB container.
Drupal: Run the appropriate init-site command
- If you're using Drupal 7, run
fin init-site-d7, for D10+, runfin init-site. This copies the appropriatesettings.local.phpand attempts to get things configured in thesettings.phpto include thesettings.local.php. See the command definitions for more.
Drupal: Running tests
- For first time setup, run
fin test-init. This will copy over the default files from the.docksal/drupal/testing-defaultsfolder, and update them to match your current Docksal virtual host. - There are 2 commands to run testing -
test, for functional testing, andtest-js, for Javascript based testing. More details on the commands can be found in the command files themselves -.docksal/commands/testand.docksal/commands/test-js. They both function largely the same way, but are configured to use correspondingphpunit.xmlfiles located in.docksal/drupal/testingfolder. - To ensure proper functionality, the
SIMPLETEST_BASE_URLhas to be updated to match the Docksal virtual host name. In most cases, this is taken care of when runningfin test-init. As part of this command, it will update the appropriatephpunit.xmlfiles automatically. This does a basic find and replace operation via perl, replacing the defaultwebstring with the Docksal variable${VIRTUAL_HOST}. - If the command doesn't work for you for some reason, you can manually update the
SIMPLETEST_BASE_URLin the includedphpunit.xmlandphpunit-js.xml, located in.docksal/drupal/testing/. In Docksal, the name of your host matches the name of your folder. So, if you cloned this into a folder calleddrupalin, your Docksal based URL will behttp://drupalin.docksal, and this is what yourSIMPLETEST_BASE_URLshould be set to.
Setting different versions of PHP
- The
docksal.envfile contains some sample definitions of the different pieces of the stack.WEB_IMAGE,DB_IMAGE, andCLI_IMAGEcan be modified to use different Docker images from the Docksal repo. The PHP version is determined from theCLI_IMAGE. You can modify the value to a new version, and runfin upto refresh the containers. Docksal will detect the changes, download the new Docker image if it doesn't exist in your cache, and reload your container running the new PHP version. So for example, to run on PHP 7.3, you could update theCLI_IMAGEto beCLI_IMAGE='docksal/cli:2.6-php7.3', and runfin up, and now the CLI container is running on PHP 7.3. And to clarify, the CLI container is determining what version of PHP that Drupal will be using, since Drupal is in essence running on this container, in orchestration with theWEB_IMAGEandDB_IMAGEcontainers, which are networked together automatically behind the scenes. See more information about this from the Docksal site.
Overriding PHP / MySQL settings
- It's possible to override PHP settings as needed. Some examples are included in the
example-php-mysql-overridesfolder. - Docksal will look for PHP overrides in
.docksal/etc/php- for more in depth information, see the Docksal documentation - Docksal will look for MySQL overrides in
.docksal/etc/mysql- for more in depth information, see the Docksal documentation
XDebug
This should provide "out of the box" xdebugging ability Test steps:
- Add
XDEBUG_ENABLED=1to yourdocksal-local.env, and do afin upto reload the containers with XDebug enabled. If you haven't already setup aphp.ini, add one, or update/etc/php/php.inisettings with desired XDebug preferences (see.docksal/example-php-mysql-overrides/etc/php/php.ini), and do afin project restartto apply the new settings. NOTE: HavingXDEBUG_ENABLED=1will slow down performance, so consider setting back to0and runningfin upto unload it if not actively using. - Download VSCode debug extension
- Go to the "debug" tab and start debugging:

- When you refresh the site in a spot where that code executes, it should jump you into vscode

Pantheon
Configure environment variables
- In
docksal.env, setPROJECT_NAMEto establish the Pantheon project name which is used in scripted terminus commands, andPANTHEON_SITE_ENVfor the preferred environment to sync from when using applicable commands.
Syncing from Pantheon
- Use
fin rsyncto sync files from thePANTHEON_SITE_ENVdefined. - Use
fin sync-dbto sync DB from thePANTHEON_SITE_ENVdefined.