Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Dynamically deploy resources on Google Compute Engine and install TURN servers for the Hobbit Experience
name: [YOUR NAME]
modules:
turn_pool:
type: REPLICA_POOL
replicaPoolModule:
numReplicas: 1
replicaPoolParams:
v1beta1:
machineType: n1-highmem-2
zone: europe-west1-a
baseInstanceName: turn
disksToCreate:
- boot: true
autoDelete: true
initializeParams:
sourceImage: https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/debian-7-wheezy-v20140926
diskSizeGb: 128
diskType: pd-ssd
initAction: install_turn
networkInterfaces:
- network: default
accessConfigs:
- name: External NAT
type: ONE_TO_ONE_NAT
healthChecks:
- turn_health
envVariables:
REALM:
value: [YOUR REALM]
TURN_VERSION:
value: 4.1.2.1
TURN_SECRET:
value: [YOUR SECRET]
turn_firewall:
type: FIREWALL
firewallModule:
description: allow turn traffic
network: default
allowed:
- IPProtocol: tcp
ports:
- 3478-3479
- 49152-65535
- IPProtocol: udp
ports:
- 3478-3479
- 49152-65535
sourceRanges:
- 0.0.0.0/0
turn_autoscaler:
type: AUTOSCALING
autoscalingModule:
minNumReplicas: 2
maxNumReplicas: 8
targetUtilization: 0.8
signalType: AVG_CPU
targetModule: turn_pool
turn_health:
type: HEALTH_CHECK
healthCheckModule:
port: 3478
path: /
actions:
install_turn:
commands:
- apt-get update
- apt-get -y install gdebi-core
- wget http://turnserver.open-sys.org/downloads/v$TURN_VERSION/turnserver-$TURN_VERSION-debian-wheezy-ubuntu-mint-x86-64bits.tar.gz
- tar -xzf turnserver-*.tar.gz
- gdebi -n coturn*.deb
- cp /etc/turnserver.conf /etc/turnserver.conf.orig
- |
sudo tee -a /etc/turnserver.conf <<-EOF
external-ip=$(curl -s http://queryip.net/ip/)
listening-ip=0.0.0.0
realm=$REALM
fingerprint
lt-cred-mech
use-auth-secret
static-auth-secret=$TURN_SECRET
no-stun
EOF
- service coturn restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment