docker-archive / classicswarm

Swarm Classic: a container clustering system. Not to be confused with Docker Swarm which is at https://github.com/docker/swarmkit
Apache License 2.0
5.76k stars 1.08k forks source link

Powerstrip fails against swarm #619

Closed aanm closed 9 years ago

aanm commented 9 years ago

I know this is too much experimental but it should work since docker-swarm has almost the same endpoints has docker

CONSOLE 1:

mkdir -p $HOME/powerstrip-swarm
cat > $HOME/powerstrip-swarm/adapters.yml << EOF
version: 1
endpoints:
  "POST /*/containers/create":
    pre: [debug]
    post: [debug]
adapters:
  debug: http://debug/extension
EOF

id=$(sudo docker run swarm create)
docker-machine create -d virtualbox --swarm --swarm-master --swarm-discovery=token://$id swarm-master
docker-machine create -d virtualbox --swarm --swarm-discovery=token://$id swarm-01
docker-machine create -d virtualbox --swarm --swarm-discovery=token://$id swarm-02

sudo docker run -d --name powerstrip-debug --expose 80 binocarlos/powerstrip-debug

__OLD_DOCKER_TLS_VERIFY=$DOCKER_TLS_VERIFY
__OLD_DOCKER_CERT_PATH=$DOCKER_CERT_PATH
__OLD_DOCKER_HOST=$DOCKER_HOST
$(docker-machine env --swarm swarm-master)
__SWARM_DOCKER_TLS_VERIFY=$DOCKER_TLS_VERIFY
__SWARM_DOCKER_CERT_PATH=$DOCKER_CERT_PATH
__SWARM_DOCKER_HOST=$DOCKER_HOST
DOCKER_TLS_VERIFY=$__OLD_DOCKER_TLS_VERIFY
DOCKER_CERT_PATH=$__OLD_DOCKER_CERT_PATH
DOCKER_HOST=$__OLD_DOCKER_HOST
sudo docker run -d --name powerstrip \
         -e DOCKER_TLS_VERIFY=$__SWARM_DOCKER_TLS_VERIFY \
         -e DOCKER_CERT_PATH=/swarm \
         -e DOCKER_HOST=$__SWARM_DOCKER_HOST \
         -v $HOME/powerstrip-swarm/adapters.yml:/etc/powerstrip/adapters.yml \
         -v $__SWARM_DOCKER_CERT_PATH:/swarm \
         --link powerstrip-debug:debug \
         -p 2375:2375 \
         clusterhq/powerstrip:v0.0.1

CONSOLE 2:

[aanm@localhost ~]$ DOCKER_HOST=localhost:2375 docker run busybox /bin/echo hello
FATA[0000] EOF

powerstrip-debug logs:

[aanm@localhost ~]$ sudo docker logs powerstrip-debug
server listening on port: 80

-------------------------------------------

Version:          1
Type:             pre-hook
Request:

    Method:      POST
    URL:         /v1.18/containers/create

{
    "Hostname": "",
    "Domainname": "",
    "User": "",
    "Memory": 0,
    "MemorySwap": 0,
    "CpuShares": 0,
    "Cpuset": "",
    "AttachStdin": false,
    "AttachStdout": true,
    "AttachStderr": true,
    "PortSpecs": null,
    "ExposedPorts": {},
    "Tty": false,
    "OpenStdin": false,
    "StdinOnce": false,
    "Env": [],
    "Cmd": [
        "/bin/echo",
        "hello"
    ],
    "Image": "busybox",
    "Volumes": {},
    "WorkingDir": "",
    "Entrypoint": null,
    "NetworkDisabled": false,
    "MacAddress": "",
    "OnBuild": null,
    "Labels": {},
    "HostConfig": {
        "Binds": null,
        "ContainerIDFile": "",
        "LxcConf": [],
        "Memory": 0,
        "MemorySwap": 0,
        "CpuShares": 0,
        "CpusetCpus": "",
        "Privileged": false,
        "PortBindings": {},
        "Links": null,
        "PublishAllPorts": false,
        "Dns": null,
        "DnsSearch": null,
        "ExtraHosts": null,
        "VolumesFrom": null,
        "Devices": [],
        "NetworkMode": "bridge",
        "IpcMode": "",
        "PidMode": "",
        "CapAdd": null,
        "CapDrop": null,
        "RestartPolicy": {
            "Name": "no",
            "MaximumRetryCount": 0
        },
        "SecurityOpt": null,
        "ReadonlyRootfs": false,
        "Ulimits": null,
        "LogConfig": {
            "Type": "",
            "Config": null
        },
        "CgroupParent": ""
    }
}

-------------------------------------------

Version:          1
Type:             post-hook
Request:

    Method:      POST
    URL:         /v1.18/containers/create

{
    "Hostname": "",
    "Domainname": "",
    "User": "",
    "Memory": 0,
    "MemorySwap": 0,
    "CpuShares": 0,
    "Cpuset": "",
    "AttachStdin": false,
    "AttachStdout": true,
    "AttachStderr": true,
    "PortSpecs": null,
    "ExposedPorts": {},
    "Tty": false,
    "OpenStdin": false,
    "StdinOnce": false,
    "Env": [],
    "Cmd": [
        "/bin/echo",
        "hello"
    ],
    "Image": "busybox",
    "Volumes": {},
    "WorkingDir": "",
    "Entrypoint": null,
    "NetworkDisabled": false,
    "MacAddress": "",
    "OnBuild": null,
    "Labels": {},
    "HostConfig": {
        "Binds": null,
        "ContainerIDFile": "",
        "LxcConf": [],
        "Memory": 0,
        "MemorySwap": 0,
        "CpuShares": 0,
        "CpusetCpus": "",
        "Privileged": false,
        "PortBindings": {},
        "Links": null,
        "PublishAllPorts": false,
        "Dns": null,
        "DnsSearch": null,
        "ExtraHosts": null,
        "VolumesFrom": null,
        "Devices": [],
        "NetworkMode": "bridge",
        "IpcMode": "",
        "PidMode": "",
        "CapAdd": null,
        "CapDrop": null,
        "RestartPolicy": {
            "Name": "no",
            "MaximumRetryCount": 0
        },
        "SecurityOpt": null,
        "ReadonlyRootfs": false,
        "Ulimits": null,
        "LogConfig": {
            "Type": "",
            "Config": null
        },
        "CgroupParent": ""
    }
}

Response:

    ContentType: null
    Code:        200

P.S. I make sure busybox was pulled in to the 2 nodes More-info: https://github.com/ClusterHQ/powerstrip/issues/80

abronan commented 9 years ago

Hi @aanm, sorry for the late response: any update on the issue? Went through the issue on Powerstrip and this seems to be related to the use of TLS. Let us know if there is something else we could help on or if we can close it :)

aanm commented 9 years ago

@abronan Oh I forgot to close it, yep, it was related to the use of TLS. Thanks!