Hi Satya

When running a standard GoCD docker server image, you should mount a
writable volume to the entire */godata* directory which includes the config
as noted at https://hub.docker.com/r/gocd/gocd-server, but not directly to
an individual config file.

If you do not, even if you get the config working properly, you'll lose
other things such as artifacts at startup which you generally do not want.

You are getting this error likely because the server ID inside the go
config does not match what is inside the configuration history, which is
normally at /godata/db/config.git (The GoCD Docker entrypoint script
creates the symlinks into /go-working-dir within the docker-entrypoint.sh
<https://github.com/gocd/docker-gocd-server/blob/master/docker-entrypoint.sh>),
so these things need to be mounted together and consistent.

I don't think your mounts to /var/lib/go-server or /etc/go will be doing
anything, as these folders are not used for *off-the-shelf* docker server
images, since the server is not installed as an rpm/deb package when
creating a container. You can/should likely remove these.

In a general sense, all you should need to do is mount a location in EFS to
/godata, similar to what the Helm chart does:
https://github.com/gocd/helm-chart/blob/c734ad2263b1d2885229d00267c428e88f868504/gocd/templates/gocd-server-deployment.yaml#L122-L124
That will put all logs, artifacts, databases and config on your volume.
Some folks decide to also mount /home/go if they want to use external
storage for things like Git SSH keys or other shell defaults affecting the
*go* user, but that's optional.

-Chad

On Thu, Apr 11, 2024 at 5:34 AM Satya Elipe <satya.el...@gmail.com> wrote:

>
> 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:*
>
>    - *GoCD Server Image Version:* gocd/gocd-server:v22.3.0
>    - *Docker Version:* Docker version 25.0.3, build 4debf41
>    - *Host Operating System:* Amazon Linux 2023
>
> *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:*
>
>    - Is there a recommended approach to ensure cruise-config.xml is
>    correctly recognized and used by the GoCD server when running in Docker?
>    - Could this issue be related to how volumes are mounted or
>    permissions within the container?
>
>
> 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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/go-cd/CADKEDRrF7KRFP9jNsg631STyokXS1Njqutdshd0ZKdwHMRTy6g%40mail.gmail.com
> <https://groups.google.com/d/msgid/go-cd/CADKEDRrF7KRFP9jNsg631STyokXS1Njqutdshd0ZKdwHMRTy6g%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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+unsubscr...@googlegroups.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.

Reply via email to