If you can use docker you'll want to check out the elastic agent plugins.
For anyone else trying to setup remote agents on regular Amazon EC2 (linux) 
instances  that autoregister with the go server here are some notes as 
there was one gotcha.

I launched one ec2 instance, installed the Go Agent and other dependencies 
(java, gradle, git).

Then following the instructions for autoregistering agents I 
- created a new *config* directory under */var/lib/go-agent*
- created an *autoregister.properties* file in the config directory
- chown and chgrp to "go" for the directory and file

My* autoregister.properties* looked like the following:

agent.auto.register.key=(key can be found under Admin > Config XML > server 
tag > agentAutoRegisterKey attribute)
agent.auto.register.resources=resource1,resource2
agent.auto.register.environments=env1,env2
#agent.auto.register.hostname=I don't specify this so that the private ip 
is used to identify the agent.

Left the hostname out as my ec2 instances run in a VPC and their private 
ip's don't change.

I started up the agent 
*sudo /etc/init.d/go-agent start*

And checked on the Agents tab on the Go Server and saw the agent registered.
I then shut down the agent and created an AMI from that ec2 instance.
*WARNING THIS DIDN'T WORK*.

When I spun up some more instances using that AMI something funky started 
to happen when looking at the Agents tab, only one agent would show but the 
ip would periodically change.
Eventually a warning notification came up on the go server indicating 
duplicate agent ids.

The issue is that inside the new */var/lib/go-agent/config* directory some 
new files were created once the agent started up and connected to the 
server, including a file containing a unique id for that agent.  
Since it was saved with the AMI all the other instances were trying to use 
the same id.

So the solution:
- *delete all the other files in the /config directory*
- *uncomment the autoregister.properties file *as it gets commented out 
after the first restart
- *now take create an AMI in this state.*

Now when they first spin up a unique id is created for each instance and 
they don't conflict.


-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to