My second real post
« Wednesday, April 10, 2013 »

Initial

Hard to say but having a static blog does really sounds great. In the long run, it might be easier to maintain and deploy but for some reasons my current setup isn't working.

On my server, I have a git hook for post-receive

#!/bin/sh
GIT_WORK_TREE=/path/to/dir/mynt-built git checkout -f

I can't say for sure. But I have the feeling that since I didn't create the directory mynt-built. It was failing the checkout. Unfortunately it silently failed and never returned any error.

After creating that folder, it started to work and I added some more code to actually generate the site.

A second update to check that everything is in order.

The post receive failed with workon env. Apparently .bashrc isn't being loaded on post-receive. The workon function isn't available. I replaced it with source. My guess is that source should work.

Source also not found. I then decided to load bash instead of sh. It also failed. I then realized that I wrote source twice…

Now it works and the file is something like that:

1
2
3
4
5
6
#!/bin/bash
# checkout in source
GIT_WORK_TREE=~/source git checkout -f

# Generate in target and serve target with nginx
source ~/.virtualenvs/blog/bin/activate && mynt gen -c ~/source ~/target

It's quite simple and my nginx config file look like this:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
server {
    listen 80;
    server_name blog.vosnax.ru;

    location / {
        try_files $uri $uri/index.html;
        root   /path/to/target;
        index  index.html index.htm;
    }
}

And then to publish new posts, the only thing I have to do is push to my repository.

comments powered by Disqus

Copyright © 2015 Loïc Faure-Lacroix