Skip to content

Instantly share code, notes, and snippets.

@shirkevich
Last active April 9, 2017 11:29
Show Gist options
  • Select an option

  • Save shirkevich/fec2896c7f5bdbe635b53d5963f6c43f to your computer and use it in GitHub Desktop.

Select an option

Save shirkevich/fec2896c7f5bdbe635b53d5963f6c43f to your computer and use it in GitHub Desktop.
name: "{{FRAMEWORK_NAME}}"
web-url: "http://sidecar-0-companion.{{FRAMEWORK_NAME}}.mesos:{{SIDECAR_PORT}}"
pods:
mongodb:
count: {{MONGODB_COUNT}}
uris:
- "https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-{{MONGODB_VERSION}}.tgz"
- "{{MONGODB_KEY_FILE_URL}}"
- "https://gist.github.com/shirkevich/fec2896c7f5bdbe635b53d5963f6c43f/raw/7f8cf3d035eae9b525f388c84c0d5727853688be/svc-limit.yml"
resource-sets:
mongodb-resources:
cpus: {{MONGODB_CPUS}}
memory: {{MONGODB_MEM}}
ports:
mongodb:
port: {{MONGODB_PORT}}
volume:
path: {{VOLUME_PATH}}
type: {{VOLUME_TYPE}}
size: {{MONGODB_DISK}}
tasks:
init:
resource-set: mongodb-resources
goal: FINISHED
cmd: "env && chmod a+x $MESOS_SANDBOX/config-templates/mongo-init && $MESOS_SANDBOX/config-templates/mongo-init"
configs:
mongo-init:
template: "{{CONFIG_TEMPLATE_PATH}}/create_mongo_user.sh"
dest: "create_mongo_user.sh"
env:
MONGODB_PASSWORD: {{MONGODB_PASSWORD}}
MONGODB_VERSION: {{MONGODB_VERSION}}
MONGODB_PORT: {{MONGODB_PORT}}
VOLUME_PATH: {{VOLUME_PATH}}
server:
resource-set: mongodb-resources
goal: RUNNING
cmd: "env && chmod 600 $MESOS_SANDBOX/keyfile.txt && exec $MESOS_SANDBOX/mongodb-linux-x86_64-{{MONGODB_VERSION}}/bin/mongod --keyFile $MESOS_SANDBOX/keyfile.txt --auth --bind_ip $LIBPROCESS_IP --port {{MONGODB_PORT}} --dbpath {{VOLUME_PATH}} --replSet {{MONGODB_REPLSET}} --wiredTigerEngineConfigString=\"cache_size=200M\""
health-check:
cmd: "curl --fail ${LIBPROCESS_IP}:{{MONGODB_PORT}} > /dev/null"
interval: 30
grace-period: 60
max-consecutive-failures: 5
delay: 5
timeout: 5
sidecar:
count: {{SIDECAR_COUNT}}
uris:
- "https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-{{MONGODB_VERSION}}.tgz"
container:
image-name: {{SIDECAR_IMAGE}}
tasks:
companion:
cpus: {{SIDECAR_CPUS}}
memory: {{SIDECAR_MEM}}
goal: RUNNING
cmd: {{SIDECAR_CMD}}
ports:
sidecar:
port: 4567
env:
APP_NAME: {{SIDECAR_APP_NAME}}
DELAY: {{SIDECAR_DELAY}}
ZK_URL: {{SIDECAR_ZK_URL}}
MESOS_URL: {{SIDECAR_MESOS_URL}}
LOG_LEVEL: {{SIDECAR_LOG_LEVEL}}
MONGODB_PASSWORD: {{MONGODB_PASSWORD}}
MONGODB_REPLSET: {{MONGODB_REPLSET}}
MONGODB_PORT: {{MONGODB_PORT}}
MONGO_PATH: "/mnt/mesos/sandbox/mongodb-linux-x86_64-{{MONGODB_VERSION}}/bin"
PUBLIC_KEY: {{{BACKUP_PUBLIC_KEY}}}
AZURE_STORAGE_ACCOUNT_NAME: {{BACKUP_AZURE_STORAGE_ACCOUNT_NAME}}
AZURE_STORAGE_ACCESS_KEY: {{{BACKUP_AZURE_STORAGE_ACCESS_KEY}}}
AZURE_STORAGE_CONTAINER_NAME: {{BACKUP_AZURE_STORAGE_CONTAINER_NAME}}
plans:
deploy:
strategy: serial
phases:
mongodb-init:
strategy: parallel
pod: mongodb
steps:
- default: [[init]]
mongodb-server:
strategy: serial
pod: mongodb
steps:
- default: [[server]]
sidecar-deploy:
strategy: serial
pod: sidecar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment