GOCD-Sever cant able to restore the pipeline information from postgres database

96 views
Skip to first unread message

Vengatesan T

unread,
Dec 3, 2021, 9:34:27 AM12/3/21
to go-cd
Hi GOCD

Deployment details
GOCD_SERVER_VERSION -  pulling the 21.3.0 version from docker hub
GOCD_AGENT_VERSION - pulling the 20.9.0 version from docker hub
POSTGRES_VERSION - pulling the latest image from docker hub
ENVIRONMENT - Linux VM
DEPLOYMENT - Docker deployment (docker stack )

I am running GOCD in a Docker environment, I was able to Enable GOCD with Postgres database

The approach I took to for enabling Postgres for GOCD
I'll be using Dockerfile and db.properties to enable GOCD to use Postgres

Dockerfile
FROM  gocd/gocd-server:v21.3.0
COPY --chown=go:root ./db.properties ./godata/config/db.properties

DockerFile Line 1 - I was pulling the latest stable image from Dockerhub
DockerFile Line 2 - copying db.properties to /godata/config/
db.properties
db.driver=org.postgresql.Driver
db.url=jdbc:postgresql://<hostname>:5432/<db_name>
db.user=<postgres-dbuser>
db.password=<password-dbpassowrd>

And creating the database on Postgres container using below sql command
CREATE ROLE "gocd_database_user" PASSWORD 'gocd_database_password' NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT LOGIN;
CREATE DATABASE "cruise" ENCODING="UTF8" TEMPLATE="template0";
\connect cruise
GRANT ALL PRIVILEGES ON DATABASE "cruise" TO "gocd_database_user";
ALTER ROLE "gocd_database_user" SUPERUSER;
Note: Postgres is running as a separate container with persistent volume

After running gocd-server,gocd-agent, and Postgres as separate containers I was able to create pipelines and it was success
and pipeline,agent information is stored on the tables pipelines and agents

What I expect to happen
When I try to recreate the gocd-server and gocd-agent then all the pipelines are stored on the table should be taken from the existing postgres database

What happened
No pipelines are getting displayed on gocd-server from the database even though the data are present on the table, but the agents are getting restored and displayed on the Agents tab
Note: Since new agents is created old agents get lost contact but that information getting displayed on the gocd-server UI

Refer to image-1 for tables created on Postgres
Refer to image-2 for the pipeline created on the gocd-server
Refer to image-3 for agents up the gocd-server
Refer to image-4 for pipeline and agents stored on the table
Refer to image-5 for agents which gets restored from database which has new and old agent Refer to image-6 for no pipeline showing on the gocd-server UI
Refer gocd-server-logs.txt for gocd-server logs

Please let me know why pipeline information is not getting restored
Thanks & Regards
Vengatesan T
image-6.PNG
image-3.PNG
gocd-server-logs.txt
image-5.PNG
image-4.PNG
image-2.PNG
image-1.PNG

Chad Wilson

unread,
Dec 4, 2021, 1:25:12 AM12/4/21
to go...@googlegroups.com
Hi Vengatesan

Just curious - how are you starting the GoCD server Docker image? Are you mounting a volume from the external environment into /godata as noted at https://hub.docker.com/r/gocd/gocd-server?

Based on "COPY --chown=go:root ./db.properties ./godata/config/db.properties" I am inferring that perhaps you are not, because this copy command would be overridden by the volume mount and have no effect.

You need to mount a volume from the external environment for /godata or otherwise it will forget all of your configuration, pipeline history, artifacts, plugins, logs etc, regardless of the database setup when the container is replaced.

If that's not the problem, perhaps you can share a bit more information about how you are starting/configuring the container using docker stack.

-Chad


This e-mail (and any attachments), is confidential and may be privileged. It may be read, copied and used only by intended recipients. Unauthorized access to this e-mail (or attachments) and disclosure or copying of its contents or any action taken in reliance on it is unlawful. Unintended recipients must notify the sender immediately by e-mail or phone and delete it from their system without making any copies or disclosing it to a third person. BRIDGEi2i Analytics Solutions reserves the right to store, monitor and review the content of all messages sent to or from this email address.

--
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/03642c63-b1c7-4c2e-8e6f-bfe66781f8can%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages