From 2f927af52a26e0816902a1419adbf537e355f554 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 11 Feb 2018 15:19:57 -0400 Subject: show example why atomicDirSync needs to be separate property --- src/Propellor/Property/Atomic.hs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/Propellor/Property/Atomic.hs') 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/example.com" +-- > (\d -> Git.pulled "joey" "http://.." d Nothing) +-- > `onChange` (webServerRestart `before` atomicDirSync "/srv/web/example.com") atomicDirSync :: FilePath -> Property (DebianLike + ArchLinux) atomicDirSync d = syncDir (activeAtomicResource rp) (inactiveAtomicResource rp) where -- cgit v1.2.3