gocd-contrib / docker-swarm-elastic-agent-plugin

Docker swarm based elastic agents for GoCD
https://www.go.cd
Apache License 2.0
15 stars 17 forks source link

extension failed while requesting for 'go.cd.elastic-agent.server-ping' #28

Closed chatelain-io closed 6 years ago

chatelain-io commented 7 years ago

I cannot get the plugin to work with GoCD server 17.5.0 and plugin version 1.1.4.

I'm getting 2017-06-27 11:51:10,991 DEBUG [132@MessageListener for ServerPingListener] Printer:113 - com.thoughtworks.go.domain.Plugin{configuration={"environment_variables":"","docker_ca_cert":"","docker_uri":"http://192.168.235.30:2375","go_server_url":"https://192.168.235.30:8154/go","docker_client_key":"","max_docker_containers":"10","docker_client_cert":"","auto_register_timeout":"2"}, pluginId=cd.go.contrib.elastic-agent.docker-swarm, id=1} 2017-06-27 11:51:11,001 DEBUG [cancelHungJobThread] GO_MODE_AWARE_TIMER:41 - Server is in active state, Running: class com.thoughtworks.go.server.service.ScheduleService#cancelHungJobs 2017-06-27 11:51:11,012 ERROR [132@MessageListener for ServerPingListener] JMSMessageListenerAdapter:77 - Exception thrown in message handling by listener com.thoughtworks.go.server.messaging.elasticagents.ServerPingListener@333c4971 java.lang.RuntimeException: Interaction with plugin with id 'cd.go.contrib.elastic-agent.docker-swarm' implementing 'elastic-agent' extension failed while requesting for 'go.cd.elastic-agent.server-ping'. Reason: [java.lang.RuntimeException: java.lang.NullPointerException] at com.thoughtworks.go.plugin.access.PluginRequestHelper.submitRequest(PluginRequestHelper.java:41) at com.thoughtworks.go.plugin.access.elastic.ElasticAgentExtension.serverPing(ElasticAgentExtension.java:60) at com.thoughtworks.go.plugin.access.elastic.ElasticAgentPluginRegistry.serverPing(ElasticAgentPluginRegistry.java:49) at com.thoughtworks.go.server.messaging.elasticagents.ServerPingListener.onMessage(ServerPingListener.java:32) at com.thoughtworks.go.server.messaging.elasticagents.ServerPingListener.onMessage(ServerPingListener.java:22) at com.thoughtworks.go.server.messaging.activemq.JMSMessageListenerAdapter.runImpl(JMSMessageListenerAdapter.java:73) at com.thoughtworks.go.server.messaging.activemq.JMSMessageListenerAdapter.run(JMSMessageListenerAdapter.java:53) at java.lang.Thread.run(Thread.java:748) Caused by: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.NullPointerException at com.thoughtworks.go.plugin.infra.FelixGoPluginOSGiFramework.executeActionOnTheService(FelixGoPluginOSGiFramework.java:317) at com.thoughtworks.go.plugin.infra.FelixGoPluginOSGiFramework.doOn(FelixGoPluginOSGiFramework.java:245) at com.thoughtworks.go.plugin.infra.DefaultPluginManager.submitTo(DefaultPluginManager.java:173) at com.thoughtworks.go.plugin.access.PluginRequestHelper.submitRequest(PluginRequestHelper.java:32) ... 7 more Caused by: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.NullPointerException at cd.go.contrib.elasticagents.dockerswarm.elasticagent.DockerPlugin.handle(DockerPlugin.java:78) at com.thoughtworks.go.plugin.infra.DefaultPluginManager$2.execute(DefaultPluginManager.java:178) at com.thoughtworks.go.plugin.infra.DefaultPluginManager$2.execute(DefaultPluginManager.java:173) at com.thoughtworks.go.plugin.infra.FelixGoPluginOSGiFramework.executeActionOnTheService(FelixGoPluginOSGiFramework.java:315) ... 10 more Caused by: java.lang.RuntimeException: java.lang.NullPointerException at cd.go.contrib.elasticagents.dockerswarm.elasticagent.DockerPlugin.refreshInstances(DockerPlugin.java:86) at cd.go.contrib.elasticagents.dockerswarm.elasticagent.DockerPlugin.handle(DockerPlugin.java:58) ... 13 more Caused by: java.lang.NullPointerException at cd.go.contrib.elasticagents.dockerswarm.elasticagent.DockerServices.refreshAll(DockerServices.java:120) at cd.go.contrib.elasticagents.dockerswarm.elasticagent.DockerPlugin.refreshInstances(DockerPlugin.java:84) ... 14 more 2017-06-27 11:51:11,195 DEBUG [consumeBuildCausesThread] GO_MODE_AWARE_TIMER:41 - Server is in active state, Running: class com.thoughtworks.go.server.service.ScheduleService#autoSchedulePipelinesFromRequestBuffer 2017-06-27 11:51:12,195 DEBUG [consumeBuildCausesThread] GO_MODE_AWARE_TIMER:41 - Server is in active state, Running: class com.thoughtworks.go.server.service.ScheduleService#autoSchedulePipelinesFromRequestBuffer

ketan commented 7 years ago

What's the output of docker service ls -q | xargs -I ID docker service inspect ID?

ketan commented 7 years ago

Also the version of docker you are on.

ketan commented 7 years ago

Note to self:

Suspicion is that this line throws up because service.spec() likely returns a null.

chatelain-io commented 7 years ago

there is no service agent running, I have the same error when the plugin try to create the service.

docker info: Containers: 6 Running: 4 Paused: 0 Stopped: 2 Images: 5 Server Version: 17.03.1-ce Storage Driver: aufs Root Dir: /var/lib/docker/aufs Backing Filesystem: extfs Dirs: 61 Dirperm1 Supported: true Logging Driver: json-file Cgroup Driver: cgroupfs Plugins: Volume: local Network: bridge host macvlan null overlay Swarm: active NodeID: 7i8uqo01tu1yeaycyv5hy43zq Is Manager: true ClusterID: mcdpc9qy0d7egd6rfqga8xdry Managers: 3 Nodes: 4 Orchestration: Task History Retention Limit: 5 Raft: Snapshot Interval: 10000 Number of Old Snapshots to Retain: 0 Heartbeat Tick: 1 Election Tick: 3 Dispatcher: Heartbeat Period: 5 seconds CA Configuration: Expiry Duration: 3 months Node Address: 192.168.235.30 Manager Addresses: 192.168.235.130:2377 192.168.235.230:2377 192.168.235.30:2377 Runtimes: runc Default Runtime: runc Init Binary: docker-init containerd version: 4ab9917febca54791c5f071a9d1f404867857fcc runc version: 54296cf40ad8143b62dbcaa1d90e520a2136ddfe init version: 949e6fa Security Options: apparmor seccomp Profile: default Kernel Version: 4.4.0-81-generic Operating System: Ubuntu 16.04.2 LTS OSType: linux Architecture: x86_64 CPUs: 1 Total Memory: 4.844GiB Name: linux-host1 ID: UGKR:ROVR:4ADY:N7BF:NC5G:LZTN:AEUV:I4K4:G2WT:PTCE:3JYC:XVH2 Docker Root Dir: /var/lib/docker Debug Mode (client): false Debug Mode (server): true File Descriptors: 70 Goroutines: 201 System Time: 2017-06-27T09:41:35.183875939-04:00 EventsListeners: 3 Registry: https://index.docker.io/v1/ Experimental: false Insecure Registries: 127.0.0.0/8 Live Restore Enabled: false

ketan commented 7 years ago

there is no service agent running, I have the same error when the plugin try to create the service.

That makes no sense. The line that's throwing the exception is this, since the line is in a loop, it very clearly implies that there is at least one service that docker.listServices (aka docker service ls) has returned.

Maybe there's a service that pops up and disappears quickly and does not show up in docker service ls; but shows up when the plugin repetitively does the equivalent.

If you add a log statement as the first line in the same loop to print the following and deploy the jar, it might help us debug and put a better fix in.

LOG.info("Service id" + service.id());
LOG.info("Service spec" + service.spec());
LOG.info("Service spec labels" + service.spec().labels());
chatelain-io commented 7 years ago

this is the error I get on agent creation:

2017-06-27 13:57:57,504 ERROR [124@MessageListener for CreateAgentListener] JMSMessageListenerAdapter:77 - Exception thrown in message handling by listener com.thoughtworks.go.server.messaging.elasticagents.CreateAgentListener@5c7d46fb java.lang.RuntimeException: Interaction with plugin with id 'cd.go.contrib.elastic-agent.docker-swarm' implementing 'elastic-agent' extension failed while requesting for 'go.cd.elastic-agent.create-agent'. Reason: [java.lang.RuntimeException: java.lang.NullPointerException] at com.thoughtworks.go.plugin.access.PluginRequestHelper.submitRequest(PluginRequestHelper.java:41) at com.thoughtworks.go.plugin.access.elastic.ElasticAgentExtension.createAgent(ElasticAgentExtension.java:51) at com.thoughtworks.go.plugin.access.elastic.ElasticAgentPluginRegistry.createAgent(ElasticAgentPluginRegistry.java:40) at com.thoughtworks.go.server.messaging.elasticagents.CreateAgentListener.onMessage(CreateAgentListener.java:32) at com.thoughtworks.go.server.messaging.elasticagents.CreateAgentListener.onMessage(CreateAgentListener.java:22) at com.thoughtworks.go.server.messaging.activemq.JMSMessageListenerAdapter.runImpl(JMSMessageListenerAdapter.java:73) at com.thoughtworks.go.server.messaging.activemq.JMSMessageListenerAdapter.run(JMSMessageListenerAdapter.java:53) at java.lang.Thread.run(Thread.java:748) Caused by: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.NullPointerException at com.thoughtworks.go.plugin.infra.FelixGoPluginOSGiFramework.executeActionOnTheService(FelixGoPluginOSGiFramework.java:317) at com.thoughtworks.go.plugin.infra.FelixGoPluginOSGiFramework.doOn(FelixGoPluginOSGiFramework.java:245) at com.thoughtworks.go.plugin.infra.DefaultPluginManager.submitTo(DefaultPluginManager.java:173) at com.thoughtworks.go.plugin.access.PluginRequestHelper.submitRequest(PluginRequestHelper.java:32) ... 7 more Caused by: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.NullPointerException at cd.go.contrib.elasticagents.dockerswarm.elasticagent.DockerPlugin.handle(DockerPlugin.java:78) at com.thoughtworks.go.plugin.infra.DefaultPluginManager$2.execute(DefaultPluginManager.java:178) at com.thoughtworks.go.plugin.infra.DefaultPluginManager$2.execute(DefaultPluginManager.java:173) at com.thoughtworks.go.plugin.infra.FelixGoPluginOSGiFramework.executeActionOnTheService(FelixGoPluginOSGiFramework.java:315) ... 10 more Caused by: java.lang.RuntimeException: java.lang.NullPointerException at cd.go.contrib.elasticagents.dockerswarm.elasticagent.DockerPlugin.refreshInstances(DockerPlugin.java:86) at cd.go.contrib.elasticagents.dockerswarm.elasticagent.DockerPlugin.handle(DockerPlugin.java:55) ... 13 more Caused by: java.lang.NullPointerException at cd.go.contrib.elasticagents.dockerswarm.elasticagent.DockerServices.refreshAll(DockerServices.java:120) at cd.go.contrib.elasticagents.dockerswarm.elasticagent.DockerPlugin.refreshInstances(DockerPlugin.java:84) ... 14 more

I have an other issue where the log file for the plugin is not created. All the other plugin logs works, but for this on I cannot get it work

chatelain-io commented 7 years ago

I got it working on a fresh install of gocd server... but can't figure out why it doesn't work on our server.

remy-tiitre commented 7 years ago

I have the same exception with custom GoCD docker container (I run GoCD Server inside docker container). So there might be some incorrect setup from my part, but the exception seems to be exactly the same. Plugin is 1.1.4, GoCD is 17.8.0 and docker is inside the container and on the host 17.06.1-ce, /var/run/docker.sock has been mapped to GoCD container. I tried to start the GoCD with docker-compose and as service in Swarm. This exception happened on both cases.

bdpiprava commented 7 years ago

@remy-tiitre --- This is not reproducible at our end. I am closing the issue. Feel free to reopen this issue if you are facing this issue consistently.

remy-tiitre commented 7 years ago

Can you make the guide how to setup this plugin with GoCD and its agents inside docker containers. For example, do you need to have to docker client installed inside the container, or its enough to map the /var/run/docker.sock from the host, etc

remy-tiitre commented 7 years ago

Still get the exception when running GoCD server in docker container in a swarm mode:

2017-09-19 13:23:02,331 ERROR [137@MessageListener for ServerPingListener] JMSMessageListenerAdapter:77 - Exception thrown in message handling by listener com.thoughtw
orks.go.server.messaging.elasticagents.ServerPingListener@614140dc
java.lang.RuntimeException: Interaction with plugin with id 'cd.go.contrib.elastic-agent.docker-swarm' implementing 'elastic-agent' extension failed while requesting f
or 'go.cd.elastic-agent.server-ping'. Reason: [java.lang.RuntimeException: java.lang.NullPointerException]
        at com.thoughtworks.go.plugin.access.PluginRequestHelper.submitRequest(PluginRequestHelper.java:42)
        at com.thoughtworks.go.plugin.access.elastic.ElasticAgentExtension.serverPing(ElasticAgentExtension.java:68)
        at com.thoughtworks.go.plugin.access.elastic.ElasticAgentPluginRegistry.serverPing(ElasticAgentPluginRegistry.java:49)
        at com.thoughtworks.go.server.messaging.elasticagents.ServerPingListener.onMessage(ServerPingListener.java:32)
        at com.thoughtworks.go.server.messaging.elasticagents.ServerPingListener.onMessage(ServerPingListener.java:22)
        at com.thoughtworks.go.server.messaging.activemq.JMSMessageListenerAdapter.runImpl(JMSMessageListenerAdapter.java:73)
        at com.thoughtworks.go.server.messaging.activemq.JMSMessageListenerAdapter.run(JMSMessageListenerAdapter.java:53)
        at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.NullPointerException
        at com.thoughtworks.go.plugin.infra.FelixGoPluginOSGiFramework.executeActionOnTheService(FelixGoPluginOSGiFramework.java:318)
        at com.thoughtworks.go.plugin.infra.FelixGoPluginOSGiFramework.doOn(FelixGoPluginOSGiFramework.java:246)
        at com.thoughtworks.go.plugin.infra.DefaultPluginManager.submitTo(DefaultPluginManager.java:162)
        at com.thoughtworks.go.plugin.access.PluginRequestHelper.submitRequest(PluginRequestHelper.java:33)
        ... 7 more
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.NullPointerException
        at cd.go.contrib.elasticagents.dockerswarm.elasticagent.DockerPlugin.handle(DockerPlugin.java:78)
        at com.thoughtworks.go.plugin.infra.DefaultPluginManager$2.execute(DefaultPluginManager.java:167)
        at com.thoughtworks.go.plugin.infra.DefaultPluginManager$2.execute(DefaultPluginManager.java:162)
        at com.thoughtworks.go.plugin.infra.FelixGoPluginOSGiFramework.executeActionOnTheService(FelixGoPluginOSGiFramework.java:316)
        ... 10 more
Caused by: java.lang.RuntimeException: java.lang.NullPointerException
        at cd.go.contrib.elasticagents.dockerswarm.elasticagent.DockerPlugin.refreshInstances(DockerPlugin.java:86)
        at cd.go.contrib.elasticagents.dockerswarm.elasticagent.DockerPlugin.handle(DockerPlugin.java:58)
        ... 13 more
Caused by: java.lang.NullPointerException
        at cd.go.contrib.elasticagents.dockerswarm.elasticagent.DockerClientFactory.docker(DockerClientFactory.java:41)
        at cd.go.contrib.elasticagents.dockerswarm.elasticagent.DockerServices.docker(DockerServices.java:133)
        at cd.go.contrib.elasticagents.dockerswarm.elasticagent.DockerServices.refreshAll(DockerServices.java:117)
        at cd.go.contrib.elasticagents.dockerswarm.elasticagent.DockerPlugin.refreshInstances(DockerPlugin.java:84)
        ... 14 more

The error appears in a log during the startup. And I can't save settings for the plugin, it will fail and the exception in the log is:

Java::JavaLang::RuntimeException (Interaction with plugin with id 'cd.go.contrib.elastic-agent.docker-swarm' implementing 'elastic-agent' extension failed while reques
ting for 'go.plugin-settings.validate-configuration'. Reason: [java.lang.NullPointerException]):
bdpiprava commented 7 years ago

@remy-tiitre --- Please can you provide you plugin-settings and elastic profile for the plugin with sensitive information redacted.

remy-tiitre commented 7 years ago

These exceptions occure even when I have only docker-swarm-elastic-agents added to stock plugins and there is no elastic profile created.

ketan commented 7 years ago

These exceptions occure even when I have only docker-swarm-elastic-agents added to stock plugins and there is no elastic profile created.

The NullPointerException in DockerClientFactory seems to indicate that the plugin is not configured. I've opened #36 to fix this particular issue.

Once you configure the plugin, that exception should go away. If you're seeing a different exception than the one in the stack trace in this comment (https://github.com/gocd-contrib/docker-swarm-elastic-agents/issues/28#issuecomment-330496931), please provide that stacktrace.

bdpiprava commented 7 years ago

@ketan This is already fixed here. I am making new release of plugin.

ketan commented 7 years ago

I don't see the exception being caught and logged differently. This will merely change the NPE to a different exception. Can we catch that exception here ( https://github.com/gocd-contrib/docker-swarm-elastic-agents/blob/master/src/main/java/cd/go/contrib/elasticagents/dockerswarm/elasticagent/DockerPlugin.java#L83) and log it differently

On Tue, Sep 19, 2017 at 7:19 PM Bhupendra notifications@github.com wrote:

@ketan https://github.com/ketan This is already fixed here https://github.com/gocd-contrib/docker-swarm-elastic-agents/blob/master/src/main/java/cd/go/contrib/elasticagents/dockerswarm/elasticagent/PluginRequest.java#L48-L51. I am making new release of plugin.

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/gocd-contrib/docker-swarm-elastic-agents/issues/28#issuecomment-330544950, or mute the thread https://github.com/notifications/unsubscribe-auth/AAApZiqACPcNNUQlayX6XfMKp8gQkRCWks5sj8ZlgaJpZM4OGh3t .

bdpiprava commented 7 years ago

I don't see any point in handling that PluginSettingsNotConfiguredException differently because on that exception plugin sendsPlugin settings is not configured. error message to server.

@ketan WDYT ?

ketan commented 7 years ago

On Tue, Sep 19, 2017 at 7:39 PM Bhupendra notifications@github.com wrote:

I don't see any point in handling that PluginSettingsNotConfiguredException differently because on that exception plugin sendsPlugin settings is not configured. error message to server.

I don't agree, this exception will be bubbled and printed along with a stacktrace. I'm more concerned about the fact that a stacktrace seems to indicate there's an error, when in reality it's not an error, certainly not something that should go un-handled.

remy-tiitre commented 7 years ago

After saving plugin settings I get into log these rows:

2017-09-20 10:01:32,739  INFO [qtp1651945012-33] RequestLog:37 - 10.255.0.2 - - [20/Sep/2017:07:01:32 +0000] "GET /go/api/plugin_images/cd.go.contrib.elastic-agent.docker-swarm/176f84f4804cd55e556170df3ecb88da
cf40d733077e5251b4ea6048a2257d5c HTTP/1.1" 200 -  134
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.

It might be something related to GoCD server setup, as when the server starts up, it gives me the following rows:

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/var/lib/go-server/work/jetty-0.0.0.0-8153-cruise.war-_go-any-/webapp/WEB-INF/lib/slf4j-log4j12-1.7.21.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:onejar:lib/slf4j-log4j12-1.7.21.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
Using log4j configuration from /var/lib/go-server/config/log4j.properties

I do have debug level enabled: GO_SERVER_SYSTEM_PROPERTIES='-Dgo.console.stdout=true -Dplugin.cd.go.contrib.elastic-agent.docker-swarm.log.level=debug'

remy-tiitre commented 7 years ago

But building still doesnt work and it seems that the logging is broken as well. In GoCD log I get the following exception when I start pipeline that has elastic agent applied:

2017-09-20 10:10:54,710 ERROR [133@MessageListener for CreateAgentListener] JMSMessageListenerAdapter:77 - Exception thrown in message handling by listener com.thoughtworks.go.server.messaging.elasticagents.Cr
eateAgentListener@6d2a32bc
java.lang.RuntimeException: Interaction with plugin with id 'cd.go.contrib.elastic-agent.docker-swarm' implementing 'elastic-agent' extension failed while requesting for 'go.cd.elastic-agent.create-agent'. Rea
son: [java.lang.IllegalArgumentException: Invalid size: ]
        at com.thoughtworks.go.plugin.access.PluginRequestHelper.submitRequest(PluginRequestHelper.java:42)
        at com.thoughtworks.go.plugin.access.elastic.ElasticAgentExtension.createAgent(ElasticAgentExtension.java:59)
        at com.thoughtworks.go.plugin.access.elastic.ElasticAgentPluginRegistry.createAgent(ElasticAgentPluginRegistry.java:40)
        at com.thoughtworks.go.server.messaging.elasticagents.CreateAgentListener.onMessage(CreateAgentListener.java:32)
        at com.thoughtworks.go.server.messaging.elasticagents.CreateAgentListener.onMessage(CreateAgentListener.java:22)
        at com.thoughtworks.go.server.messaging.activemq.JMSMessageListenerAdapter.runImpl(JMSMessageListenerAdapter.java:73)
        at com.thoughtworks.go.server.messaging.activemq.JMSMessageListenerAdapter.run(JMSMessageListenerAdapter.java:53)
        at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.RuntimeException: java.lang.IllegalArgumentException: Invalid size:
        at com.thoughtworks.go.plugin.infra.FelixGoPluginOSGiFramework.executeActionOnTheService(FelixGoPluginOSGiFramework.java:318)
        at com.thoughtworks.go.plugin.infra.FelixGoPluginOSGiFramework.doOn(FelixGoPluginOSGiFramework.java:246)
        at com.thoughtworks.go.plugin.infra.DefaultPluginManager.submitTo(DefaultPluginManager.java:162)
        at com.thoughtworks.go.plugin.access.PluginRequestHelper.submitRequest(PluginRequestHelper.java:33)
        ... 7 more
Caused by: java.lang.RuntimeException: java.lang.IllegalArgumentException: Invalid size:
        at cd.go.contrib.elasticagents.dockerswarm.elasticagent.DockerPlugin.handle(DockerPlugin.java:78)
        at com.thoughtworks.go.plugin.infra.DefaultPluginManager$2.execute(DefaultPluginManager.java:167)
        at com.thoughtworks.go.plugin.infra.DefaultPluginManager$2.execute(DefaultPluginManager.java:162)
        at com.thoughtworks.go.plugin.infra.FelixGoPluginOSGiFramework.executeActionOnTheService(FelixGoPluginOSGiFramework.java:316)
        ... 10 more
Caused by: java.lang.IllegalArgumentException: Invalid size:
        at com.google.common.base.Preconditions.checkArgument(Preconditions.java:122)
        at cd.go.contrib.elasticagents.dockerswarm.elasticagent.utils.Size.parse(Size.java:83)
        at cd.go.contrib.elasticagents.dockerswarm.elasticagent.DockerService.requirements(DockerService.java:129)
        at cd.go.contrib.elasticagents.dockerswarm.elasticagent.DockerService.create(DockerService.java:105)
        at cd.go.contrib.elasticagents.dockerswarm.elasticagent.DockerServices.create(DockerServices.java:48)
        at cd.go.contrib.elasticagents.dockerswarm.elasticagent.DockerServices.create(DockerServices.java:33)
        at cd.go.contrib.elasticagents.dockerswarm.elasticagent.executors.CreateAgentRequestExecutor.execute(CreateAgentRequestExecutor.java:39)
        at cd.go.contrib.elasticagents.dockerswarm.elasticagent.DockerPlugin.handle(DockerPlugin.java:56)
        ... 13 more

And the profile is as simple as it can be for testing purposes:

        <profile id="Docker" pluginId="cd.go.contrib.elastic-agent.docker-swarm">
          <property>
            <key>Image</key>
            <value>gocd/gocd-agent-alpine-3.5</value>
          </property>
          <property>
            <key>Command</key>
            <value />
          </property>
          <property>
            <key>Environment</key>
            <value />
          </property>
          <property>
            <key>MaxMemory</key>
            <value />
          </property>
          <property>
            <key>ReservedMemory</key>
            <value />
          </property>
          <property>
            <key>Hosts</key>
            <value />
          </property>
        </profile>
ketan commented 7 years ago

What did you pass in as the memory limits? It looks like parsing that has failed. We have a fix for this issue in the upcoming release. We recommend setting the size using using a an integer and a unit. (512mb, 2gb, etc...)

remy-tiitre commented 7 years ago

As you can see from the sample profile, I left them empty to make the profile as simple as possible. It doesn't say anywhere that they are mandatory. But this seems to have fixed the elastic agent part. It still doesn't work correctly. I get the following errors in my log:

2017-09-20 10:24:54,964 DEBUG [135@MessageListener for CreateAgentListener] DockerPlugin:39 [plugin-cd.go.contrib.elastic-agent.docker-swarm] - Created service ac15c428-abe9-4f62-aa9b-4e8e1980f9b9
2017-09-20 10:25:11,437 ERROR [qtp1651945012-31] BasicAuthenticationFilter:57 - java.nio.file.NoSuchFileException: data/console/e97a7dfea8a667fb4873e380b8718f93.log
2017-09-20 10:25:11,443  WARN [qtp1651945012-31] ServletHandler:628 - /go/files/GoCD-Server/2/Docker-Image/1/Build/cruise-output/console.log
java.lang.IllegalStateException: Committed
        at org.eclipse.jetty.server.Response.resetBuffer(Response.java:1242)
        at javax.servlet.ServletResponseWrapper.resetBuffer(ServletResponseWrapper.java:241)
        at org.eclipse.jetty.servlets.gzip.CompressedResponseWrapper.resetBuffer(CompressedResponseWrapper.java:272)
        at org.eclipse.jetty.servlets.gzip.CompressedResponseWrapper.sendError(CompressedResponseWrapper.java:286)
        at javax.servlet.http.HttpServletResponseWrapper.sendError(HttpServletResponseWrapper.java:158)
2017-09-20 10:25:11,468  WARN [qtp1651945012-31] HttpChannel:396 - /go/files/GoCD-Server/2/Docker-Image/1/Build/cruise-output/console.log?startLineNumber=0
java.lang.IllegalStateException: Committed
        at org.eclipse.jetty.server.Response.resetBuffer(Response.java:1242)
        at javax.servlet.ServletResponseWrapper.resetBuffer(ServletResponseWrapper.java:241)
        at org.eclipse.jetty.servlets.gzip.CompressedResponseWrapper.resetBuffer(CompressedResponseWrapper.java:272)
        at org.eclipse.jetty.servlets.gzip.CompressedResponseWrapper.sendError(CompressedResponseWrapper.java:286)
        at javax.servlet.http.HttpServletResponseWrapper.sendError(HttpServletResponseWrapper.java:158)
2017-09-20 10:25:11,486  WARN [qtp1651945012-31] HttpChannel:482 - Could not send response error 500: java.lang.IllegalStateException: Committed
2017-09-20 10:25:11,494 ERROR [qtp1651945012-20] BasicAuthenticationFilter:57 - java.nio.file.NoSuchFileException: data/console/e97a7dfea8a667fb4873e380b8718f93.log

Like I said, its clean installation and maybe I need to setup the authentication and authorization for that to work.

bdpiprava commented 7 years ago

@remy-tiitre --- server don't know much about plugin configuration. iIt is plugins job to validate the profile. When you create a profile from config.xml server will not ask plugin to validate the profile as it is expensive(depends on plugin) call and it might block config save.

Please use Elastic Profile API or configure the profile through UI: Admin > Elastic Agent Profiles

remy-tiitre commented 7 years ago

I created the Elastic Agent Profile from Admin > Elastic Agent Profiles page and it did not complain about memory settings missing. And That page has only "Docker image:*" marked as mandatory. But it seems that adding memory limist fixed this issue and this task can me closed.