summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregor Kleen <pngwjpgh@users.noreply.github.com>2016-12-08 20:01:13 +0100
committerGregor Kleen <pngwjpgh@users.noreply.github.com>2016-12-08 20:01:13 +0100
commit5711966f8b856f9b0a4326264b84d6e839588d8c (patch)
tree0eca940a96c30d2d12ffd4ac06baba8d2dfdf386
parent64b372cf7ec8795b5061b36baf8505de02397835 (diff)
downloaddirty-haskell.org-5711966f8b856f9b0a4326264b84d6e839588d8c.tar
dirty-haskell.org-5711966f8b856f9b0a4326264b84d6e839588d8c.tar.gz
dirty-haskell.org-5711966f8b856f9b0a4326264b84d6e839588d8c.tar.bz2
dirty-haskell.org-5711966f8b856f9b0a4326264b84d6e839588d8c.tar.xz
dirty-haskell.org-5711966f8b856f9b0a4326264b84d6e839588d8c.zip
Finish git-deploy
-rw-r--r--default.nix9
-rw-r--r--provider/posts/blog/git-deploy.md51
-rw-r--r--src/Site.hs2
3 files changed, 55 insertions, 7 deletions
diff --git a/default.nix b/default.nix
index d9d3c52..629f1bb 100644
--- a/default.nix
+++ b/default.nix
@@ -2,7 +2,14 @@
2}: 2}:
3 3
4rec { 4rec {
5 dirty-haskell = pkgs.stdenv.lib.overrideDerivation (pkgs.haskellPackages.callPackage ./blog.nix {}) 5 haskellPackages = pkgs.haskellPackages.override {
6 overrides = self : super : {
7 hakyll = pkgs.haskell.lib.overrideCabal super.hakyll (drv: {
8 doCheck = false;
9 });
10 };
11 };
12 dirty-haskell = pkgs.stdenv.lib.overrideDerivation (haskellPackages.callPackage ./blog.nix {})
6 (attrs : 13 (attrs :
7 { src = ./.; 14 { src = ./.;
8 shellHook = '' 15 shellHook = ''
diff --git a/provider/posts/blog/git-deploy.md b/provider/posts/blog/git-deploy.md
index 14745a6..af4d29b 100644
--- a/provider/posts/blog/git-deploy.md
+++ b/provider/posts/blog/git-deploy.md
@@ -1,17 +1,58 @@
1--- 1---
2title: dirty-haskell.org´s git-based publication system 2title: dirty-haskell.org´s git-based publication system
3published: 2016-12-08
3tags: Blog Software 4tags: Blog Software
4--- 5---
5 6
6Initially I set up dirty-haskell.org (which is currently powered by [hakyll]()) 7Initially I set up dirty-haskell.org (which is currently powered by [hakyll])
7to [rsync]() the results of compiling up onto my server whenever I intone 8to [rsync] the results of compiling up onto my server whenever I intone
8`dirty-haskell deploy`{.sh}. 9`dirty-haskell deploy`{.sh}.
9 10
10In my ever continuing quest to have my life consist mostly of an array of git 11In my ever continuing quest to have my life consist mostly of an array of git
11repositories however this didn't seem satisfactory. 12repositories however this didn't seem satisfactory.
12Therefore I configured my [gitolite]() instance to automatically compile und 13Therefore I configured my [gitolite] instance to automatically compile und
13publish the current git version whenever I push to `master`. 14publish the current git version whenever I push to `master`.
14 15
16Gitolite provides us with facilities to install [githooks]. Publishing will be
17handled by `post-update`:
18
19~~~{.sh}
20#!/usr/bin/env zsh
21
22touchedMaster=false
23
24for ref ($@); do
25 [[ ${ref} =~ .*/master$ ]] || continue
26
27 touchedMaster=true
28 break
29done
30
31$touchedMaster || exit 0
32
33exec &>(logger --id=$$ -p daemon.info -t dirty-haskell)
34
35tmpDir=$(mktemp -d)
36delTmpDir() {
37 cd /
38 rm -rvf ${tmpDir}
39}
40
41trap delTmpDir EXIT
42
43git clone --branch master --depth 1 --single-branch . ${tmpDir}
44
45cd ${tmpDir}
46nix-shell --run "dirty-haskell build"
47nix-shell --run "dirty-haskell deploy"
48~~~
49
50The script checks if the master branch was moved to a new commit or otherwise
51touched and, if so, clones a copy of the repo to a temporary directory and runs
52hakyll´s deploy command in it, which is set to rsync the compiled version to a
53folder where it´ll be picked up by nginx.
54
15[hakyll]: https://jaspervdj.be/hakyll/ 55[hakyll]: https://jaspervdj.be/hakyll/
16[rsync]: 56[rsync]: https://git.samba.org/rsync.git
17[gitolite]: 57[gitolite]: http://gitolite.com
58[githooks]: http://githooks.com
diff --git a/src/Site.hs b/src/Site.hs
index 6aa50c9..607c33c 100644
--- a/src/Site.hs
+++ b/src/Site.hs
@@ -261,5 +261,5 @@ toFilePath' = (providerDirectory config </>) . toFilePath
261 261
262config :: Configuration 262config :: Configuration
263config = defaultConfiguration { providerDirectory = "provider" 263config = defaultConfiguration { providerDirectory = "provider"
264 , deployCommand = "rsync -av --progress -c --delete-delay -m _site/ gkleen@ymir.yggdrasil.li:/srv/www/dirty-haskell.org/" 264 , deployCommand = "rsync -av --progress -c --delete-delay -m _site/ /srv/www/dirty-haskell.org/"
265 } 265 }