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
10 changes: 10 additions & 0 deletions docker-compose.upsun.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#ddev-generated
# Per-project volume for PLATFORM_CACHE_DIR, so build hook caches survive
# `ddev restart`. DDEV v1.25.6+ no longer mounts ddev-global-cache on web.
services:
web:
volumes:
- upsun-cache:/mnt/ddev-upsun-cache

volumes:
upsun-cache:
1 change: 1 addition & 0 deletions install.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: upsun

project_files:
- docker-compose.upsun.yaml
- upsun/install-hook.php
- upsun/UpsunConfigParserInterface.php
- upsun/UpsunConfigParser.php
Expand Down
11 changes: 11 additions & 0 deletions tests/drupal11-unified.bats
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,17 @@ run_unified_test() {
assert_output --partial "PLATFORM_PROJECT="
assert_output --partial "PLATFORM_ENVIRONMENT="

# Test PLATFORM_CACHE_DIR is writable and survives restart
echo "# Testing PLATFORM_CACHE_DIR persistence" >&3
run ddev exec 'test "$PLATFORM_CACHE_DIR" = /mnt/ddev-upsun-cache && touch "$PLATFORM_CACHE_DIR/marker"'
assert_success
# --skip-hooks: the postgres fixture's DB dump doesn't match config/sync, so
# its deploy hook's config-import fails once Drupal is installed
run ddev restart --skip-hooks
assert_success
run ddev exec 'test -f "$PLATFORM_CACHE_DIR/marker"'
assert_success

# Test database connectivity
echo "# Testing database connectivity" >&3
if [[ "${EXPECTED_DB_TYPE}" == "postgres" ]]; then
Expand Down
4 changes: 4 additions & 0 deletions tests/shared/common-assertions.bash
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,9 @@ assert_file_structure() {
run grep 'ln -sf /var/www/html /app' .ddev/web-build/Dockerfile.upsun
assert_success

# PLATFORM_CACHE_DIR is backed by a per-project volume
assert [ -f .ddev/docker-compose.upsun.yaml ]

# Verify mount directories were created
assert [ -d web/sites/default/files ]
assert [ -d tmp ]
Expand Down Expand Up @@ -299,6 +302,7 @@ assert_addon_removal() {
# Verify generated files were removed
assert [ ! -f .ddev/config.upsun.yaml ]
assert [ ! -f .ddev/web-build/Dockerfile.upsun ]
assert [ ! -f .ddev/docker-compose.upsun.yaml ]

# Verify project files were removed (they get installed in .ddev/upsun/)
assert [ ! -f .ddev/upsun/install-hook.php ]
Expand Down
5 changes: 4 additions & 1 deletion upsun/DdevConfigGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,10 @@ private function generateUpsunDockerfile(): void
$content = "#ddev-generated by ddev-upsun add-on\n";
$content .= "# If you want to edit this file (not recommended) remove the line above.\n";
$content .= "# Creates /app symlink that Upsun scripts expect (PLATFORM_APP_DIR=/app)\n\n";
$content .= "RUN ln -sf /var/www/html /app\n";
$content .= "RUN ln -sf /var/www/html /app\n\n";
$content .= "# PLATFORM_CACHE_DIR mount point, owned by the web user so the new\n";
$content .= "# upsun-cache volume (docker-compose.upsun.yaml) starts out writable\n";
$content .= "RUN mkdir -p /mnt/ddev-upsun-cache && chown \"\$uid:\$gid\" /mnt/ddev-upsun-cache\n";

if (file_put_contents($dockerFile, $content) === false) {
throw new DdevConfigException("Failed to write Upsun Dockerfile: {$dockerFile}");
Expand Down
3 changes: 2 additions & 1 deletion upsun/PlatformEnvironmentGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ public function generatePlatformVariables(): array
'PLATFORM_ROUTES' => $this->generateRoutes(),
'PLATFORM_VARIABLES' => $this->generateVariables(),
'PLATFORM_SMTP_HOST' => 'localhost:1025', // DDEV's mailpit
'PLATFORM_CACHE_DIR' => '/mnt/ddev-global-cache/ddev-upsun/' . (getenv('DDEV_PROJECT') ?: 'default'),
// Backed by the per-project upsun-cache volume in docker-compose.upsun.yaml
'PLATFORM_CACHE_DIR' => '/mnt/ddev-upsun-cache',
'PLATFORM_TREE_ID' => $this->generateTreeId(),
];
}
Expand Down