Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swarm mode service #1

Open
guillemsola opened this issue May 6, 2017 · 11 comments
Open

Swarm mode service #1

guillemsola opened this issue May 6, 2017 · 11 comments

Comments

@guillemsola
Copy link

Awesome template!

Is it possible to make this running as a docker Swarm service? If I launch the compose as service I cannot do the docker exec as services seems to run in a different way.

It would be awesome to have this covered in the repo

@ajeetraina
Copy link
Owner

Good catch. The exact command is :

$sudo docker stack deploy -c docker-compose.yml myjmeter

This is for Swarm Mode cluster.

Refer to my blog which clearly explains that :

http://collabnix.com/archives/2708

I will go ahead and update the Readme.

@ajeetraina
Copy link
Owner

I have updated the README.md.

@guillemsola
Copy link
Author

guillemsola commented May 6, 2017

Nice,

Then what I miss is, how do you get with docker ps the container id? I though it was not possible to do a docker exec in Swarm mode

I understand this is the feature that we will need moby/moby#27552

@ajeetraina
Copy link
Owner

ajeetraina commented May 6, 2017 via email

@ajeetraina
Copy link
Owner

ajeetraina commented May 6, 2017 via email

@guillemsola
Copy link
Author

guillemsola commented May 6, 2017

I was trying to use a Swarm service cluster from an azure template to perform a jmeter test with many clients. Your github project gives very good insights but I was struggling to connect with the master jmeter via docker exec as this is not possible with Swarm mode. I will try with the project you have referenced.

As I still confuse a bit between classic swarm and swarm mode this is what I'm using

azureuser@swarmm-master-31109991-0:~$ docker version
Client:
 Version:      17.04.0-ce
 API version:  1.28
 Go version:   go1.7.5
 Git commit:   4845c56
 Built:        Mon Apr  3 18:07:42 2017
 OS/Arch:      linux/amd64

Server:
 Version:      17.04.0-ce
 API version:  1.28 (minimum version 1.12)
 Go version:   go1.7.5
 Git commit:   4845c56
 Built:        Mon Apr  3 18:07:42 2017
 OS/Arch:      linux/amd64
 Experimental: false
azureuser@swarmm-master-31109991-0:~$ docker node ls
ID                           HOSTNAME                           STATUS  AVAILABILITY  MANAGER STATUS
edl0shsmnimcwhdo3069ojxzr    swarmm-master-31109991-1           Ready   Pause         Leader
fyv3wz1g785skf9anl59trg5t    swarmm-agentpublic-31109991000002  Ready   Active
hiorksdmb8y94ifzyaq5ykgyn *  swarmm-master-31109991-0           Ready   Pause         Reachable
qf2346e96d4vzxv5gb221sa05    swarmm-master-31109991-2           Ready   Pause         Reachable
qms6uf6ut9g2frk414y1jiqv6    swarmm-agentpublic-31109991000004  Ready   Active
uz8c0c4zj7e4hxlw16d2u7qdp    swarmm-agentpublic-31109991000003  Ready   Active
azureuser@swarmm-master-31109991-0:~$ docker service ls
ID                  NAME                MODE                REPLICAS            IMAGE
jiecd0kb524e        bar                 replicated          3/3                 jwilder/whoami:latest
jvdlb2cyqwne        alataque_master     replicated          0/1                 ajeetraina/apache-jmeter-master:latest
wmics9kabwuz        foo                 replicated          1/1                 nginx:latest
yjg7u8jdfzys        alataque_slave      global              3/3                 ajeetraina/apache-jmeter-server:latest
azureuser@swarmm-master-31109991-0:~$ docker service ps alataque
ID                  NAME                                       IMAGE                                    NODE                                DESIRED STATE       CURRENT STATE           ERROR               PORTS
si9q167csmnx        alataque_slave.uz8c0c4zj7e4hxlw16d2u7qdp   ajeetraina/apache-jmeter-server:latest   swarmm-agentpublic-31109991000003   Running             Running 13 hours ago
llgxhwo5wvy3        alataque_slave.qms6uf6ut9g2frk414y1jiqv6   ajeetraina/apache-jmeter-server:latest   swarmm-agentpublic-31109991000004   Running             Running 13 hours ago
krehmb64bqj7        alataque_slave.fyv3wz1g785skf9anl59trg5t   ajeetraina/apache-jmeter-server:latest   swarmm-agentpublic-31109991000002   Running             Running 13 hours ago
bfl5e2uc0fq7        alataque_master.1                          ajeetraina/apache-jmeter-master:latest                                       Running             Pending 3 minutes ago
azureuser@swarmm-master-31109991-0:~$

While docker ps shows nothing running on this

azureuser@swarmm-master-31109991-0:~$ docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
azureuser@swarmm-master-31109991-0:~$

Thanks

@ajeetraina
Copy link
Owner

You have 3 master and 3 worker node. Now when you create service, you ensure that you scale them to more number of replicas or mark it mode=global so that you can access it on any one of the node. Under your case, you have more nodes but less replicas.

@guillemsola
Copy link
Author

guillemsola commented May 8, 2017

I see your point!

I created a swarm cluster too big for my needs 😸

So I put the master to be present on every node with replicas: 3 And I saw that it gets replicated. Also noticed that the desired state is Running but the current is Pending. And maybe that is why there is no master container available for exec.

Is this because the entrypoint for the master container is empty and it just exits?

azureuser@swarmm-master-31109991-0:~/jmeter-docker/apache-jmeter-master$ docker service ps alataque
ID                  NAME                                       IMAGE                                    NODE                                DESIRED STATE       CURRENT STATE           ERROR               PORTS
g07emfynhgve        alataque_slave.fyv3wz1g785skf9anl59trg5t   ajeetraina/apache-jmeter-server:latest   swarmm-agentpublic-31109991000002   Running             Running 8 minutes ago
kij7svbwidei        alataque_slave.uz8c0c4zj7e4hxlw16d2u7qdp   ajeetraina/apache-jmeter-server:latest   swarmm-agentpublic-31109991000003   Running             Running 8 minutes ago
4x4jk7npby3i        alataque_slave.qms6uf6ut9g2frk414y1jiqv6   ajeetraina/apache-jmeter-server:latest   swarmm-agentpublic-31109991000004   Running             Running 8 minutes ago
rnaqlxbatvuo        alataque_master.1                          ajeetraina/apache-jmeter-master:latest                                       Running             Pending 8 minutes ago
d3hqyu1j52an        alataque_master.2                          ajeetraina/apache-jmeter-master:latest                                       Running             Pending 8 minutes ago
m7omr9j7xh2z        alataque_master.3                          ajeetraina/apache-jmeter-master:latest                                       Running             Pending 8 minutes ago

@ajeetraina
Copy link
Owner

ajeetraina commented May 8, 2017 via email

@guillemsola
Copy link
Author

guillemsola commented May 8, 2017

Still struggling with this 🤒

I have left a single swarm master for simplicity

This way the master for sure keeps in the same machine I am. I boot up the compose but the master is in 0/1 which I understand means that has been created and finished

azureuser@swarmm-master-31109991-0:~/jmeter-docker/apache-jmeter-master$ docker service  ls
ID                  NAME                MODE                REPLICAS            IMAGE                                    PORTS
agc60a1oev8s        myjm_master         replicated          0/1                 ajeetraina/apache-jmeter-master:latest   *:0->60000/tcp
mgzlipx2s7u9        registry            replicated          1/1                 registry:2                               *:5000->5000/tcp
tcc6hmmavb0b        myjm_slave          global              1/3                 ajeetraina/apache-jmeter-server:latest   *:0->50000/tcp,*:0->1099/tcp

My guess is that the entrypoint for the master Dockerfile is empty so that the container starts and simply closes. This way it is not possible to do an exec /bin/bash on it

I have tried to create the master with the jmeter parameters to that it starts to perform the test on start but I cannot find the slave IP's with

$ docker inspect --format '{{ .Name }} => {{ .NetworkSettings.IPAddress }}' $(sudo docker ps -a -q)

as suggested as docker ps -a -q returns nothing

Maybe it is possible to refer the containers using the internal docker DNS system?

thanks!

@guillemsola
Copy link
Author

I'm trying with this to found slave IP and pass it in the master image so that it has some entrypoint

docker inspect -f 'myjm_slave.{{.NodeID}}.{{.ID}}' $(docker service ps myjm_slave -q)

Still not working but it sound like a plan to me 😃

What do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants