Docker Community Forums

Share and learn in the Docker community.

Map DNS entry to DockerCloud service end point using Amazon Route 53

dns

(Eric Pugh) #1

I’m deploying a service on DockerCloud, and inside of DockerCloud world, everything works great. However, I want a public URL that points to my service end point. I think i want a CNAME for that. Does anyone have any howto/example in conjunction with Amazon Route 53?

My end point keeps changing, so I think I need to some how update Route 53 from my Docker deploy process…


(Eric Pugh) #2

Okay, here is what we’re doing:

# This script updates OSC DNS information so that [tag].app.dev.o19s.com is mapped
# to this Grandcentral server

echo "Here is DOCKERCLOUD_SERVICE_FQDN: ${DOCKERCLOUD_SERVICE_FQDN}"

if [ -z "$DOCKERCLOUD_SERVICE_FQDN" ]
then
  echo "\$DOCKERCLOUD_SERVICE_FQDN is empty"
else
  echo "\$DOCKERCLOUD_SERVICE_FQDN is NOT empty"


  ./cli53-linux-386 rrcreate --replace dev.o19s.com "*.app CNAME ${DOCKERCLOUD_SERVICE_FQDN}."
fi

(John Thayer) #3

You want to make sure to use the SERVICE endpoint not the CONTAINER endpoint. Container endpoints live and die when you scale. Service endpoints persists through redeploys and scaling events, only changing if you TERMINATE and recreate the stack. Of course if you are terminating and recreating your stack: no luck.

And yes, CNAME in Route 53 is what you want.

Use the *.svc.dockerapp.io name.


(Eric Pugh) #4

Yeah, I think my challenge is the use of “TERMINATE”. I’ve had some wonkiness using redeploy, however, I will look into that more!


(Dusterio) #5

You could write a small script that listens to Docker Cloud events and updates Route53 zones when necessary.

See my example with DC nodes and AWS security groups: https://github.com/PoweredLocal/docker-cloud-aws-sync

Logic would be very, very similar

Since I don’t re-create my services often, I just manually CNAMEd my Route53 records to DC entries at this moment