Skip to content

Instantly share code, notes, and snippets.

@whitequark
Created January 3, 2014 20:00
Show Gist options
  • Save whitequark/8245480 to your computer and use it in GitHub Desktop.
Save whitequark/8245480 to your computer and use it in GitHub Desktop.
Host := www-foo@othalan.whitequark.org
Root := foo
Branch := $(shell git rev-parse HEAD)
# Generic rules
.PHONY:: all clean deps
all:
ocamlbuild -j 8 -use-ocamlfind lib/foo.d.byte
clean:
ocamlbuild -clean
deps:
opam install extlib extunix ssl yojson atdgen type_conv sexplib lwt cohttp cryptokit inspect
# Server-related rules
.PHONY:: sync deploy restart
sync:
rsync -avz $(Host):$(Root)/data/ data/
deploy: all
@test -z "$$(git diff-index --name-only HEAD --)" || (echo "git: local changes present"; false)
git push origin
ssh $(Host) '\
set -e; \
eval `opam config -env`; \
cd $(Root); \
git fetch origin; \
git reset --hard $(Branch); \
make deps; \
make all; \
make restart'
restart:
[ -e cache/foo.pid ] && kill `cat cache/foo.pid` || true
./foo.d.byte -daemon
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment