path: root/src/Propellor/Property/Atomic.hs
diff options
authorJoey Hess2018-02-11 15:19:57 -0400
committerJoey Hess2018-02-11 15:19:57 -0400
commit2f927af52a26e0816902a1419adbf537e355f554 (patch)
tree57ff55f8ec14d71efc5d94781ee2801279dcc8f9 /src/Propellor/Property/Atomic.hs
parentad459e89bc9b91b7c01e3a700b2306bb0d08712c (diff)
show example why atomicDirSync needs to be separate property
Diffstat (limited to 'src/Propellor/Property/Atomic.hs')
1 files changed, 11 insertions, 1 deletions
diff --git a/src/Propellor/Property/Atomic.hs b/src/Propellor/Property/Atomic.hs
index cbbcfdef..5db17474 100644
--- a/src/Propellor/Property/Atomic.hs
+++ b/src/Propellor/Property/Atomic.hs
@@ -144,7 +144,17 @@ checkDirLink d rp = liftIO $ do
-- Using atomicDirSync in the above example lets git only download
-- the changes once, rather than the same changes being downloaded a second
-- time to update the other copy of the directory the next time propellor
--- runs.
+-- runs
+-- Suppose that a web server program is run from the git repository,
+-- and needs to be restarted after the pull. That restart should be done
+-- after the atomicDirUpdate, but before the atomicDirSync. That way,
+-- the old web server process will not have its files changed out from
+-- under it.
+-- > & atomicDirUpdate "/srv/web/"
+-- > (\d -> Git.pulled "joey" "http://.." d Nothing)
+-- > `onChange` (webServerRestart `before` atomicDirSync "/srv/web/")
atomicDirSync :: FilePath -> Property (DebianLike + ArchLinux)
atomicDirSync d = syncDir (activeAtomicResource rp) (inactiveAtomicResource rp)