Skip to content
Peter Wu edited this page Dec 14, 2017 · 2 revisions

deploy script

Deployment of the prototype involved building the public assets, reporter and caddy (for the target OS, Linux).

#!/bin/bash
set -e

if ! [ -e ~/repos/tls-tris ]; then
    git clone https://github.com/cloudflare/tls-tris --single-branch \
        ~/repos/tls-tris
fi
export GOROOT=$(~/repos/tls-tris/_dev/go.sh env GOROOT)
export GOPATH=$PWD/go
PATH="${GOROOT/GOROOT/go}/bin:$GOPATH/bin:$PATH"

if ! [ -e "$GOPATH/src/github.com/gopherjs/gopherjs" ]; then
    go get github.com/gopherjs/gopherjs
fi

# frontend code
make
# reporter backend
GOOS=linux go get github.com/gin-gonic/gin github.com/lib/pq
GOOS=linux make -C ../reporter
# server code (for flashsocketproxy)
CADDY_BUILD_ARGS=-goos=linux make caddy

cat <<EOF
# Now run (with rsync 3.1.0 for --chown):
rsync -avizz caddy mitm.watch:~caddy/ --chown=caddy:caddy
rsync -avizz ../reporter/reporter mitm.watch:~caddy/ --chown=caddy:caddy
rsync -avizz public mitm.watch:~caddy/jssock-server/ --chown=caddy:caddy

# Optional:
rsync -avizz systemd/caddy*.service mitm.watch:/etc/systemd/system/
systemctl enable caddy.service caddy-flashsocketpolicy.service

rsync -avizz systemd/reporter.service mitm.watch:/etc/systemd/system/
systemctl enable reporter.service
EOF
Clone this wiki locally