{"id":20567438,"url":"https://github.com/sombriks/sample-cassandra","last_synced_at":"2025-09-01T16:41:05.322Z","repository":{"id":213164515,"uuid":"733198222","full_name":"sombriks/sample-cassandra","owner":"sombriks","description":"exploratory project to see how to consume Apache Cassandra / AWS Keyspaces from spring-boot-kotlin project","archived":false,"fork":false,"pushed_at":"2023-12-19T17:57:06.000Z","size":60,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-16T20:27:17.911Z","etag":null,"topics":["cassandra","docker","docker-compose","keyspaces","kotlin","spring","spring-boot","spring-web-mvc","testcontainers"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sombriks.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-12-18T19:32:17.000Z","updated_at":"2023-12-19T17:59:24.000Z","dependencies_parsed_at":"2023-12-19T02:23:26.723Z","dependency_job_id":null,"html_url":"https://github.com/sombriks/sample-cassandra","commit_stats":null,"previous_names":["sombriks/sample-cassandra"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sombriks%2Fsample-cassandra","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sombriks%2Fsample-cassandra/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sombriks%2Fsample-cassandra/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sombriks%2Fsample-cassandra/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sombriks","download_url":"https://codeload.github.com/sombriks/sample-cassandra/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242179424,"owners_count":20084947,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cassandra","docker","docker-compose","keyspaces","kotlin","spring","spring-boot","spring-web-mvc","testcontainers"],"created_at":"2024-11-16T04:46:44.021Z","updated_at":"2025-03-06T09:18:48.272Z","avatar_url":"https://github.com/sombriks.png","language":"Kotlin","readme":"# Sample Cassandra\n\n[![CI with Gradle](https://github.com/sombriks/sample-cassandra/actions/workflows/gradle.yml/badge.svg)](https://github.com/sombriks/sample-cassandra/actions/workflows/gradle.yml)\n\nSampling minimal configuration to work with Apache Cassandra\n\n## Requirements\n\n- java 17\n- gradle 8.5\n- docker 20 or newer\n- a modern ide (intellij ultimate)\n\n## How to run\n\nFirst spin up a cassandra server with docker compose:\n\n```bash\ndocker compose -f src/infrastructure/docker-compose.yml up\n```\n\nThen start the project either using the ide or using gradle wrapper\n\n```bash\n./gradlew bootRun\n```\n\nNote: if this error occurs:\n\n```bash \nCaused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cassandraSession' defined in class path resource [org/springframework/boot/autoconfigure/cassandra/CassandraAutoConfiguration.class]: Failed to instantiate [com.datastax.oss.driver.api.core.CqlSession]: Factory method 'cassandraSession' threw exception with message: Invalid keyspace spring_cassandra\n```\n\nYou will need to manually create the cassandra keyspace. there is a [test script](src/test/resources/initial.cql)\nthat you can use to prepare cassandra database.\n\n## Testing\n\nThere are a few test samples using testcontainers, so you don't need to manually\ncreate and run cassandra:\n\n```bash\n./gradlew test\n```\n\nIt also allows CI to run with no external dependencies, which is the correct way\nto do CI runs. See [gradle.yml](.github/workflows/gradle.yml) for details.\n\n## AWS Keyspaces\n\nOne thing is regular cassandra. Another beast is [AWS Keyspaces](https://console.aws.amazon.com/keyspaces).\n\nUsing the [sample project](https://github.com/aws-samples/amazon-keyspaces-examples/tree/main/java/datastax-v4/spring)\nas reference, [this configuration](src/main/resources/application-aws.yml) was\nmade for better reuse in future.\n\nIn order to proper get this working, you must provide the following environment\nvariables:\n\n```bash\nAWS_ACCESS_KEY_ID=\u003caws account id\u003e\nAWS_SECRET_ACCESS_KEY=\u003caws account key\u003e\nCASSANDRA_KEYSPACE_NAME=\u003ccassandra keyspace\u003e\nCASSANDRA_USERNAME=\u003cservice account user\u003e\nCASSANDRA_PASSWORD=\u003cservice account password\u003e\n```\n\nThen you can configure the IDE to run with the aws profile. Or try this command\nline:\n\n```bash\n./gradlew bootRun --args=\"--spring.profiles.active=aws\"\n```\n\n## Reference Documentation\n\nFor further reference, please consider the following sections:\n\n* [Official Gradle documentation](https://docs.gradle.org)\n* [Spring Boot Gradle Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/3.2.0/gradle-plugin/reference/html/)\n* [Create an OCI image](https://docs.spring.io/spring-boot/docs/3.2.0/gradle-plugin/reference/html/#build-image)\n* [Spring Boot Testcontainers support](https://docs.spring.io/spring-boot/docs/3.2.0/reference/html/features.html#features.testing.testcontainers)\n* [Testcontainers Cassandra Module Reference Guide](https://java.testcontainers.org/modules/databases/cassandra/)\n* [Spring Web](https://docs.spring.io/spring-boot/docs/3.2.0/reference/htmlsingle/index.html#web)\n* [Spring Data for Apache Cassandra](https://docs.spring.io/spring-boot/docs/3.2.0/reference/htmlsingle/index.html#data.nosql.cassandra)\n* [Testcontainers](https://java.testcontainers.org/)\n\n## Guides\n\nThe following guides illustrate how to use some features concretely:\n\n* [Building a RESTful Web Service](https://spring.io/guides/gs/rest-service/)\n* [Serving Web Content with Spring MVC](https://spring.io/guides/gs/serving-web-content/)\n* [Building REST services with Spring](https://spring.io/guides/tutorials/rest/)\n* [Spring Data for Apache Cassandra](https://spring.io/guides/gs/accessing-data-cassandra/)\n\n## Additional Links\n\nThese additional references should also help you:\n\n* [Gradle Build Scans – insights for your project's build](https://scans.gradle.com#gradle)\n\n## Testcontainers support\n\nThis project\nuses [Testcontainers at development time](https://docs.spring.io/spring-boot/docs/3.2.0/reference/html/features.html#features.testing.testcontainers.at-development-time).\n\nTestcontainers has been configured to use the following Docker images:\n\n* [`cassandra:latest`](https://hub.docker.com/_/cassandra)\n\nPlease review the tags of the used images and set them to the same as you're running in production.\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsombriks%2Fsample-cassandra","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsombriks%2Fsample-cassandra","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsombriks%2Fsample-cassandra/lists"}