Attempting Multiple agents on same server - new agents always fail

45 views
Skip to first unread message

David Limer

unread,
Oct 8, 2019, 12:11:50 PM10/8/19
to go-cd
Greetings, 
Have been trying to re-establish multiple agents on my single server (they failed a couple releases ago, decided to upgrade agent package as recommended this time around and recreate them).
Used script noted in the agent README-running-multiple-agents.md.  

When I start go-agent-1 for instance, seems to start and give me a PID, which then exits.  Attaching logs and wrapper-conf and wrapper-properties.conf.
Environment is a digital ocean instance :  Linux goCD 4.4.0-159-generic #187-Ubuntu SMP Thu Aug 1 16:28:06 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

I've spent a couple days now trying to figure out what's wrong...am an impasse, appreciate any help.  I confess my unix skills are rusty.


Regards, 
Dave
go-agent-bootstrapper-wrapper.log
go-agent-bootstrapper.log
go-agent-launcher.log
wrapper-properties.conf
wrapper.conf

Ankit Srivastava

unread,
Oct 8, 2019, 4:47:21 PM10/8/19
to go...@googlegroups.com
Hi David,

Can you share the README-running-multiple-agents.md or the script you used to install multiple agents?

In the go-agent-bootstrapper-wrapper.log file, I found that the agent is trying to start with `/var/lib/go-agent/` working directory. Whereas in the wrapper.conf file, wrapper.working.dir is pointing to /var/lib/go-agent-1. Were there any changes made to the agent `run` file (/usr/share/go-agent-1/ folder)? 

INFO   | jvm 1    | 2019/10/08 15:32:48 | [Tue Oct 08 15:32:48 UTC 2019] Starting process:
INFO   | jvm 1    | 2019/10/08 15:32:48 | [Tue Oct 08 15:32:48 UTC 2019]   Working directory    : /var/lib/go-agent
INFO   | jvm 1    | 2019/10/08 15:32:48 | [Tue Oct 08 15:32:48 UTC 2019]   Application arguments: [-serverUrl, https://127.0.0.1:8154/go]
INFO   | jvm 1    | 2019/10/08 15:32:48 | [Tue Oct 08 15:32:48 UTC 2019]            GoCD Version: 19.9.0-10194
INFO   | jvm 1    | 2019/10/08 15:32:48 | [Tue Oct 08 15:32:48 UTC 2019]            Java Version: 12.0.1
INFO   | jvm 1    | 2019/10/08 15:32:48 | [Tue Oct 08 15:32:48 UTC 2019]        Operating System: Linux(4.4.0-159-generic)

I tried with the below script and it worked fine. 

    ```bash
      # spin up 5 additional GoCD agents.
      AGENT_COUNT=2

      # if you want to run the GoCD agent as a service
      RUN_AS_SERVICE=true

      # if you want to start the service immediately
      # only works if `RUN_AS_SERVICE` is true
      START_SERVICE_NOW=false

      for AGENT_INDEX in $(seq 1 "${AGENT_COUNT}")
      do
        AGENT_ID="go-agent-${AGENT_INDEX}"

        # create the directories for agent data and binaries
        mkdir -p /usr/share/${AGENT_ID} /var/{lib,log}/${AGENT_ID} /var/lib/${AGENT_ID}/run

        # copy over all config and shell scripts and wrapper configs
        cp -arf /usr/share/go-agent/{bin,wrapper-config} /usr/share/${AGENT_ID}

        # symlink the wrapper binaries
        ln -sf /usr/share/go-agent/wrapper /usr/share/${AGENT_ID}

        # change ownership and mode, so that the `go` user, and only that user
        # can write to these directories
        chown -R go:go /var/{lib,log}/${AGENT_ID}
        chmod -R 0750 /var/{lib,log}/${AGENT_ID}

        # tweak the scripts and configs to use the correct directories
        sed -i -e "s@go-agent@${AGENT_ID}@g" /usr/share/${AGENT_ID}/bin/go-agent
        sed -i -e "s@=go-agent\$@=${AGENT_ID}@g" \
              -e "s@/var/lib/go-agent@/var/lib/${AGENT_ID}@g" \
              -e "s@/var/log/go-agent@/var/log/${AGENT_ID}@g" \
              -e "s@../wrapper-config/wrapper-properties.conf@/usr/share/${AGENT_ID}/wrapper-config/wrapper-properties.conf@g" \
                /usr/share/${AGENT_ID}/wrapper-config/wrapper.conf
        sed -i -e "s@/var/lib/go-agent@/var/lib/${AGENT_ID}@g" /usr/share/${AGENT_ID}/wrapper-config/wrapper-properties.conf

        if [ "${RUN_AS_SERVICE}" == "true" ]; then
          if [ "${START_SERVICE_NOW}" == "true" ]; then
            /usr/share/${AGENT_ID}/bin/go-agent installstart
          else
          /usr/share/${AGENT_ID}/bin/go-agent install
          fi
        fi
      done

      ```

Please note we pushed a fix in GoCD 19.9.0 release to use the absolute path in the script which was causing some problem while multiple agent installation. Can you make sure you are using the updated script.

Regards,
Ankit


--
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/d0ff925f-b728-4803-a41c-3c7232060ab4%40googlegroups.com.


--
Regards,
Ankit

David Limer

unread,
Oct 9, 2019, 9:10:22 AM10/9/19
to go-cd
Thanks for the input Ankit,
 
Turns out I was inadvertently running (a version of) the 19.7 script.  I used the one in your reply and it worked fine.

Dave
To unsubscribe from this group and stop receiving emails from it, send an email to go...@googlegroups.com.


--
Regards,
Ankit
Reply all
Reply to author
Forward
0 new messages