]> sipb.mit.edu Git - ikiwiki.git/blob - doc/forum/ikiwiki_and_big_files.mdwn
(no commit message)
[ikiwiki.git] / doc / forum / ikiwiki_and_big_files.mdwn
1 My website has 214 hand written html, 1500 of pictures and a few, err sorry, 114
2 video files. All this takes around 1.5 GB of disk space at the moment.
3 Plain html files take 1.7 MB and fit naturally into git.
4
5 But what about the picture and video files?
6
7 Pictures are mostly static and rarely need to be edited after first upload, 
8 wasting a megabyte or two after an edit while having them in git doesn't really matter. 
9 Videos on the other hand are quite large from megabytes to hundreds. Sometimes
10 I re-encode them from the original source with better codec parameters and just
11 replace the files under html root so they are accessible from the same URL.
12 So having a way to delete a 200 MB file and upload a new one with same name and access URL
13 is what I need. And it appears git has trouble erasing commits from history, or requires
14 some serious gitfoo and good backups of the original repository.
15
16 So which ikiwiki backend could handle piles of large binary files? Or should I go for a separate
17 data/binary blob directory next to ikiwiki content?
18
19 Further complication is my intention to keep URL compatibility with old handwritten and ikiwiki
20 based site. Sigh, tough job but luckily just a hobby.
21
22 [-Mikko](http://mcfrisk.kapsi.fi)
23
24 ps. here's how to calculate space taken by html, picture and video files:
25
26     ~/www$ unset sum; for size in $( for ext in htm html txt xml log; \
27     do find . -iname "*$ext" -exec stat -c "%s" \{\} \; ; done | xargs ); \
28     do sum=$(( $sum + $size )); done ; echo $sum
29     1720696
30     ~/www$ unset sum; for size in $( for ext in jpg gif jpeg png; \
31     do find . -iname "*$ext" -exec stat -c "%s" \{\} \; ; done | xargs ); \
32     do sum=$(( $sum + $size )); done ; echo $sum
33     46032184
34     ~/www$ unset sum; for size in $( for ext in avi dv mpeg mp4; \
35     do find . -iname "*$ext" -exec stat -c "%s" \{\} \; ; done | xargs ); \
36     do sum=$(( $sum + $size )); done ; echo $sum
37     1351890888
38
39 > One approach is to use the [[plugins/underlay]] plugin to
40 > configure a separate underlay directory, and put the large
41 > files in there. Those files will then be copied to the generated
42 > wiki, but need not be kept in revision control. (Or could be 
43 > revision controlled in a separate repository -- perhaps one using
44 > a version control system that handles large files better than git;
45 > or perhaps one that you periodically blow away the old history to
46 > in order to save space.)
47
48 > BTW, the `hardlink` setting is a good thing to enable if you
49 > have large files, as it saves both disk space and copying time. 
50 > --[[Joey]]
51
52 Can underlay plugin handle the case that source and destination directories
53 are the same? I'd rather have just one copy of these underlay files on the server.
54
55 > No, but enabling hardlinks accomplishes the same effect. --[[Joey]] 
56
57 And did I goof in the setup file since I got this:
58
59     $ ikiwiki -setup blog.setup -rebuild --verbose
60     Can't use string ("/home/users/mcfrisk/www/blog/med") as an ARRAY ref while
61     "strict refs" in use at 
62     /home/users/mcfrisk/bin/share/perl/5.10.0/IkiWiki/Plugin/underlay.pm line 41.
63     $ grep underlay blog.setup 
64         add_plugins => [qw{goodstuff websetup comments blogspam html sidebar underlay}],
65         underlaydir => '/home/users/mcfrisk/bin/share/ikiwiki/basewiki',
66         # underlay plugin
67         # extra underlay directories to add
68         add_underlays => '/home/users/mcfrisk/www/blog/media',
69     $ egrep "(srcdir|destdir)" blog.setup 
70         srcdir => '/home/users/mcfrisk/blog',
71         destdir => '/home/users/mcfrisk/www/blog',
72         # allow symlinks in the path leading to the srcdir (potentially insecure)
73         allow_symlinks_before_srcdir => 1,
74         # directory in srcdir that contains directive descriptions
75
76 -Mikko
77
78 > The plugin seems to present a bad default value in the setup file.
79 > (Fixed in git.) A correct configuration would be:
80
81         add_underlays => ['/home/users/mcfrisk/www/blog/media'],
82         
83 Umm, doesn't quite fix this yet:
84
85     $ ikiwiki -setup blog.setup -v
86     Can't use an undefined value as an ARRAY reference at /home/users/mcfrisk/bin/share/perl/5.10.0/IkiWiki
87     /Plugin/underlay.pm line 44.
88     $ grep underlay blog.setup 
89         add_plugins => [qw{goodstuff websetup comments blogspam html sidebar underlay}],
90         underlaydir => '/home/users/mcfrisk/bin/share/ikiwiki/basewiki',
91         # underlay plugin
92         # extra underlay directories to add
93         add_underlays => ['/home/users/mcfrisk/www/blog/media'],
94     $ ikiwiki --version
95     ikiwiki version 3.20091032
96
97 -Mikko
98
99 > Yeah, I've fixed that in git, but you can work around it with this:
100 > --[[Joey]] 
101         
102         templatedirs => [],