Postgres backup not working on gocd server pod

28 views
Skip to first unread message

Alexandru Cojocariu

unread,
Jun 20, 2023, 7:41:12 AM6/20/23
to go-cd
Hello,

I am facing an issue regarding the GoCD postgres backup. I am using an external postgres server and I am trying to trigger a backup (using the GoCD API) with a curl command:

curl 'https://<gocd-instance>/go/api/backups' -i -u '<username>:<password>' -H 'X-GoCD-Confirm: true' -H 'Accept: application/vnd.go.cd.v2+json' -X POST

When inspecting the output in the gocd-server I get:

jvm 1    | java.lang.RuntimeException: java.lang.RuntimeException: There was an error backing up the database using `pg_dump`. The `pg_dump` process failed with code 2.
           ....
jvm 1    | Caused by: java.io.IOException: Cannot run program "pg_dump": error=2, No such file or directory

jvm 1    |      at java.base/java.lang.ProcessBuilder.start(Unknown Source)
jvm 1    |      at java.base/java.lang.ProcessBuilder.start(Unknown Source)
jvm 1    |      at org.zeroturnaround.exec.ProcessExecutor.invokeStart(ProcessExecutor.java:997)
jvm 1    |      at org.zeroturnaround.exec.ProcessExecutor.startInternal(ProcessExecutor.java:970)
jvm 1    |      at org.zeroturnaround.exec.ProcessExecutor.execute(ProcessExecutor.java:906)
jvm 1    |      at com.thoughtworks.go.server.database.pg.PostgresqlBackupProcessor.backup(PostgresqlBackupProcessor.java:43)
jvm 1    |      ... 10 common frames omitted
jvm 1    | Caused by: java.io.IOException: error=2, No such file or directory
jvm 1    |      at java.base/java.lang.ProcessImpl.forkAndExec(Native Method)
jvm 1    |      at java.base/java.lang.ProcessImpl.<init>(Unknown Source)
jvm 1    |      at java.base/java.lang.ProcessImpl.start(Unknown Source)
jvm 1    |      ... 16 common frames omitted


The server is a k8s pod deployed through a helmchart. The helmchart used is: https://artifacthub.io/packages/helm/gocd/gocd - version 2.1.0
The gocd image specified in the helmchart is: gocd-server v23.1.0
The postgres server is connected according to the specifications from here: https://docs.gocd.org/current/installation/configuring_database/connection-properties.html
My question is: can I configure somehow the helmchart to recognize the pg_dump command or the postgresql tools in general?

Thanks,
Alex

Chad Wilson

unread,
Jun 20, 2023, 8:17:51 AM6/20/23
to go...@googlegroups.com
Hi Alex

You would need to either
- build your own custom child GoCD server image which contains the relevant postgres binaries for your Postgres version, push 8t to our own registry and then override the repository/image:tag when installing the Helm chart, or
- use an additional docker entrypoint script to dynamically install them (or download from some internal artifact store) every time the container starts, or
- mount an existing persistent volume containing the binaries using the helm chart configuration and add it to the PATH

The official images so not contain these binaries as they are somewhat database version dependent and it's not the 'default' configuration.

-Chad

--
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/e384ce50-6e2d-4f81-b95f-3abb50c3cc2fn%40googlegroups.com.

Alexandru Cojocariu

unread,
Jun 20, 2023, 9:00:01 AM6/20/23
to go-cd
As I thought the helmchart will have to be tweaked a bit either way.

Thanks for the answer!
Reply all
Reply to author
Forward
0 new messages