docker pull mesosphere/dcos-commons:latest
https://mesosphere.github.io/dcos-commons/
git clone git@github.com:benclarkwood/mesoscon-tutorial.git
or
https://github.com/benclarkwood/mesoscon-tutorial.git
cd mesoscon-tutorial
docker run -it -v $(pwd):/code -w /code mesosphere/dcos-commons:latest
aws configure
https://docs.google.com/document/d/1G8-CccBmmue4qfEDusoAT8cdE-1EVteWA5C5OIe5dXk/
dcos cluster setup <cluster-url>
name: memcache
scheduler:
user: nobody
pods:
hello:
count: 1
tasks:
server:
goal: RUNNING
cmd: echo "Hello, world!"
cpus: 0.1
memory: 256
./build.sh aws
dcos package uninstall --yes memcache --app-id=<your name>
name: memcache
scheduler:
user: nobody
pods:
cache:
count: 3
image: benclarkwood/memcached:0.0.2
tasks:
server:
goal: RUNNING
cmd: memcached
cpus: 1.0
memory: 1024
name: memcache
scheduler:
user: nobody
pods:
cache:
count: 3
image: benclarkwood/memcached:0.0.2
tasks:
server:
goal: RUNNING
cmd: memcached -l $MESOS_CONTAINER_IP -p $MEMCACHE_PORT
cpus: 1.0
memory: 1024
ports:
memcache:
port: 0 # random port
env-key: MEMCACHE_PORT
advertise: true
dcos task exec -it cache-0-server /bin/bash
echo -e 'add my_key 0 300 11\r\nhello world\r' | nc -q 1 $MESOS_CONTAINER_IP $MEMCACHE_PORT
echo -e 'get my_key' | nc -q 1 $MESOS_CONTAINER_IP $MEMCACHE_PORT
name: memcache
scheduler:
user: nobody
pods:
cache:
count: 3
image: benclarkwood/memcached:0.0.2
uris:
- {{BOOTSTRAP_URI}}
tasks:
server:
goal: RUNNING
cmd: ./bootstrap && memcached $(cat memcached.conf)
cpus: 1.0
memory: 1024
configs:
memcache:
template: {{CONFIG_TEMPLATE_PATH}}/memcached.conf
dest: memcached.conf
env:
MEMORY_LIMIT: 1000
ports:
memcache:
port: 0 # random port
env-key: MEMCACHE_PORT
advertise: true
touch src/main/dist/memcached.conf
# Be VERY verbose.
-vv
# Set the memory cap
-m {{MEMORY_LIMIT}}
# Set the TCP port
-p {{MEMCACHE_PORT}}
# Set the UDP port
-U {{MEMCACHE_PORT}}
# Specify which IP address to listen on. The default is to listen on all IP addresses
# This parameter is one of the only security measures that memcached has, so make sure
# it's listening on a firewalled interface.
-l {{MESOS_CONTAINER_IP}}
-l localhost
# Return error when memory is exhausted (rather than removing items)
-M
name: memcache
scheduler:
user: nobody
pods:
cache:
count: 3
image: benclarkwood/memcached:0.0.2
volume:
path: shared
type: ROOT
size: 64
uris:
- {{BOOTSTRAP_URI}}
tasks:
server:
goal: RUNNING
cmd: ./bootstrap && echo $MEMCACHE_PORT > shared/memcache-port && memcached $(cat memcached.conf)
cpus: 1.0
memory: 1024
configs:
memcache:
template: {{CONFIG_TEMPLATE_PATH}}/memcached.conf
dest: memcached.conf
env:
MEMORY_LIMIT: 1000
ports:
memcache:
port: 0 # random port
env-key: MEMCACHE_PORT
advertise: true
flush-cache:
goal: FINISHED
cmd: echo 'flush_all' | nc -q 10 localhost $(cat shared/memcache-port)
cpus: 0.1
memory: 32
plans:
deploy:
phases:
cache:
pod: cache
steps:
- default: [[server]]
flush-all-serial:
phases:
flush:
strategy: serial
pod: cache
steps:
- default: [[flush-cache]]
flush-all-parallel:
phases:
flush:
strategy: parallel
pod: cache
steps:
- default: [[flush-cache]]