Next: , Previous: , Up: SGBlog  


Installation

SGBlog’s is written on Go and uses its modules. Hopefully you can install it just by running:

$ go get go.stargrave.org/sgblog/cmd/sgblog
$ go get go.stargrave.org/sgblog/cmd/sgblog-comment-add # if you need commenting

Unfortunately by default it uses HTTPS and Go’s third party servers (sum.golang.org, proxy.golang.org) that trust neither CACert.org’s CA (used previously) nor ca.cypherpunks.ru CAs. So either disable their usage and trust that certificate: GOPRIVATE=go.stargrave.org/sgblog, or clone its source code manually and build in place: git://git.stargrave.org/sgblog.git, https://git.stargrave.org/sgblog.git.

For enabling blog availability you have to use HTTP server with CGI interface. Example part of lighttpd’s configuration:

$HTTP["host"] == "blog.example.com" {
  server.document-root = www_dir + "/blog.example.com"
  $HTTP["url"] =~ "^/example" {
    alias.url += ("/example" => "/path/to/sgblog")
    cgi.assign = ("sgblog" => "/path/to/sgblog")
    setenv.add-environment = (
      "SGBLOG_CFG" => "/path/to/example.hjson",
    )
  }
}

And be sure that you have read access to the Git repository, for example by placing lighttpd user into git group.

Example inetd configuration (for phlog):

gopher stream tcp6 nowait lighttpd /path/to/sgblog sgblog -gopher /path/to/gopher.hjson

Example UCSPI-TCP service running under daemontools:

# mkdir -p /var/service/.phlog-ipv6/log
# cd /var/service/.phlog-ipv6

# cat > run <<EOF
#!/bin/sh -e
uid=\`id -u lighttpd\`
gid=\`id -g git\`
addr=2001::123
exec tcpserver -DHR -u $uid -g $gid -l 0 $addr gopher \
  sgblog -gopher /path/to/gopher.hjson
EOF

# cat > log/run <<EOF
#!/bin/sh -e
exec setuidgid whatever-user multilog t ./main
EOF

# chmod -R 755 /var/service/.phlog-ipv6
# mv /var/service/.phlog-ipv6 /var/service/phlog-ipv6

Gemlog uses Gemini protocol that requires TLS usage, that can be achieved with go.cypherpunks.ru/ucspi tools:

exec tcpserver -DRH -u $uid -g $gid -l 0 ::0 1965 \
  tlss -key gemlog.key.pem -cert gemlog.pem \
  sgblog -gemini /home/sgblog/gemlog.hjson 2>&1

For comments workability you have to configure your SMTP server to feed incoming messages to sgblog-comment-add utility. For example, Postfix’es /etc/aliases can contain:

comment: "| /path/to/sgblog-comment-add -git-dir /path/to/blog.git -committer-email comment@blog.example.com"

to run that utility for all comment@ address messages. You must have enough permission to be able to write to Git repository, but Postfix by default runs all that commands from a nobody user. So possibly you will need to setuid that executable give permission for nobody running:

-rwsr-x--- git:nobody sgblog-comment-add

And also do not forget about lighttpd user’s (possibly in git group) read permission permissions. Make sure sgblog-comment-add runs with correctly set -umask (027 by default) for newly created Git objects/files.


Next: Configuration, Previous: Images, Up: SGBlog