Skip to main content

Development

Typical development process

  1. Pull the latest changes from the remote repository.
  2. Fetch the latest database dump from the production environment.
  3. Build the project.
  4. Start a new feature or bugfix branch:
    • Create a new branch from develop.
    • Implement the feature or fix the bug.
  5. Run tests:
    • Run automated tests locally.
    • Fix any failing tests.
  6. Run code quality checks:
    • Run static code analysis locally.
    • Fix any issues reported.
  7. Commit changes to the branch and push it to the remote repository.
  8. Create a pull request:
    • Create a pull request from the branch to develop.
    • Assign reviewers.
    • Wait for the continuous integration pipeline to pass.

Running CLI commands

You can run CLI commands inside the project containers.

# Run a command in the CLI container
ahoy cli echo "Hello, World!"
# SSH into the CLI container
ahoy cli

You can also use shortcuts for common commands:

# Run Drush command
ahoy drush status
# Run Composer command
ahoy composer install

Switching branches

When switching to a new branch, there is no need to rebuild the entire project as it may take a long time. Instead, you can run these commands as needed based on what changed:

# Update Composer dependencies (only if composer.json/composer.lock changed)
ahoy composer install
# Rebuild frontend assets (only if theme files changed)
ahoy fe
# Provision site (only if database or configuration changes expected)
ahoy provision

Resetting the codebase

To reset the local environment, use the reset command. This will stop and remove all containers and downloaded dependency packages (vendor, node_modules etc.).

# Reset local environment
ahoy reset
# Fully reset repository to a state as if it was just cloned
ahoy reset hard

Environment variables

To update environment variables in your local development environment:

  1. Edit variables in .env.local file
  2. Apply changes by restarting containers:
ahoy restart

➡️ See Variables for comprehensive variable reference.

Performance optimization

# Enable CSS/JS aggregation
ahoy drush config:set system.performance css.preprocess 1
ahoy drush config:set system.performance js.preprocess 1
# Clear render cache
ahoy drush cache:rebuild-external
# Check database updates needed
ahoy drush updatedb:status

Common issues & solutions

Site not loading

ahoy doctor                # Check for common issues
ahoy down && ahoy up # Restart containers
ahoy info # Verify URLs and ports

Database connection errors

docker compose ps      # Check if database container is running
ahoy reset # Nuclear option: rebuild everything

Permission issues

# Fix file permissions (Linux/Mac)
sudo chown -R $USER:$USER .

Memory issues during composer install

# Increase PHP memory temporarily
ahoy composer install --no-dev --optimize-autoloader

Log files

# View ahoy logs
ahoy logs
# Check container logs
docker compose logs --tail=50 cli
# View Drupal watchdog logs
ahoy drush watchdog:show --count=20

Beyond local development

Expand to see the complete code lifecycle

See also

TopicDescription
DatabaseFetching, refreshing, and exporting databases
ComposerManaging packages, patching, security auditing
DebuggingXdebug, curl testing, container access
PHPUnitUnit, Kernel, and Functional testing
BehatBehavior-Driven Development (BDD) testing