git-sync: git-sync not working with Hugo.

I tried the demo setup and played around a bit with the files.

There seems to be an issue with the git-sync writing the checked out files resulting in a SystemEvent: REMOVE in Hugo resulting in an empty website. Manually editing the files from the git-sync container works.

My current setup is with Hugo --verboseLog=true enabled.

Steps taken:

  1. Have a git repo with a few .md files
  2. Launch the pod Expected The website is displayed with all the pages Actual result Just as expected Hugo Logs
$ kubectl logs my-hugo-pod-kgijd hugo -f
+ '[' '!' -d /src/git/site/themes ']'
+ ln -s /themes /src/git/site/themes
++ eval echo server '--source=${HUGO_SRC}' '--theme=${HUGO_THEME}' '--buildDrafts=${HUGO_BUILD_DRAFT}' '--baseUrl=${HUGO_BASE_URL}' --watch '--destination=${HUGO_DEST}' --appendPort=false --log --verbose '--verboseLog=${HUGO_VERBOSE_LOG}'
+++ echo server --source=/src/git/site --theme=hugo-theme-bootstrap4-blog --buildDrafts=true --baseUrl=minion-address:30258 --watch --destination=/dest --appendPort=false --log --verbose --verboseLog=true
+ hugo server --source=/src/git/site --theme=hugo-theme-bootstrap4-blog --buildDrafts=true --baseUrl=minion-address:30258 --watch --destination=/dest --appendPort=false --log --verbose --verboseLog=true
INFO: 2016/10/26 23:58:42 hugo.go:405: Using config file: /src/git/site/config.toml
INFO: 2016/10/26 23:58:42 hugo.go:517: using a UnionFS for static directory comprised of:
INFO: 2016/10/26 23:58:42 hugo.go:518: Base: /src/git/site/themes/hugo-theme-bootstrap4-blog/static
INFO: 2016/10/26 23:58:42 hugo.go:519: Overlay: /src/git/site/static/
INFO: 2016/10/26 23:58:42 hugo.go:551: syncing static files to /dest/
Started building sites ...
INFO: 2016/10/26 23:58:42 site.go:1489: found taxonomies: map[string]string{"tag":"tags", "category":"categories"}
INFO: 2016/10/26 23:58:42 htmlredirect.go:116: Alias "/tags/themes/page/1" translated to "tags/themes/page/1/index.html"
INFO: 2016/10/26 23:58:42 htmlredirect.go:116: Alias "/tags/go/page/1" translated to "tags/go/page/1/index.html"
INFO: 2016/10/26 23:58:42 htmlredirect.go:116: Alias "/tags/hugo/page/1" translated to "tags/hugo/page/1/index.html"
INFO: 2016/10/26 23:58:42 htmlredirect.go:116: Alias "/tags/templates/page/1" translated to "tags/templates/page/1/index.html"
INFO: 2016/10/26 23:58:42 htmlredirect.go:116: Alias "/tags/development/page/1" translated to "tags/development/page/1/index.html"
INFO: 2016/10/26 23:58:42 htmlredirect.go:116: Alias "/tags/golang/page/1" translated to "tags/golang/page/1/index.html"
INFO: 2016/10/26 23:58:42 htmlredirect.go:116: Alias "/categories/golang/page/1" translated to "categories/golang/page/1/index.html"
INFO: 2016/10/26 23:58:42 htmlredirect.go:116: Alias "/categories/development/page/1" translated to "categories/development/page/1/index.html"
INFO: 2016/10/26 23:58:42 htmlredirect.go:116: Alias "/post/page/1" translated to "post/page/1/index.html"
INFO: 2016/10/26 23:58:42 htmlredirect.go:116: Alias "/page/1" translated to "page/1/index.html"
INFO: 2016/10/26 23:58:42 htmlredirect.go:116: Alias "/page/1" translated to "page/1/index.html"
WARN: 2016/10/26 23:58:42 site.go:2373: "404.html" is rendered empty
Built site for language en:
0 draft content
0 future content
0 expired content
5 pages created
0 non-page files copied
10 paginator pages created
6 tags created
2 categories created
total in 79 ms
WARN: 2016/10/26 23:58:42 hugo.go:568: Skip DataDir: lstat /src/git/site/data: no such file or directory
WARN: 2016/10/26 23:58:42 hugo.go:573: Skip I18nDir: lstat /src/git/site/i18n: no such file or directory
WARN: 2016/10/26 23:58:42 hugo.go:578: Skip LayoutDir: lstat /src/git/site/layouts: no such file or directory
Watching for changes in /src/git/site/{content,static,themes}
WARN: 2016/10/26 23:58:42 hugo.go:568: Skip DataDir: lstat /src/git/site/data: no such file or directory
WARN: 2016/10/26 23:58:42 hugo.go:573: Skip I18nDir: lstat /src/git/site/i18n: no such file or directory
WARN: 2016/10/26 23:58:42 hugo.go:578: Skip LayoutDir: lstat /src/git/site/layouts: no such file or directory
Serving pages from /dest
Web Server is available at //minion-address:30258/ (bind address 127.0.0.1)
Press Ctrl+C to stop
  1. Edit any of the .md files. Expected The file will be seen as changed and the website will be rebuilt with the same number of pages Actual result The website is empty, all the sources are marked as REMOVE in Hugo and and 0 pages get generated. Hugo Logs
INFO: 2016/10/26 23:52:28 hugo.go:703: Received System Events: ["/src/git/site/content/index.md": REMOVE "/src/git/site/content/post/hugoisforlovers.md": REMOVE "/src/git/site/content/post/creating-a-new-theme.md": REMOVE "/src/git/site/content/post/migrate-from-jekyll.md": REMOVE "/src/git/site/content/post/goisforlovers.md": REMOVE "/src/git/site/content/post": REMOVE "/src/git/site/content/post": REMOVE "/src/git/site/content": REMOVE]

Change detected, rebuilding site
2016-10-26 23:52 +0000
Source changed /src/git/site/content/index.md
Source changed /src/git/site/content/post/hugoisforlovers.md
Source changed /src/git/site/content/post/creating-a-new-theme.md
Source changed /src/git/site/content/post/migrate-from-jekyll.md
Source changed /src/git/site/content/post/goisforlovers.md
Source changed /src/git/site/content/post
Source changed /src/git/site/content
INFO: 2016/10/26 23:52:28 htmlredirect.go:116: Alias "/tags/themes/page/1" translated to "tags/themes/page/1/index.html"
INFO: 2016/10/26 23:52:28 htmlredirect.go:116: Alias "/tags/go/page/1" translated to "tags/go/page/1/index.html"
INFO: 2016/10/26 23:52:28 htmlredirect.go:116: Alias "/tags/golang/page/1" translated to "tags/golang/page/1/index.html"
INFO: 2016/10/26 23:52:28 htmlredirect.go:116: Alias "/tags/development/page/1" translated to "tags/development/page/1/index.html"
INFO: 2016/10/26 23:52:28 htmlredirect.go:116: Alias "/tags/hugo/page/1" translated to "tags/hugo/page/1/index.html"
INFO: 2016/10/26 23:52:28 htmlredirect.go:116: Alias "/tags/templates/page/1" translated to "tags/templates/page/1/index.html"
INFO: 2016/10/26 23:52:28 htmlredirect.go:116: Alias "/categories/development/page/1" translated to "categories/development/page/1/index.html"
INFO: 2016/10/26 23:52:28 htmlredirect.go:116: Alias "/categories/golang/page/1" translated to "categories/golang/page/1/index.html"
INFO: 2016/10/26 23:52:28 htmlredirect.go:116: Alias "/post/page/1" translated to "post/page/1/index.html"
INFO: 2016/10/26 23:52:28 htmlredirect.go:116: Alias "/page/1" translated to "page/1/index.html"
INFO: 2016/10/26 23:52:28 htmlredirect.go:116: Alias "/page/1" translated to "page/1/index.html"
WARN: 2016/10/26 23:52:28 site.go:2373: "404.html" is rendered empty
Built site for language en:
0 draft content
0 future content
0 expired content
0 pages created
0 non-page files copied
9 paginator pages created
6 tags created
2 categories created
total in 47 ms

Manually editing the files Works In a separate test case, if I ssh into the git-sync container and manually edit the files, Hugo correctly sees the file as modified and regenerates the correct number of pages.

Hugo Logs

INFO: 2016/10/27 00:01:07 hugo.go:703: Received System Events: ["/src/git/site/content/post/hugoisforlovers.md": WRITE]

Change detected, rebuilding site
2016-10-27 00:01 +0000
Source changed /src/git/site/content/post/hugoisforlovers.md
INFO: 2016/10/27 00:01:07 site.go:1096: rereading /src/git/site/content/post/hugoisforlovers.md
INFO: 2016/10/27 00:01:07 site.go:1489: found taxonomies: map[string]string{"tag":"tags", "category":"categories"}
INFO: 2016/10/27 00:01:07 htmlredirect.go:116: Alias "/tags/templates/page/1" translated to "tags/templates/page/1/index.html"
INFO: 2016/10/27 00:01:07 htmlredirect.go:116: Alias "/tags/hugo/page/1" translated to "tags/hugo/page/1/index.html"
INFO: 2016/10/27 00:01:08 htmlredirect.go:116: Alias "/tags/development/page/1" translated to "tags/development/page/1/index.html"
INFO: 2016/10/27 00:01:08 htmlredirect.go:116: Alias "/tags/themes/page/1" translated to "tags/themes/page/1/index.html"
INFO: 2016/10/27 00:01:08 htmlredirect.go:116: Alias "/tags/go/page/1" translated to "tags/go/page/1/index.html"
INFO: 2016/10/27 00:01:08 htmlredirect.go:116: Alias "/tags/golang/page/1" translated to "tags/golang/page/1/index.html"
INFO: 2016/10/27 00:01:08 htmlredirect.go:116: Alias "/categories/development/page/1" translated to "categories/development/page/1/index.html"
INFO: 2016/10/27 00:01:08 htmlredirect.go:116: Alias "/categories/golang/page/1" translated to "categories/golang/page/1/index.html"
INFO: 2016/10/27 00:01:08 htmlredirect.go:116: Alias "/post/page/1" translated to "post/page/1/index.html"
INFO: 2016/10/27 00:01:08 htmlredirect.go:116: Alias "/page/1" translated to "page/1/index.html"
INFO: 2016/10/27 00:01:08 htmlredirect.go:116: Alias "/page/1" translated to "page/1/index.html"
WARN: 2016/10/27 00:01:08 site.go:2373: "404.html" is rendered empty
Built site for language en:
0 draft content
0 future content
0 expired content
5 pages created
0 non-page files copied
10 paginator pages created
6 tags created
2 categories created
total in 82 ms

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 17 (8 by maintainers)

Most upvoted comments

you should be able to inotify on the symlink itself - hugo might want to learn how to do that.

In my view it shouldn’t be used to update applications in production (maybe in dev), but to update data used by an application and separating concerns (ssh + git) into their own container.

People can push markdown in the git repo and the site will get regenerated on our side too. It’s just another way to do it. Wasn’t pushing for it being the better solution, just a workaround until this gets cleared up.