Skip to content

Instantly share code, notes, and snippets.

@gkleiman
Last active October 25, 2017 13:49
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save gkleiman/f66d359b9d55af105adbf973d5b7c8b6 to your computer and use it in GitHub Desktop.
Save gkleiman/f66d359b9d55af105adbf973d5b7c8b6 to your computer and use it in GitHub Desktop.
MesosCon University App Definitions
{
"id": "/constraintstask",
"instances": 10,
"container": {
"type": "MESOS"
},
"cpus": 0.1,
"mem": 128,
"cmd": "sleep 100",
"constraints": [
[
"hostname",
"UNIQUE"
]
]
}
{
"id": "/cputask",
"instances": 1,
"container": {
"type": "MESOS"
},
"cpus": 10,
"mem": 128,
"cmd": "sleep 100"
}
{
"id": "/students/userXX/kuard",
"instances": 1,
"cpus": 0.1,
"mem": 64,
"container": {
"type": "DOCKER",
"docker": {
"image": "gkleiman/checks-demo",
"network": "BRIDGE",
"portMappings": [
{
"name": "http",
"containerPort": 8080,
"hostPort": 0,
"protocol": "tcp"
}
]
}
},
"labels": {
"HAPROXY_GROUP": "external"
}
}
{
"id": "/students/userXX/kuard",
"instances": 1,
"cpus": 0.1,
"mem": 64,
"container": {
"type": "DOCKER",
"docker": {
"image": "gkleiman/checks-demo",
"network": "BRIDGE",
"portMappings": [
{
"name": "http",
"containerPort": 8080,
"hostPort": 0,
"protocol": "tcp"
}
]
}
},
"args": ["--health-fail-next", "3"],
"healthChecks": [
{
"protocol": "MESOS_HTTP",
"portIndex": 0,
"path": "/healthy",
"gracePeriodSeconds": 0,
"intervalSeconds": 5,
"timeoutSeconds": 3,
"maxConsecutiveFailures": 3
}
],
"labels": {
"HAPROXY_GROUP": "external"
}
}
{
"id": "/students/userXX/kuard",
"instances": 1,
"cpus": 0.1,
"mem": 64,
"container": {
"type": "DOCKER",
"docker": {
"image": "gkleiman/checks-demo",
"network": "BRIDGE",
"portMappings": [
{
"name": "http",
"containerPort": 8080,
"hostPort": 0,
"protocol": "tcp"
}
]
}
},
"args": ["--readiness-fail-next", "3"],
"readinessChecks": [
{
"portName": "http",
"intervalSeconds": 30,
"timeoutSeconds": 3,
"protocol": "HTTP",
"path": "/ready"
}
],
"labels": {
"HAPROXY_GROUP": "external"
}
}
# Point the CLI at the right cluster
dcos cluster setup 35.197.107.167
# Install the marathon app
dcos marathon app add < nginx.json
# Show the UI and try and navigate to the "Endpoint" listed
#
# Try and get the public IP of the agent (won't work because curl is not installed)
dcos task exec nginx-demo curl http://169.254.169.254/latest/meta-data/public-ipv4
# Start an interactive session to install curl
dcos task exec -it nginx-demo bash
$ apt-get update
$ apt-get install -y curl
$ curl http://169.254.169.254/latest/meta-data/public-ipv4; echo ""
$ exit
# Try and navigate to the "Endpoint" with the updated public IP
# Update the port that nginx is serving on
$ dcos task exec -it nginx-demo bash
$ vim # won't work
$ apt-get install -y vim
$ vim /etc/nginx/conf.d/default.conf
$ service nginx restart
{
"id": "nginx-demo",
"container": {
"type": "MESOS",
"docker": {
"image": "library/nginx"
}
},
"cmd": "sleep 999999999",
"cpus": 0.2,
"instances": 1,
"acceptedResourceRoles": ["slave_public"]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment