Elastic agent registration problem from Windows docker swarm plugin

237 views
Skip to first unread message

IXI

unread,
Nov 3, 2020, 5:29:41 AM11/3/20
to go-cd
We''re trying to deploy windows elastic agents on docker swarm plugin.
According to the documentation, we have created agent-autoregister.properties in the proper place as per our windows container GoCD agent installation on startup.

Whenever we run a pipeline which is tagged to the elastic agent profile, the agent gets started and shows up in static agents instead of elastic.
We''re clueless how to fix this behavior, so any guidance would be really helpful.

Environment:

GoCD server - centos linux 7.7 version 20.7.0
Agent docker image - windows server core 2016 openjdk 
Agent version 20.7.0

Thanks

Aravind SV

unread,
Nov 3, 2020, 11:10:30 AM11/3/20
to IXI, go-cd

Hello,

Elastic agents are not started by users. They’re started automatically, using an elastic agent plugin. If you use one, you won’t need to set agent properties, etc. That’s the whole point of it being elastic, in that it creates an agent when needed and gets rid of it when it’s not needed any more.

You’ll need to create a cluster profile and an elastic agent profile, and associate the job with the elastic agent profile (which you mention you’ve done). Then, when the job needs to run, the information in the profile will be used to create an agent.

https://github.com/gocd-contrib/docker-swarm-elastic-agent-plugin/blob/master/INSTALL.md

Not sure which documentation you’re seeing. Also, I don’t know if the Docker Swarm plugin works on Windows – maybe someone has used it on Windows. I don’t have that experience.

Cheers,
Aravind

Message has been deleted

IXI

unread,
Nov 4, 2020, 1:16:09 AM11/4/20
to go-cd
We followed the documentation and have the necessary things configured.  

We are making the docker image on windows for gocd-agent v20.7 based on the documentation provided - https://docs.gocd.org/current/advanced_usage/agent_auto_register.html  

Dne úterý 3. listopadu 2020 v 17:10:30 UTC+1 uživatel Aravind SV napsal:

Aravind SV

unread,
Nov 4, 2020, 6:21:00 AM11/4/20
to IXI, go-cd

Hello,

I see. You’re creating your own image.

The docker image provided by GoCD (on DockerHub) does this to populate the autoregister.properties file correctly, based on environment variables passed in by the plugin when it wants to start an elastic agent. Do you do that in your image too? The values passed in should be used. That’s how the server / plugin knows that the agent it was waiting for has come up.

Cheers,
Aravind

IXI

unread,
Nov 4, 2020, 7:12:42 AM11/4/20
to go-cd
Yes we do. Is there a way to debug our situation? It seems like a windows container problem.

Dne středa 4. listopadu 2020 v 12:21:00 UTC+1 uživatel Aravind SV napsal:

Sriram Narayanan

unread,
Nov 4, 2020, 7:18:33 AM11/4/20
to go...@googlegroups.com
On Wed, Nov 4, 2020 at 8:12 PM IXI <petr...@gmail.com> wrote:
Yes we do. Is there a way to debug our situation? It seems like a windows container problem.

If your containers are coming up and getting registered as static agents, then the agent startup is likely unable to locate autoregister.properties.

At which path are you installing the go-agent?
You need to create a config sub-directory, and then place the autoregister.properties file there (see https://docs.gocd.org/current/advanced_usage/agent_auto_register.html)

"On the remote GoCD Agent machine, create a file named <agent_installation_directory>/config/autoregister.properties. In a native agent installation this file is usually located on /var/lib/go-agent/config/ directory. The config/ folder might not exist, in this case you should create it by yourself."

-- Ram


 

Dne středa 4. listopadu 2020 v 12:21:00 UTC+1 uživatel Aravind SV napsal:

Hello,

I see. You’re creating your own image.

The docker image provided by GoCD (on DockerHub) does this to populate the autoregister.properties file correctly, based on environment variables passed in by the plugin when it wants to start an elastic agent. Do you do that in your image too? The values passed in should be used. That’s how the server / plugin knows that the agent it was waiting for has come up.

Cheers,
Aravind

--
You received this message because you are subscribed to the Google Groups "go-cd" group.
To unsubscribe from this group and stop receiving emails from it, send an email to go-cd+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/go-cd/b1afe618-8db0-4023-9f12-f6578ddd9c88n%40googlegroups.com.

IXI

unread,
Nov 4, 2020, 9:25:46 AM11/4/20
to go-cd
Yes we do, what you mentioned. Path: C:\Go-Agent\config\autoregister.properties  (please remember that we are doing it on Windows Server 2016 machine)

And just repeating question from my previous answer:  Is there a way to debug our situation? It seems like a windows container problem.  

Dne středa 4. listopadu 2020 v 13:18:33 UTC+1 uživatel srir...@gmail.com napsal:

Jason Smyth

unread,
Nov 4, 2020, 10:30:34 AM11/4/20
to go-cd
Hello,

The host OS is less relevant than the container OS in this situation. What OS is your custom container image based on? This information will likely be necessary to "tunnel" into the container from the host.

For troubleshooting, I recommend using docker's CLI to access one of your containers after GoCD spins it up. Since the containers are registering themselves as Static Agents, you should be able to see the Sandbox directory listed in the GoCD UI. Based on the information that Ram provided and what I see in our own Agents, you want to look for <SandboxDirectory>/config/autoregister.properties.

My guess is that Ram is correct and this file is either missing or does not contain the expected information.

Hope this helps,
Jason

IXI

unread,
Dec 8, 2020, 2:50:40 AM12/8/20
to go-cd
Finally we got solution for this. You want beleave it, but it was just about encoding of the file. We had UTF-8, then we changed to windows default (to be honest, still not sure, which is windows default), and it worked. So everything was setup correctly and only the encoding of the agent-autoregister.properties was wrong.
Thank you all for all suggestions and help. :-)

Dne středa 4. listopadu 2020 v 16:30:34 UTC+1 uživatel jsm...@scimarketview.com napsal:

Jason Smyth

unread,
Dec 8, 2020, 9:54:32 AM12/8/20
to go-cd
Hi there!

Glad to hear you got this sorted out.

Thank you for sharing your solution with the mailing list.

Regards,
Jason
Reply all
Reply to author
Forward
0 new messages