Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions docs/admin/server-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -857,7 +857,7 @@ This deploys three templates:

The `drupal-core` template can provision workspaces faster using a **seed cache** on the host. The cache is a plain git clone of drupal/drupal. New workspaces pass it as a `--reference` hint to `git clone`, reusing local git objects and avoiding several hundred MB of network transfer. Composer install still runs fresh inside each workspace.

The database is always installed fresh via `ddev drush si`.
The seed cache is just a simple git checkout — no DDEV project, no database, no vendor directory, no composer files.

### One-time initial setup

Expand Down Expand Up @@ -920,22 +920,30 @@ Run these steps on each server:
SEED_DIR=~/cache/drupal-core-seed
REPO=~/workspace/coder-ddev

# 1. Stop the old DDEV seed project
# 1. Stop the old DDEV seed project (only needed if it was still running)
cd "$SEED_DIR" && ddev stop --remove-data 2>/dev/null || true

# 2. Move the git clone to the seed root, remove everything else
mv "$SEED_DIR/repos/drupal" /tmp/drupal-git-tmp
rm -rf "$SEED_DIR"
mv /tmp/drupal-git-tmp "$SEED_DIR"

# 3. Install the updated update script and service
# 3. Install the updated script, service, and timer
sudo install -m 755 $REPO/drupal-core/scripts/update-drupal-cache \
/usr/local/bin/update-drupal-cache
sudo install -m 644 $REPO/drupal-core/scripts/drupal-cache-updater.service \
/etc/systemd/system/
sudo install -m 644 $REPO/drupal-core/scripts/drupal-cache-updater.timer \
/etc/systemd/system/

# 4. Set the correct user in the service file (YOURUSER is a placeholder)
sudo sed -i "s/User=YOURUSER/User=$(whoami)/" /etc/systemd/system/drupal-cache-updater.service

# 5. Enable and start the timer
sudo systemctl daemon-reload
sudo systemctl enable --now drupal-cache-updater.timer

# 4. Verify it works
# 6. Verify it works
sudo systemctl start drupal-cache-updater.service
journalctl -u drupal-cache-updater.service --no-pager | tail -10
```
Expand All @@ -957,7 +965,7 @@ make push-template-drupal-core DRUPAL_CACHE_PATH=/your/cache/path
When a workspace starts for the first time:

1. The startup script checks for `.git` at `/home/coder-cache-seed` (the read-only bind mount of `cache_path`)
2. **Cache hit:** `git clone --reference` reuses local git objects for the initial clone (fast), then `ddev composer install` runs fresh inside the container
2. **Cache hit:** `git clone --reference` reuses local git objects for the initial clone (fast), then `composer install` runs fresh inside the container
3. **Cache miss** (path absent or no `.git` at root): `git clone` runs without a reference — slower but always works

Check workspace startup logs in the Coder dashboard or at `/tmp/drupal-setup.log` inside the workspace to confirm which path was taken.
Expand Down
2 changes: 1 addition & 1 deletion drupal-core/scripts/drupal-cache-updater.service
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Type=oneshot
# Must run as the user who owns the seed cache directory — NOT root.
# Change User= to the account that owns the cache (e.g. your server's admin user).
User=YOURUSER
WorkingDirectory=%h
WorkingDirectory=/tmp
# The script is installed to /usr/local/bin/ (see docs/admin/server-setup.md).
# The script defaults to ~/cache/drupal-core-seed (relative to the User= above).
# Pass --seed-dir only if your seed directory differs from that default.
Expand Down
3 changes: 3 additions & 0 deletions drupal-core/scripts/update-drupal-cache
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
# Note: When run via the systemd timer, the seed directory is taken from the default
# or from the ExecStart line in drupal-cache-updater.service — edit that file to pass
# --seed-dir if your seed directory differs from the default.
#
# IMPORTANT: This script must be reinstalled to /usr/local/bin/ after any changes:
# sudo install -m 755 drupal-core/scripts/update-drupal-cache /usr/local/bin/update-drupal-cache

set -euo pipefail

Expand Down
Loading