Spin up a drachtio server on AWS in seconds!

I just created an AMI image on AWS for drachtio server. Why I did not think of doing this sooner, I do not know.

You can find it under Community AMIs by searching for "drachtio" in either the us-east-1 region (N. Virginia) or eu-west-2 (London). If you want it in a different region either email me (daveh at drachtio.org) or DM me on Twitter (davehorton), and I will gladly copy it over to whichever region you want to use it.

The specific AMI name is drachtio v0.8.2 on ubuntu 18.04

What you get is an Ubuntu 18.04 server with ENA enabled, that has:

  • a drachtio server instance (v0.8.2) running on port 5060 (udp and tcp), and automatically listens on the instance's public IP address, and
  • node.js v10.16.0 (latest LTS release as of this writing) installed and ready to run your drachtio apps.

In other words, one click and you have an up-to-date drachtio server ready to go!

If you want to listen on other ports than 5060, and/or add support for other protocols such as wss, just edit the systemd init script accordingly. It looks like this:

#/etc/systemd/system/drachtio.service
[Unit]
Description=drachtio
After=syslog.target network.target local-fs.target

[Service]
; service
Type=forking
ExecStartPre=/bin/sh -c 'systemctl set-environment LOCAL_IP=`curl -s http://169.254.169.254/latest/meta-data/local-ipv4`'
ExecStartPre=/bin/sh -c 'systemctl set-environment PUBLIC_IP=`curl -s http://169.254.169.254/latest/meta-data/public-ipv4`'
ExecStart=/usr/local/bin/drachtio --daemon --contact sip:${LOCAL_IP};transport=udp,tcp --external-ip ${PUBLIC_IP} --address ${LOCAL_IP}
TimeoutSec=15s
Restart=always
; exec
User=root
Group=daemon
LimitCORE=infinity
LimitNOFILE=100000
LimitNPROC=60000
;LimitSTACK=240
LimitRTPRIO=infinity
LimitRTTIME=7000000
IOSchedulingClass=realtime
IOSchedulingPriority=2
CPUSchedulingPolicy=rr
CPUSchedulingPriority=89
UMask=0007

[Install]
WantedBy=multi-user.target

Just change the command line options for specifying contacts as described here