Sorry if it has been answered before.
You need mesos-dns.
Start your mysql service on marathon, then mesos-dns will have an entry called
mysql.marathon.mesos regardless of where the service is started you can always
use that URL to resolve the mysql service.
Then you start wordpress and specify that your mysql server is
mysql.marathon.mesos. If you need to setup an env variable in the wordpress
definition you use the env section like:
{
"id": "wordpress",
"cpus": 1,
"mem": 512,
"container": {
"type": "DOCKER",
"docker": {
"image": "wordpress",
"network": "HOST"
}
},
"env": {
"WORDPRESS_DB_HOST": "mysql.marathon.mesos:3306",
}
}
Marathon also allows to add dependencies on startup so you can request
marathon to start the mysql service before starting the wordpress.service.
Search for the Marathon REST API for more information.
Luck!
----------------------------------------
From: "Stefano Bianchi" <[email protected]>
Sent: Wednesday, April 27, 2016 2:53 AM
To: [email protected]
Subject: Re: Launch docker container from Marathon UI
Yes i guess i understood, so when i star a socker container like wordpress
this app could have the need to contact another container as mysql, here
project calico should be an efficient way to make this.
Ok i will try, just to understand, first i run the mysql, then mesos will
allocate it on a certain slave, then i need to run wordpress. How can i specify
where is the mysql container in marathon UI?
2016-04-26 17:48 GMT+02:00 June Taylor <[email protected]>: Stefano,
You would want to search for an appropriate image on Docker Hub. Here is one I
have NO experience with: https://hub.docker.com/_/mysql/
You would then need to learn about how the image is expecting to be
configured, so you can set it up appropriately.
This is not really a fully thought out solution. I assume you're trying to do
this for more of a proof-of-concept, though. So it may be fine for your needs.
Thanks,
June Taylor
System Administrator, Minnesota Population Center
University of Minnesota
On Tue, Apr 26, 2016 at 10:43 AM, Stefano Bianchi <[email protected]>
wrote:
My problem is this, where can i find the mysql container? I have just said to
marathon to rim a wordpress docker container, without specify mysql one. Il
26/apr/2016 17:39, "Aaron Carey" <[email protected]> ha scritto: If you run the
wordpress container on a different host to the mysql container and use --link
on the command line, does that work?
-- Aaron Carey Production Engineer - Cloud Pipeline Industrial Light & Magic
London 020 3751 9150
----------------------------------------
From: Stefano Bianchi [[email protected]]
Sent: 26 April 2016 16:23
To: [email protected]
Subject: RE: Launch docker container from Marathon UI
Hi Aaron
Actually both mesos-dns and calico are running even though these containers im
running are not, yet, using the calico ipaddr specific in json description.
So i guess it is a problem of bridging, i guess simply specify HOST option on
container field in Marathon UI Il 26/apr/2016 16:59, "Aaron Carey"
<[email protected]> ha scritto: --link in docker should really be avoided when
using marathon/mesos as it implies the containers are on the same host, but
this will not always be the case when mesos schedules your containers (also I
think it's being deprecated in docker anyway.. not sure though?).
This problem looks like one of service discovery within the mesos cluster: how
does one service contact the other when it doesn't know which host the other
service may have landed on?
There are several different solutions for service discovery, you can look into
some like Project Calico to offer a network layer to docker or try dns based
solutions like Mesos-dns or Consul (along with mesos-consul). I think marathon
also has some concept of service discovery built in too if you use something
like haproxy.
I hope this helps!
Aaron
-- Aaron Carey Production Engineer - Cloud Pipeline Industrial Light & Magic
London 020 3751 9150
----------------------------------------
From: June Taylor [[email protected]]
Sent: 26 April 2016 15:22
To: [email protected]
Subject: Re: Launch docker container from Marathon UI
Stefano,
The docker run flag --link is intended to connect the container to another
running container. I do not know how this would operate in marathon. Perhaps it
would be an application group which starts up the mysql docker image first,
then the Wordpress docker image after it.
Thanks,
June Taylor
System Administrator, Minnesota Population Center
University of Minnesota
On Tue, Apr 26, 2016 at 9:20 AM, Stefano Bianchi <[email protected]>
wrote: Thanks Rad Gruchalski, actually i'm trying to make a json file that
"translate" this command in marathon:
docker run --name some-wordpress --link some-mysql:mysql -d wordpress
i guess the error is relate to the fact that i'm not specifying --link
some-mysql:mysql
My problem is that i don't know how to do that, i tried to fill environment
variable fields:
Key = link
Value = some-mysql:mysql
But in this way the app does not work as well. How can i configure these env
variables?
2016-04-26 16:01 GMT+02:00 Rad Gruchalski <[email protected]>: It
says exactly what the problem is.
Start a marathon task with correct environment variables in env and you will
be fine.
Best regards,?
Radek Gruchalski
? [email protected]?
de.linkedin.com/in/radgruchalski/
Confidentiality:
This communication is intended for the above-named person and may be
confidential and/or legally privileged.
If it has come to you in error you must take no action based on it, nor must
you copy or show it to anyone; please delete/destroy and inform the sender
immediately.
On Tuesday, 26 April 2016 at 15:56, Stefano Bianchi wrote: jupyter is
working fine.
i tried to run wordpress and i get this error in stderr of mesos:
error: missing WORDPRESS_DB_HOST and MYSQL_PORT_3306_TCP environment variables
Did you forget to --link some_mysql_container:mysql or set an external db
with -e WORDPRESS_DB_HOST=hostname:port?
Some one of you know this issue?
2016-04-26 15:51 GMT+02:00 Stefano Bianchi <[email protected]>:
However thank you so much to all!
2016-04-26 15:22 GMT+02:00 Stefano Bianchi <[email protected]>: i
found the answer by my self sorry if i disturbed you.
2016-04-26 15:19 GMT+02:00 Stefano Bianchi <[email protected]>: Now
that it is running, how can i check the User Interface?
2016-04-26 15:18 GMT+02:00 Stefano Bianchi <[email protected]>: Yes,
now it's running!!! June you are awesome!!!
2016-04-26 15:16 GMT+02:00 Stefano Bianchi <[email protected]>: i
have done these 2 commands, now jupyter is in deploying in marathon, staging in
mesos. Is there some additional configuration needed?
2016-04-26 15:13 GMT+02:00 Stefano Bianchi <[email protected]>: June
i tried to run your json, but the task is waiting, and if starts it failed
immediately.
I guess because i did not type this commands:
echo 'docker,mesos' > /etc/mesos-slave/containerizers
$ echo '5mins' > /etc/mesos-slave/executor_registration_timeout
Could it be the problem?
2016-04-26 15:02 GMT+02:00 Stefano Bianchi <[email protected]>:
Thank you June taylor, it is axactly what i was intending. if it is not
disturbing you, i try jupyter notebook as well, just to make some tests on how
to launch marathon.
stay tuned :)
2016-04-26 14:58 GMT+02:00 Stefano Bianchi <[email protected]>:
thanks haosdent. actually i have run this kind of apps through rest api.
Now i want learn how to laung docker files. I found this exaple:
{ "container": { "type": "DOCKER", "docker": { "network":
"HOST", "image": "group/image" }, "volumes": [ {
"containerPath": "/etc/a", "hostPath": "/var/data/a", "mode":
"RO" }, { "containerPath": "/etc/b", "hostPath":
"/var/data/b", "mode": "RW" } ] } }
I am able to link the correspondent field in the marathon UI with what is
written in this json.
What i need to understand is, what i should write in:
"image": "group/image"
i mean, with what i have to replace group and image?
For instance, if i would run wordpress container on docker hub what i should
put replacing "group/image" ?
2016-04-26 14:30 GMT+02:00 haosdent <[email protected]>: This is
marathon REST API document:
https://mesosphere.github.io/marathon/docs/rest-api.html#post-v2-apps . Usually
we define a task json file and call the rest api.
For example, create tasks.json which content is
```
{
"id": "/test-sleep",
"cmd": "sleep 200"
}
```
And
```
curl -X POST -H "Content-type: application/json"
http://${YOUR_MARATHON_ADDR}:8080/v2/apps -d @tasks.json
```
You could find more field definitions in their document.
On Tue, Apr 26, 2016 at 8:24 PM, Stefano Bianchi <[email protected]>
wrote: Hi guys
i'm trying to follow the instructions on mesosphere documentation, but it is
a little bit unlear for me that i am new to this world.
i' would like to launch a wordpress container, present on docker hub here
https://hub.docker.com/_/wordpress/ , from marathon UI but i don't understand
the mechanism.
I understood that i don't have to specify a command in "Command" field, but
i don't know how to fill the dockers fields in marathon UI to launch wordpress
container.
Could you please help me or tell me where i can find a clearer documentation?
Thanks.
-- Best Regards, Haosdent Huang