z, ? | toggle help (this) |
space, → | next slide |
shift-space, ← | previous slide |
d | toggle debug mode |
## <ret> | go to slide # |
c, t | table of contents (vi) |
f | toggle footer |
r | reload slides |
n | toggle notes |
p | run preshow |
master
is always deployablegit push origin master
git.ops.betable.com
post-receive
pokes JenkinsNODE_ENV="test" npm install
make test
git rm ".gitignore"
find * -type f |
git hash-object --stdin-paths -w
git add "."
node_modules
git write-tree
git commit-tree "$TREE" \
-p "$BRANCH_PARENT" -p "$CI_PARENT"
git update-ref \
"refs/heads/ci-$BRANCH-latest" \
"$COMMIT"
git reset --hard
git push --force "origin" \
"$COMMIT:refs/heads/ci-$BRANCH-latest" \
"$COMMIT:refs/tags/build-$BUILD_NUMBER"
deploy service to staging
deploy
flock
(1) to serialize deploysrsyslog
, and a mailing listgit update-ref \
"refs/heads/$BRANCH" "$SHA"
git push --force \
"git@$HOST:$APPLICATION.git" "$BRANCH"
staging-latest
toci-master-latest
for stagingproduction-latest
tostaging-latest
for productionpost-receive
hooks/post-receive
hooks/post-receive
Zero-downtime deploys using SCM_RIGHTS from unix(7) still works
description "betable-id"
start on runlevel [2345]
stop on runlevel [!2345]
respawn
setuid betable-id
setgid betable-id
chdir /usr/local/lib/node_modules/betable-id
env GRAPHITE_HOST="10.47.108.9"
env GRAPHITE_PORT="2003"
env NODE_ENV="staging"
env NODE_PORT="8020"
env NSCA="10.47.108.9"
env STATSD_HOST="10.47.108.9"
env STATSD_PORT="8125"
env STATSD_PREFIX="betable-id"
script
set -e
rm -f "/tmp/betable-id.log"
mkfifo "/tmp/betable-id.log"
(logger -t"betable-id" <"/tmp/betable-id.log" &)
exec >"/tmp/betable-id.log" 2>"/tmp/betable-id.log"
rm "/tmp/betable-id.log"
exec node "bin/betable-id"
end script
Host
headers to node
processes listening on 127.0.0.1X-Forwarded-For
headerlocation / {
error_page 500 502 503 = @https-retry;
proxy_intercept_errors on;
proxy_next_upstream off;
proxy_pass http://https-upstream;
}
location @https-retry {
proxy_intercept_errors off;
proxy_next_upstream off;
proxy_pass http://https-upstream;
proxy_set_header X-Betable-Retry yes;
}
Feb 13 06:26:26 prod02 betable-games: ccbYQHB1xzwqWkjvyKV5i9 > POST /games/REDACTED/bet?access_token=REDACTED HTTP/1.1
Feb 13 06:26:26 prod02 betable-games: ccbYQHB1xzwqWkjvyKV5i9 > Host: games.internal.betable.com
Feb 13 06:26:26 prod02 betable-games: ccbYQHB1xzwqWkjvyKV5i9 > Connection: close
Feb 13 06:26:26 prod02 betable-games: ccbYQHB1xzwqWkjvyKV5i9 > X-Betable-Client-Id: REDACTED
Feb 13 06:26:26 prod02 betable-games: ccbYQHB1xzwqWkjvyKV5i9 > X-Betable-Request-Id: ccbYQHB1xzwqWkjvyKV5i9
Feb 13 06:26:26 prod02 betable-games: ccbYQHB1xzwqWkjvyKV5i9 > Authorization: Basic REDACTED (client_id: betable)
Feb 13 06:26:26 prod02 betable-games: ccbYQHB1xzwqWkjvyKV5i9 > Content-Type: application/json; charset=utf8
Feb 13 06:26:26 prod02 betable-games: ccbYQHB1xzwqWkjvyKV5i9 > X-Betable-Access-Token: REDACTED
Feb 13 06:26:26 prod02 betable-games: ccbYQHB1xzwqWkjvyKV5i9 > X-Betable-User-Id: REDACTED
Feb 13 06:26:26 prod02 betable-games: ccbYQHB1xzwqWkjvyKV5i9 > X-Forwarded-For: 31.222.179.165
Feb 13 06:26:26 prod02 betable-games: ccbYQHB1xzwqWkjvyKV5i9 > Content-Length: 129
Feb 13 06:26:26 prod02 betable-games: ccbYQHB1xzwqWkjvyKV5i9 >
Feb 13 06:26:26 prod02 betable-games: ccbYQHB1xzwqWkjvyKV5i9 > {
Feb 13 06:26:26 prod02 betable-games: ccbYQHB1xzwqWkjvyKV5i9 > "currency": "GBP",
Feb 13 06:26:26 prod02 betable-games: ccbYQHB1xzwqWkjvyKV5i9 > "economy": "sandbox",
Feb 13 06:26:26 prod02 betable-games: ccbYQHB1xzwqWkjvyKV5i9 > "paylines": [
Feb 13 06:26:26 prod02 betable-games: ccbYQHB1xzwqWkjvyKV5i9 > [
Feb 13 06:26:26 prod02 betable-games: ccbYQHB1xzwqWkjvyKV5i9 > 1,
Feb 13 06:26:26 prod02 betable-games: ccbYQHB1xzwqWkjvyKV5i9 > 1,
Feb 13 06:26:26 prod02 betable-games: ccbYQHB1xzwqWkjvyKV5i9 > 1
Feb 13 06:26:26 prod02 betable-games: ccbYQHB1xzwqWkjvyKV5i9 > ]
Feb 13 06:26:26 prod02 betable-games: ccbYQHB1xzwqWkjvyKV5i9 > ],
Feb 13 06:26:26 prod02 betable-games: ccbYQHB1xzwqWkjvyKV5i9 > "wager": "0.01",
Feb 13 06:26:26 prod02 betable-games: ccbYQHB1xzwqWkjvyKV5i9 > "player_ledger": "REDACTED"
Feb 13 06:26:26 prod02 betable-games: ccbYQHB1xzwqWkjvyKV5i9 > }
ccbYQHB1xzwqWkjvyKV5i9 > POST /games/REDACTED/bet?access_token=REDACTED HTTP/1.1
ccbYQHB1xzwqWkjvyKV5i9 > Host: games.internal.betable.com
ccbYQHB1xzwqWkjvyKV5i9 > Connection: close
ccbYQHB1xzwqWkjvyKV5i9 > X-Betable-Client-Id: REDACTED
ccbYQHB1xzwqWkjvyKV5i9 > X-Betable-Request-Id: ccbYQHB1xzwqWkjvyKV5i9
ccbYQHB1xzwqWkjvyKV5i9 > Authorization: Basic REDACTED (client_id: betable)
ccbYQHB1xzwqWkjvyKV5i9 > Content-Type: application/json; charset=utf8
ccbYQHB1xzwqWkjvyKV5i9 > X-Betable-Access-Token: REDACTED
ccbYQHB1xzwqWkjvyKV5i9 > X-Betable-User-Id: REDACTED
ccbYQHB1xzwqWkjvyKV5i9 > X-Forwarded-For: 31.222.179.165
ccbYQHB1xzwqWkjvyKV5i9 > Content-Length: 129
ccbYQHB1xzwqWkjvyKV5i9 >
ccbYQHB1xzwqWkjvyKV5i9 > {
ccbYQHB1xzwqWkjvyKV5i9 > "currency": "GBP",
ccbYQHB1xzwqWkjvyKV5i9 > "economy": "sandbox",
ccbYQHB1xzwqWkjvyKV5i9 > "paylines": [
ccbYQHB1xzwqWkjvyKV5i9 > [
ccbYQHB1xzwqWkjvyKV5i9 > 1,
ccbYQHB1xzwqWkjvyKV5i9 > 1,
ccbYQHB1xzwqWkjvyKV5i9 > 1
ccbYQHB1xzwqWkjvyKV5i9 > ]
ccbYQHB1xzwqWkjvyKV5i9 > ],
ccbYQHB1xzwqWkjvyKV5i9 > "wager": "0.01",
ccbYQHB1xzwqWkjvyKV5i9 > "player_ledger": "REDACTED"
ccbYQHB1xzwqWkjvyKV5i9 > }
> POST /games/REDACTED/bet?access_token=REDACTED HTTP/1.1
> Host: games.internal.betable.com
> Connection: close
> X-Betable-Client-Id: REDACTED
> X-Betable-Request-Id: ccbYQHB1xzwqWkjvyKV5i9
> Authorization: Basic REDACTED (client_id: betable)
> Content-Type: application/json; charset=utf8
> X-Betable-Access-Token: REDACTED
> X-Betable-User-Id: REDACTED
> X-Forwarded-For: 31.222.179.165
> Content-Length: 129
>
> {
> "currency": "GBP",
> "economy": "sandbox",
> "paylines": [
> [
> 1,
> 1,
> 1
> ]
> ],
> "wager": "0.01",
> "player_ledger": "REDACTED"
> }
< HTTP/1.1 201 Created
<
< {
< "window": [
< [
< "smalls",
< "smalls",
< "smalls"
< ],
< [
< "biggie",
< "biggie",
< "smalls"
< ],
< [
< "smalls",
< "smalls",
< "smalls"
< ]
< ],
< "outcomes": [
< {
< "outcome": "lose",
< "payline": [
< 1,
< 1,
< 1
< ],
< "symbols": [
< "biggie",
< "biggie",
< "smalls"
< ],
< "payout": "0.00",
< "credits": {},
< "progressives": {}
< }
< ],
< "stops": [
< 1,
< 2,
< 1
< ],
< "payout": "0.00",
< "credits": {},
< "progressives": {},
< "currency": "GBP"
< }
164ms
logger
Connect middlewarefunction logger(request, response, next) {
var chunks = []
, end = response.end
, write = response.write
response.write = function (chunk) {
chunks.push(chunk)
write.apply(response, arguments)
}
response.end = function (chunk) {
end.apply(response, arguments)
var log = []
// ...
process.stdout.write(log.join('\n'))
}
}
logger
Connect middlewarenode
standard output and standard errorlogger
(1) standard inputrsyslog
(8)log.ops.betable.com
statsd
statsd
aggregates datagrams into Graphitelogger
(1)rsyslog
(8)statsd