Dear GoCD Support Team,
I hope this message finds you well. I am currently encountering an issue with setting up GoCD on Docker and specifically with configuring the cruise-config.xml file to be recognized correctly in my setup. Despite following the official documentation and trying various configurations, I've hit a stumbling block that I hope you can help me with.
Issue Summary:
I have a GoCD server running in a Docker container, and I'm attempting to ensure that the cruise-config.xml file is correctly picked up from a specified location. My goal is to mount this configuration file from an external volume into the GoCD server container so that the server uses this configuration instead of the default one.
Configuration Details:
Docker Run Command:
docker run -d \
--name gocd-server \
-p 8153:8153 \
-p 8154:8154 \
-v /mnt/gocd_efs:/var/lib/go-server \
-v /mnt/gocd_efs/etc_go/cruise-config.xml:/go-working-dir/config/cruise-config.xml \
-v /mnt/gocd_efs/etc_go:/etc/go \
custom-gocd-server
Issue Encountered:
When including the -v /mnt/gocd_efs/etc_go/cruise-config.xml:/go-working-dir/config/cruise-config.xml volume mount, the GoCD server fails to start correctly, with logs indicating an inability to create or copy necessary files within /go-working-dir/config.
Without this mount, the server starts but does not load the desired configuration, defaulting instead to the initial configuration without any of our pipeline configurations.
Log snippet:
```
jvm 1 | 2024-04-10 20:55:17,429 ERROR [Thread-79] GoFileConfigDataSource:436 - Unable to load config file: /go-working-dir/config/cruise-config.xml The value of 'serverId' uniquely identifies a Go server instance. This field cannot be modified.
```
Questions:
Any assistance or insights you could provide on this matter would be greatly appreciated. I am happy to provide any further information or logs as needed.
Thank you for your time and support.
Best regards,
Satya
--
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/CADKEDRrF7KRFP9jNsg631STyokXS1Njqutdshd0ZKdwHMRTy6g%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/go-cd/CAA1RwH-%3DFtT%3DDoPvoCekei%2BncFGgC2CSxu7DS7QgZWQ_QH3%3DwQ%40mail.gmail.com.
I see the right content in the file in the /godata/:
```
bash-5.1$ ls -al /godata/cruise-config.xml
-rwxr-xr-x 1 root root 14950 Apr 11 09:38 /godata/cruise-config.xml
bash-5.1$ cat /godata/cruise-config.xml
<elastic>```
But then looks like the file getting changed after the sym links creation:
```
bash-5.1$ ls -al /go-working-dir/
total 107804
drwxrwxr-x 1 go root 16384 Apr 11 09:42 .
drwxr-xr-x 1 root root 90 Apr 11 09:41 ..
lrwxrwxrwx 1 go root 17 Apr 11 09:41 artifacts -> /godata/artifacts
lrwxrwxrwx 1 go root 14 Apr 11 09:41 bin -> /go-server/bin
lrwxrwxrwx 1 go root 14 Apr 11 09:41 config -> /godata/config
-rw-r--r-- 1 go root 110355285 Apr 11 09:41 cruise.war
lrwxrwxrwx 1 go root 10 Apr 11 09:41 db -> /godata/db
drwxr-xr-x 11 go root 141 Apr 11 09:42 felix-cache
lrwxrwxrwx 1 go root 14 Apr 11 09:41 lib -> /go-server/lib
lrwxrwxrwx 1 go root 12 Apr 11 09:41 logs -> /godata/logs
lrwxrwxrwx 1 go root 15 Apr 11 09:41 plugins -> /godata/plugins
drwxr-xr-x 11 go root 16384 Apr 11 09:42 plugins_work
lrwxrwxrwx 1 go root 14 Apr 11 09:41 run -> /go-server/run
drwxr-xr-x 3 go root 52 Apr 11 09:41 work
lrwxrwxrwx 1 go root 18 Apr 11 09:41 wrapper -> /go-server/wrapper
lrwxrwxrwx 1 go root 25 Apr 11 09:41 wrapper-config -> /go-server/wrapper-config
bash-5.1$ cat /godata/config/cruise-config.xml
<?xml version="1.0" encoding="utf-8"?>
<cruise xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="cruise-config.xsd" schemaVersion="139">
<server agentAutoRegisterKey="44eb6cdc-d8d9-4604-abfa-f061bbcbbee1" webhookSecret="506660f5-21e9-40c4-aa67-78c5cb37cde1" serverId="f256fbc9-d378-4649-a978-c4ddaca865b7" tokenGenerationKey="a7dc8993-3209-4459-ac18-85c1e89a5a60">
<artifacts>
<artifactsDir>artifacts</artifactsDir>
</artifacts>
</server>
</cruise>```
Is that been happening by the entrypoint script as such ?
For information, here is my dockerfile:
```
# Use the official GoCD server image from gocd.org as the base
FROM gocd/gocd-server:v22.3.0
# Environment variables can be set if needed
ENV GO_SERVER_SYSTEM_PROPERTIES=""
# Switch to root user to install additional packages
USER root
# Install additional packages required for your setup
RUN apk update && apk add --no-cache \
unzip \
git \
openssh-client \
jq \
ca-certificates \
curl \
zip \
&& rm -rf /var/cache/apk/* /var/lib/apt/lists/*
# No custom entrypoint script is used, rely on the base image's entrypoint
# Switch back to the GoCD user for safety
USER go
# Volumes where GoCD expects data to persist, you will mount your EFS to these locations
VOLUME ["/var/lib/go-server", "/etc/go"]
# Expose ports
EXPOSE 8153 8154
# The ENTRYPOINT from the base image is used, ensuring GoCD starts up as expected```
Many thanks
Satya
To view this discussion on the web visit https://groups.google.com/d/msgid/go-cd/CADKEDRoA4-tYUgRbD7ob2WgGC1M4jNQWkJFhezSMn_CtV%3DhS_w%40mail.gmail.com.
Thank you for your assistance so far.
I’ve encountered a new issue where agents are launched correctly, and I can verify their status using "check agent status," which provides all the necessary details of the agents. However, these agents are not being assigned to their respective jobs.
I noticed that the Elastic agent plugin updates the /var/lib/go-agent/config/autoregister.properties file with a new "agent.auto.register.key" for every new job, resulting in constant key changes. My server’s "cruise-config.xml" retains a different key. Is this behavior expected? Perhaps this could be the issue why agents are not getting assigned jobs.
Here is the glimpse of the autoregister.properties file:
agent.auto.register.key=b57ea434-9000-4d14-893a-47a422563680
agent.auto.register.hostname=EA_i-07a877b3997f767a9
agent.auto.register.elasticAgent.agentId=i-07a877b3997f767a9
agent.auto.register.elasticAgent.pluginId=com.continuumsecurity.elasticagent.ec2
agent.auto.register.environments=staging,sandbox```
I've done extensive research and attempted various solutions, but I'm still at a loss. Any insights or suggestions you could provide would be greatly appreciated.
Many thanks,
Satya
To view this discussion on the web visit https://groups.google.com/d/msgid/go-cd/CAA1RwH_X5WrkHbAkPZLOFrGUax4mv2c_Yc4eM7WfU7m1BZ464Q%40mail.gmail.com.
I noticed that the Elastic agent plugin updates the /var/lib/go-agent/config/autoregister.properties file with a new "agent.auto.register.key" for every new job, resulting in constant key changes.
To view this discussion on the web visit https://groups.google.com/d/msgid/go-cd/CADKEDRoEydURsKu8RQuTApOHRvtK7NF%2BmdF9yp0jAwW1ToUJDA%40mail.gmail.com.