Here we will perform our first deployment on DC/OS. We will be starting with the traditional "Hello World Marathon". This will be a simple service that simply prints 'Hello Marathon' to stdout and sleeps for 5 seconds, in an infinite loop. (The code was sourced from https://dcos.io/docs/1.8/usage/marathon/application-basics/)
{
"id": "hello-marathon",
"cmd": "while [ true ] ; do echo 'Hello Marathon' ; sleep 5 ; done",
"cpus": 0.1,
"mem": 10.0,
"instances": 1
}
You should have performed the following steps:
- Deployed an ACS cluster with DC/OS as the orchestrator
- Created an SSH Tunnel into the master node
- Installed the DC/OS CLI
You can follow the instructions here for steps 1 & 2: Installing ACS with DCOS. For step 3, the CLI can be installed via the DC/OS UI.
Perform the following steps to deploy Hello Marathon via the Marathon UI
- Open a browser to http://localhost:8080/#/services/. This is the DC/OS UI. You should see 'No Services Deployed' like below:
- Open a browser to http://localhost:8080/marathon
- Click on 'Create Application'
- Click on JSON Mode in the upper right corner and paste in the hello-marathon application definition above.
- Click 'Create Application'
- You should see the app initially listed as 'Deploying' then 'Running'
In order to see the output of our Hello Marathon, complete the following steps:
- Open a browser to http://localhost:8080/#/services/
- Click on the 'hello-marathon' service
- Click on the 'Tasks' tab and the specific task
- Click on the 'Logs' tab. You should see the following:
We have deployed the app via the Marathon UI. Let's destroy it so we can deploy it via the DC/OS CLI.
- Open a browser to http://localhost:8080/#/services/
- Click on the up arrow next to the hello-world service and choose 'Destroy'
- Click on the 'Destroy Service' button.
It is likely important to note that you must have opened an SSH tunnel to the master node, as well as installed the DC/OS CLI.
In order to deploy the Hello Marathon service via the DC/OS CLI, perform the following steps:
- Either create a new file named 'hello-marathon.json' and paste in the hello-marathon application definition or, if you have cloned this repo, find the location of this file: dcos-primer\marathon\
- Open a cmd prompt
- Navigate to the directory containing 'hello-marathon.json'. On my machine it is: C:\Development\Technologies\DCOS\dcos-primer\marathon
cd C:\Development\Technologies\DCOS\dcos-primer\marathon
4. Type the following to login
dcos auth login
You should see a 'Login successful!' message
5. Type the following to deploy the app
dcos marathon app add hello-marathon.json
You should see a message that states: 'Created deployment someguid'
6. Validate that the service is running like above