Skip to content

fix(compose): keep DAG mounts writable#2245

Merged
yohamta0 merged 2 commits into
mainfrom
fix/compose-writable-dags
Jun 1, 2026
Merged

fix(compose): keep DAG mounts writable#2245
yohamta0 merged 2 commits into
mainfrom
fix/compose-writable-dags

Conversation

@yohamta0

@yohamta0 yohamta0 commented Jun 1, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • keep Docker Compose DAG bind mounts writable so Dagu can seed first-run examples and save DAG edits
  • document when to opt into read-only DAG sources
  • add packaging regression coverage for Compose DAG mount writability

Testing

  • go test ./internal/packaging -count=1
  • docker compose -f deploy/docker/compose.minimal.yaml config
  • docker compose -f deploy/docker/compose.prod.yaml config
  • live Docker Compose smoke with a local image: verified Tini as PID 1, writable DAG mount, seeded examples/souls, HTTP 200, no read-only filesystem errors, and no zombie processes

Summary by cubic

Keep Docker Compose DAG mounts writable so Dagu can seed first-run examples and persist DAG edits.

  • Bug Fixes
    • Removed :ro from ./dags mounts in deploy/docker/compose.minimal.yaml and deploy/docker/compose.prod.yaml.
    • Documented when to opt into read-only DAG sources in deploy/docker/README.md.
    • Added regression test that forbids :ro and verifies expected mount counts (1 in minimal, 4 in prod) across services.

Written for commit 65e631b. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • Documentation

    • Enhanced Docker deployment documentation to clarify DAG file mounting and persistence behavior.
  • Configuration Changes

    • Updated Docker Compose configurations to mount DAG directories as writable by default, enabling persistent DAG edits across container restarts.
  • Tests

    • Added automated verification tests for DAG mount persistence in Docker deployments.

@coderabbitai

coderabbitai Bot commented Jun 1, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This PR updates Docker Compose configurations to mount the DAG directory as read-write instead of read-only, enabling first-run seeding and persistent DAG edits. Documentation explains the mount behavior, and a test verifies the configuration change persists.

Changes

Docker DAG mounts made writable

Layer / File(s) Summary
Docker Compose configuration updates
deploy/docker/compose.minimal.yaml, deploy/docker/compose.prod.yaml
The ./dags volume binding is changed from read-only (:ro suffix removed) to writable across the minimal stack and four production services (dagu-coordinator, dagu-scheduler, dagu-server, dagu-worker).
Documentation and test verification
deploy/docker/README.md, internal/packaging/container_init_test.go
README documents that DAG mounts are read-write for seeding and edit persistence; TestDockerComposeDAGMountsStayWritable verifies both compose files mount DAGs writable by checking for absence of :ro mode.

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix(compose): keep DAG mounts writable' directly describes the main change—updating Docker Compose configurations to maintain writable DAG mounts.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The pull request description comprehensively covers all required sections with clear details about changes, testing performed, and implementation.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/compose-writable-dags

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
internal/packaging/container_init_test.go (1)

126-129: ⚡ Quick win

Strengthen coverage by asserting DAG mount count per file.

This currently proves “no :ro + at least one writable mount,” but it won’t catch accidental mount removal from some services in compose.prod.yaml. Assert expected occurrence counts per file.

🔧 Suggested hardening
 func TestDockerComposeDAGMountsStayWritable(t *testing.T) {
 	t.Parallel()

-	files := []string{
-		"deploy/docker/compose.minimal.yaml",
-		"deploy/docker/compose.prod.yaml",
-	}
+	expectedMountCounts := map[string]int{
+		"deploy/docker/compose.minimal.yaml": 1,
+		"deploy/docker/compose.prod.yaml":    4,
+	}

 	root := repoRoot(t)
-	for _, file := range files {
+	for file, expectedCount := range expectedMountCounts {
 		t.Run(file, func(t *testing.T) {
 			t.Parallel()

 			content := readFile(t, filepath.Join(root, file))
 			require.NotContains(t, content, "./dags:/var/lib/dagu/dags:ro", "%s must keep the DAG directory writable for first-run seeding and DAG edits", file)
 			require.Contains(t, content, "./dags:/var/lib/dagu/dags", "%s must mount the local DAG directory", file)
+			require.Equal(t, expectedCount, strings.Count(content, "./dags:/var/lib/dagu/dags"), "%s must keep DAG mounts on all expected services", file)
 		})
 	}
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/packaging/container_init_test.go` around lines 126 - 129, The test
should also assert the expected number of DAG mounts per file to catch
accidental removals: after reading content := readFile(t, filepath.Join(root,
file)) use strings.Count(content, "./dags:/var/lib/dagu/dags") and
require.Equal(t, expectedCount, count, "%s must contain %d DAG mounts", file,
expectedCount) (and optionally assert strings.Count(content,
"./dags:/var/lib/dagu/dags:ro") == 0) — update the test where
require.Contains/NotContains are used to compute count via strings.Count and
compare to the expected occurrence for that compose file.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@internal/packaging/container_init_test.go`:
- Around line 126-129: The test should also assert the expected number of DAG
mounts per file to catch accidental removals: after reading content :=
readFile(t, filepath.Join(root, file)) use strings.Count(content,
"./dags:/var/lib/dagu/dags") and require.Equal(t, expectedCount, count, "%s must
contain %d DAG mounts", file, expectedCount) (and optionally assert
strings.Count(content, "./dags:/var/lib/dagu/dags:ro") == 0) — update the test
where require.Contains/NotContains are used to compute count via strings.Count
and compare to the expected occurrence for that compose file.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7e6d842a-4288-4317-ab3e-f5f3f68efe65

📥 Commits

Reviewing files that changed from the base of the PR and between d5885ef and ac20a7b.

📒 Files selected for processing (4)
  • deploy/docker/README.md
  • deploy/docker/compose.minimal.yaml
  • deploy/docker/compose.prod.yaml
  • internal/packaging/container_init_test.go

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 4 files

Tip: cubic could auto-approve low-risk PRs like this, if it thinks it's safe to merge. Learn more

Re-trigger cubic

@yohamta0 yohamta0 merged commit a8cbe80 into main Jun 1, 2026
11 checks passed
@yohamta0 yohamta0 deleted the fix/compose-writable-dags branch June 1, 2026 11:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant