raceweb wisdom

personal documentation site

links

plugins

table of contents

generates a table of contents for a page based on nested header tags in the content
toc plugin

view count data

maintains view count and last viewed date in metadata
view count plugin

run it

local

$ bundle exec rackup config.ru

local with docker

$ docker build -t wisdom-web .
$ docker run -d -v ~/Development/nesta/wisdom-content:/wisdom-content -p 3001:3001 --name ww wisdom-web

on vultr

  1. create docker image and push it to gitlab
$ docker login registry.gitlab.com
$ docker build -t registry.gitlab.com/adamlawr/wisdom:20200603 .
$ docker push registry.gitlab.com/adamlawr/wisdom:20200603
  1. run it from the server
$ ssh vultr1
$ docker run -d -v /wisdom-content:/wisdom-content -p 3001:3001 --name wisdom_web registry.gitlab.com/adamlawr/wisdom:20200603

manage content

  1. make an ssh alias for the server edit ~/.ssh/config with a section like this:
Host linode
    Hostname 45.56.87.13
    User root
    IdentityFile /Users/adam/.ssh/linode_rsa
  1. make a keypair and upload the public key
$ ssh-keygen
...
$ ssh-copy-id -i ~/.ssh/linode_rsa root@45.56.87.13
  1. create a bare repository for the content and a target directory for the hook to check out content to.
$ ssh linode
$ git init --bare /wisdom-content.git
$ mkdir /wisdom-content
  1. create a post-recieve hook to checkout the content
# /wisdom-content.git/hooks/post-receive

#!/bin/sh

while read oldrev newrev refname
do
    # Get the name of the current branch
    branch=$(git rev-parse --symbolic --abbrev-ref $refname)

    # Checkout master branch
    if [ "$branch" = "master" ]; then
      git --work-tree=/wisdom-content --git-dir=/wisdom-content.git checkout -f master
    fi
done
  1. make it executable
    $ chmod +x /wisdom-content.git/hooks/post-receive

manage content

  1. add a git remote for the bare repo on the server
$ git remote add linode ssh://linode/wisdom-content.git
  1. use a text editor to edit markdown content in a local repo
  2. push content to the server with git
$ git push linode