> ## Documentation Index
> Fetch the complete documentation index at: https://libops-renovate-github-com-libops-sitectl-0-x.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Drupal plugin

> Drupal-oriented sitectl workflows including drush execution, user login links, and database and config sync between environments.

export const Compose = () => <Tooltip headline="Compose" tip={<>
        Docker Compose is Docker's tool for defining and running multi-container applications.{" "}
        <a href="https://docs.docker.com/compose/">https://docs.docker.com/compose/</a>.
      </>}>
    <>
      <Icon icon="docker" />
      {" "}
      Compose
    </>
  </Tooltip>;

The Drupal plugin adds Drupal-specific commands on top of the core sitectl context and <Compose /> model. Install it when your site runs Drupal, whether standalone or as part of a larger stack like ISLE (Islandora).

## Commands

### drush

Run any Drush command inside the Drupal container for the active context:

```bash theme={null}
sitectl drupal drush cr
sitectl drupal drush cron --context museum-prod
sitectl drupal drush updb -y
```

sitectl resolves the correct container from the context and executes the command inside it. You don't need to know the container name or remember which context you're connected to.

### login

Generate a one-time Drupal login link via `drush user:login`:

```bash theme={null}
sitectl drupal login
sitectl drupal login --uid 5
```

The default user ID is 1. Pass `--uid` to generate a link for a different user.

### sync database

Copy the Drupal database from one context to another:

```bash theme={null}
sitectl drupal sync database --source museum-prod --target museum-local
```

sitectl backs up the source database, stages it between contexts, imports it into the target, and runs post-import steps. Before importing it confirms the operation with you. Pass `--yolo` to skip the confirmation in automation.

Use `--fresh` to always take a new backup from the source instead of reusing a backup from earlier today.

<Warning>
  Syncing a database replaces the target database. Make sure you have a backup of the target before running this on staging or production.
</Warning>

### sync config

Copy the Drupal config/sync directory from one context to another:

```bash theme={null}
sitectl drupal sync config --source museum-prod --target museum-local
```

This exports the config export from the source, stages it, and imports it into the target via `drush config:import`.

### dev

Use local development helpers for contrib work:

```bash theme={null}
sitectl drupal dev checkout-pr token --branch 1.x
sitectl drupal dev patch-pr https://github.com/drupal/token/pull/42
sitectl drupal dev overwrite-starter-site --force
```

These commands help contributors test extension branches, apply GitHub PR patches through Composer, and refresh the Drupal root from an upstream project archive.

## Assigning the Drupal plugin to a context

When you create or configure a context, set its `plugin` field to `drupal`:

```yaml theme={null}
plugin: drupal
```

sitectl uses this to validate that Drupal commands are only run against Drupal contexts, and to route the `sitectl debug` command to the Drupal plugin for Drupal-specific diagnostics.
