summaryrefslogtreecommitdiff
path: root/run.sh
blob: ebddad7b6e0deb12d1d0c948b32f175a3dab61be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/sh
set -e

usage () {
  echo "Usage:
  serve  WORKERS  Serve the site pages
  deploy          Deploy changes to the production server"
}

serve () {
  echo "running in jit"
  go run -tags jit ../. -n ${1:-1} bin/serve.fnl
}

debug () {
  echo "running debug version in jit"
  go run -tags jit ../. -n ${1:-1} -D bin/serve.fnl
}

deploy () {
  # git stash -u
  scp -r bin root@everytea.ru:~/whitetoad.ru/
  scp -r pages root@everytea.ru:~/whitetoad.ru/
  scp -r etc root@everytea.ru:~/whitetoad.ru/
  scp static/* root@everytea.ru:~/whitetoad.ru/static/ || true
  scp -r static/fonts root@everytea.ru:~/whitetoad.ru/static/fonts
  scp forms.fnl root@everytea.ru:~/whitetoad.ru/
  scp lib.fnl root@everytea.ru:~/whitetoad.ru/
  scp macros.fnl root@everytea.ru:~/whitetoad.ru/
  scp dicts.fnl root@everytea.ru:~/whitetoad.ru/
  scp templates.fnl root@everytea.ru:~/whitetoad.ru/
  ssh root@everytea.ru -- systemctl restart whitetoad
  # git stash pop
}

cmd="$1"
[ -z "$cmd" ] || [ "$cmd" = "-h" ] || [ "$cmd" = "--help" ]  && usage && exit 1
shift
"$cmd" "$@"