Problem/Motivation
Our dev and production environments use Docker containers to serve sites. These are relatively easy to change, to swap out PHP versions -- but one of the main benefits of Drupal Flake is to be able to easily switch the PHP version for drush, dr, composer, etc - the shell/command line environment.
We want to use the Nix php environment in the shell, without putting the rest of the environment at risk by accidentally starting it up.
Steps to reproduce
Load a site with Drupal Flake into a traditional web server, or one using Docker containers.
Run start-detached or start.
Now you get process-compose starting up database, php, and nginx servers, and the flake systems take over, breaking your dev or production site!
Proposed resolution
Put in a guard to prevent this from accidentally happening -- when the env var DRUPAL_FLAKE_SERVICES_DISABLED=1 is set, make the various start scripts exit without starting services.
The rest of the Flake scripts and CLI/shell programs continue to function as normal.
Remaining tasks
User interface changes
API changes
New environment variable that can be set to prevent accidental service starts.
Comments
Comment #3
freelockAdded to main dev branch, not yet tested.
Comment #4
freelockImplemented the Drupal-flake kill switch using:
No NixOS management is required; it works on Ubuntu through the normal process environment.
Behavior
With the variable enabled, Drupal-flake still provides:
These service-start paths are blocked:
Automatic browser opening is also disabled.
A blocked command reports:
Error: drupal-flake service startup is disabled in this environment.The shell displays:
CLI-only mode: drupal-flake service startup is disabled.Ubuntu configuration
For SSH and other PAM login sessions, add this to `/etc/environment`:
Then log out and reconnect. Existing sessions will not automatically receive the new value.
CLI tools should continue working:
Comment #5
freelockConfirmed working. Easiest way to set this is to add DRUPAL_FLAKE_SERVICES_DISABLED=1 to /etc/environment and then log in again.