yp-engineering/rundeck-docker-plugin

MemFs::IO:Class (NoMethodError) error

Closed this issue · 6 comments

Hi,

I'm trying to get this plugin working in our env, and am encountering an error that I'm not exactly sure how to resolve. When running a Rundeck Job with a single Docker step, it is failing with the error below. In the job step, I selected a docker image that I know is already present on the docker server (centos:7). The target node for job execution is the docker host specified in my resource definition below.

Hoping I just need a nudge in the right direction to get across the finish line to seeing this working. Thanks!

On the Rundeck Server, I installed Ruby + required gems + mesos-runonce prereqs:

ruby -v

ruby 2.0.0p598 (2014-11-13) [x86_64-linux]

gem list

*** LOCAL GEMS ***
bigdecimal (1.2.0)
docker-api (1.33.2)
excon (0.54.0)
io-console (0.4.2)
json (1.7.7)
memfs (1.0.0)
psych (2.0.0)
rdoc (4.0.0)

uname -a

Linux apsrd7130.uhc.com 3.10.0-327.36.1.el7.x86_64

ERROR:
Excon::Error::Socket - private method `select' called for MemFs::IO:Class (NoMethodError)
Failed: NonZeroResultCode: Script result code was: 3

My resource definition:

My project config:
project.plugin.WorkflowNodeStep.docker.docker_config_json=keys/docker/docker

The config.json that is loaded into my key store as a private key:
{
"version":"1.0.0",

    "nodes":{
            "RD_NODE_NAME":{
                    "docker":{
                            "ca.pem":"ca.pem contents joined by '\n' E.g. -----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----",
                            "cert.pem":"cert.pem contents joined by '\n' E.g. -----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----",
                            "key.pem":"key.pem contents joined by '\n' E.g. -----BEGIN RSA PRIVATE KEY-----\n...\n-----END RSA PRIVATE KEY-----"
                    }
            }
    },

    "global":{
            "mesos":{
                    "principal":"principal",
                    "secret":"secret"
            },
            "secret_storage":{
                    "username":"username",
                    "password":"password"
            },
            "docker":{
                    "ssl_verify_peer": false,
                    "private_key_pass": "password_for_ssl_private_key",
                    "config.json":{
                            "auths":{
                                    "docker.company.com":{
                                            "username":"xxUSERxx",
                                            "password":"xxPASSxx"
                                    }
                            }
                    }
            }
    }

}

Hey there!

That is a very odd error indeed. Did you specify a Resource model for your project as well? Are you desiring to run against docker or mesos nodes?

In the meantime, I will take a look at the error which is coming from the excon gem which docker-api gem depends on.

Glad you have taken an interest in this and I am more than happy to get you over the finish line!

Seems to be a bug in memfs 1.0.0 + excon.

The following has been tested to be working:

RD_NODE_DOCKERPLUGINTYPE=docker \
RD_NODE_HOSTNAME=/var/run/docker.sock \
RD_NODE_PROTOCOL=unix \
RD_CONFIG_DOCKER_IMAGE=alpine \
RD_CONFIG_DOCKER_COMMAND=ls \
ruby ./docker/contents/rundeck-docker-plugin

System setup:

ruby -v && \
  which docker && \
  docker info 2>/dev/null | \
  grep -E "Server Ver" && \
  gem list "excon|memfs|docker-api"

ruby 2.0.0p648 (2015-12-16 revision 53162) [x86_64-linux]
/usr/bin/docker
Server Version: 1.12.6

*** LOCAL GEMS ***

docker-api (1.33.2)
excon (0.54.0)
memfs (0.5.0)

Did you try the command from my last comment at all to see if it works? Basically downgrade memfs to 0.5.0 and try again if that is easier for you to test.

I downgraded to memfs 0.5.0, and we recieved a better error now :)

Excon::Error::Socket - Connection refused - connect(2) (Errno::ECONNREFUSED)
10:01:25 Failed: NonZeroResultCode: Script result code was: 3

I noticed that my original post did not include my rundeck resource definition... here is a snip:
name="docker" description="docker server" tags="" hostname="HOSTNAME" protocol="tcp" dockerPluginType="docker" port="2375"

Looking at my target host above, it appears that it is not listening on port port 2375, and dockerd was not running.

After starting the dockerd service using:
sudo dockerd -H tcp://IP:2375

We had success!

Rundeck log:
Container 'centos:7' started with command: env on host: tcp://DOCKERSERVER:2375 with name: /focused_pare.
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
HOSTNAME=359d7a2076a1
FOO=123
BAR=ABC
HOME=/root
Removing container...
Done removing container.

Thanks for the support!

Any future plans/enhancements for this plugin?

@fellenberger sweetness!

I am not actively using it anymore, so my head really isn't in what features / enhancements may be needed. If you can think of any, feel free to open issues or submit PRs for them.

Have a good one.