-
Hi everyone, I have a go backend application where I try to connect to cassandra db and run some tests. So I need an instance to cassandra db. Referring to this: https://github.com/marketplace/actions/setup-cassandra-action I tried connecting to cassandra using the ip provided or the localhost and none of them seem to work. An issue fabasoad/setup-cassandra-action#1 is already created but seems like there is no response. Thanks in advance. |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments
-
Hi @vivekab, Glad to see you in Github Community Forum! This is not an official github action, it’s recommended to comment on the issue and @author, wait for the update. In the meanwhile, you can try to use the official image and set it as a service(doc here), code sample as below:
Please refer to my workflow for more details. weide-zhou/ticket13Contribute to weide-zhou/ticket13 development by creating an account on GitHub. Thanks. |
Beta Was this translation helpful? Give feedback.
-
Hi @weide-zhou, Thanks on the update I tried connecting to the container as per your mentioned guidelines. But still I have problem connecting to the container though. when I tried running:
It gives me connectivity error
I also tried connecting without giving the host and the port but then its still an error.
Am I doing something wrong here? 🙁 |
Beta Was this translation helpful? Give feedback.
-
This is a common problem thats caused by trying to access the service (cassandra) before it is fully online and ready to handle connections. This is more a matter of how docker works when starting containers in the background, its async. We can add a simple healthcheck so that the rest of the steps downstream dont run until the service is healthy (if the container doesnt have any good tools in it for performing a healthcheck, you could always just Heres a quick sample I wrote:
Basically docker will run |
Beta Was this translation helpful? Give feedback.
-
@dakale and @weide-zhou That really helps, will be following the same from now on. Thanks. |
Beta Was this translation helpful? Give feedback.
-
@vivekab What .yml file are you using ATM? I copied the answer from @dakale but I am unable to create a keyspace or to query anything. This simple .yml file fails to run on github:
Note: I would expect it to fail with a message like: keyspace
|
Beta Was this translation helpful? Give feedback.
-
@vivekab could you share your final yml file? I also asked my question on https://stackoverflow.com/questions/63410396/setup-cassandra-container-in-github-actions-and-query and https://www.reddit.com/r/cassandra/comments/id8lgo/use_cassandra_with_github_actions/ but I don’t get any useful responses |
Beta Was this translation helpful? Give feedback.
-
Hi @Jasperav, Here is the yaml that I use.
|
Beta Was this translation helpful? Give feedback.
This is a common problem thats caused by trying to access the service (cassandra) before it is fully online and ready to handle connections. This is more a matter of how docker works when starting containers in the background, its async. We can add a simple healthcheck so that the rest of the steps downstream dont run until the service is healthy (if the container doesnt have any good tools in it for performing a healthcheck, you could always just
sleep 30
on the host as a step, for eg)Heres a quick sample I wrote: