version: '2.1' services: redis: image: autopilotpattern/redis:${TAG:-latest} mem_limit: 4g # Joyent recommends setting instances to always restart on Triton restart: always labels: - triton.cns.services=redis # This label sets the CNS name, Triton's automatic DNS # Learn more at https://docs.joyent.com/public-cloud/network/cns - com.joyent.package=g4-general-4G # This label selects the proper Joyent resource package # https://www.joyent.com/blog/optimizing-docker-on-triton#ram-cpu-and-disk-resources-for-your-containers environment: - CONTAINERPILOT=file:///etc/containerpilot.json - affinity:com.docker.compose.service!=~redis # This helps distribute Redis instances throughout the data center # Learn more at https://www.joyent.com/blog/optimizing-docker-on-triton#controlling-container-placement env_file: _env network_mode: bridge ports: - 6379 - 26379 # These port delcarations should not be made for production. Without these declarations, Redis # will be available to other containers via private interfaces. With these declarations, Redis is # also accessible publicly. This will also result in a public redis CNS record being created, # in the triton.zone domain. # Consul acts as our service catalog and is used to coordinate global state among # our Redis containers consul: image: autopilotpattern/consul:0.7.2-r0.8 command: > /usr/local/bin/containerpilot /bin/consul agent -server -bootstrap-expect 1 -config-dir=/etc/consul -ui-dir /ui # Change "-bootstrap" to "-bootstrap-expect 3", then scale to 3 or more to # turn this into an HA Consul raft. restart: always mem_limit: 128m ports: - 8500 # As above, this port delcarations should not be made for production. labels: - triton.cns.services=redis-consul network_mode: bridge webserver: image: autopilotpattern/redis-example-webserver:1.0.0 restart: always mem_limit: 128m ports: - 8000 env_file: _env network_mode: bridge