Cannot connect to YugaByte #26862
-
Hi, I have a Go application that uses YugaByte and I have some tests for the same. While I run the tests in the pipeline and try to connect to yugabyte, it says connection refused. Here is a snippet from my workflow file:
Locally, I use the following command to run the container:
I am not sure how I can specify these docker commands in the workflow file. Thank You |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments
-
Hi @mithali-zs, Glad to see you in Github Commnity Forum! The code works fine on my workflow. Could it be possible that the connection refused caused by the network issue? Please try again with Github hosted runner. If the issue persists, could you please share a sample repo/workflow yaml for further investigation? Please check github docker services doc and sample workflows below, hope it helps. actions/example-servicesExample workflows using service containers. Contribute to actions/example-services development by creating an account on GitHub. |
Beta Was this translation helpful? Give feedback.
-
Hi @weide-zhou. Thanks for your reply. When I tried it out, the service container was up and running. But I am not able to connect to it in my code. What I have noticed even on my local is that in order for me to create a cluster successfully, Here is the link to the documentation I referred to : https://docs.yugabyte.com/latest/quick-start/create-local-cluster/docker/#1-create-a-local-cluster Is there a way for me to provide this in workflow file? |
Beta Was this translation helpful? Give feedback.
-
Hi @mithali-zs, This should be due to the service is not alive during workflow, hence you cannot connect it. BTW, there is an action ‘yugabyte/yugabyte-db-action@master’ which can help to set up a YugabyteDB database, does it meet your requirements?
Thanks |
Beta Was this translation helpful? Give feedback.
-
Hi @weide-zhou, Thank you for your help. :slight_smile: However, ‘yugabyte/yugabyte-db-action@master ’ works fine. But there is an issue here. This creates a docker container and it does not stop even after the pipeline ends. So when I re run the pipeline, it fails at Setup YugabyteDB cluster as it complains that the port is already being used. Is there a cleaner way to do this? Thank You |
Beta Was this translation helpful? Give feedback.
-
Hi @mithali-zs,
Looks you are using self-hosted runner since hosted runner will be discarded after workflow complete. Thanks |
Beta Was this translation helpful? Give feedback.
-
Thanks for your help @weide-zhou :slight_smile: |
Beta Was this translation helpful? Give feedback.
Hi @mithali-zs,
This should be due to the service is not alive during workflow, hence you cannot connect it.
Typically we can add a simple healthcheck to keep the service alive, and then you can connect it and run your docker command in the workflow step.
Please refer to the answer here for more details.
BTW, there is an action ‘yugabyte/yugabyte-db-action@master’ which can help to set up a YugabyteDB database, does it meet your requirements?
Thanks