{"id":19040918,"url":"https://github.com/cloudfoundry/jdbctestapp","last_synced_at":"2025-09-07T02:30:44.344Z","repository":{"id":65764394,"uuid":"592359278","full_name":"cloudfoundry/jdbctestapp","owner":"cloudfoundry","description":"A Spring Boot app for testing JDBC connectivity in general and TLS in particular","archived":false,"fork":false,"pushed_at":"2024-12-30T12:09:26.000Z","size":93,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":5,"default_branch":"main","last_synced_at":"2024-12-30T13:19:50.437Z","etag":null,"topics":["cff-wg-service-management"],"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/cloudfoundry.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-01-23T15:08:08.000Z","updated_at":"2024-12-30T12:08:52.000Z","dependencies_parsed_at":"2024-11-08T22:27:16.584Z","dependency_job_id":"b6c25808-4332-40aa-8cda-368ab0992dc4","html_url":"https://github.com/cloudfoundry/jdbctestapp","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudfoundry%2Fjdbctestapp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudfoundry%2Fjdbctestapp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudfoundry%2Fjdbctestapp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudfoundry%2Fjdbctestapp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cloudfoundry","download_url":"https://codeload.github.com/cloudfoundry/jdbctestapp/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":232163094,"owners_count":18481581,"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":["cff-wg-service-management"],"created_at":"2024-11-08T22:26:05.815Z","updated_at":"2025-01-02T07:13:18.555Z","avatar_url":"https://github.com/cloudfoundry.png","language":"Kotlin","readme":"# JDBC test application\n\nThis application can be used to test database connections set up with a JDBC URL,\nand report SSL/TLS information. Currently, the application only supports the following\ndatabase engines:\n\n- PostgreSQL\n- MySQL\n- SQLServer\n\nIt has been verified to run on the following IaaS platforms:\n\n- AWS\n- GCP\n\n## Generate JAR for deployment\n\nThis application is supposed to be deployed to [Cloud Foundry](https://cloudfoundry.org), which requires a fat JAR for\ndeployment. However, before the JAR is generated, the project needs some DB-specific adjustments. These can be made by\nrunning one of the configuration gradle tasks provided: either `configureForMysql`, `configureForPostgres`, or `configureForSQLServer`\ndepending on the required database.\n\nAfter that, running `gradlew bootJar` will produce a JAR pre-configured for the indicated database engine\nin `build/libs`.\n\n### Automatic TLS Certificate extraction\n\nBy default, the generated JAR will contain a shell script that will automatically\nrun on CloudFoundry and attempt to extract TLS certificates from the service binding.\nCurrently supported services are:\n\n- CloudSQL for MySQL on GCP via [Cloud Services Broker](https://github.com/cloudfoundry/cloud-service-broker).\n\nIn order to disable the script, build the JAR with a project flag `disableBindingTLSDetection` set to `false`, e.g.:\n```\ngradlew bootJar -P disableBindingTLSDetection=true\n```\n\n## Generating a sample manifest\n\nOnce the database engine is configured, a sample Cloud Foundry application manifest can be generated.\nRunning `gradlew deploymentManifest` task will generate a sample manifest in the root of the `build` directory.\n\n### GCP CloudSQL\n\nOn GCP, each CloudSQL instance gets its own CA and certificate generated, so the manifest will have to include \nadditional environment variables in order to support this. The following flags are used to generate a manifest\nwith TLS support on CloudSQL:\n\n- `-P iaas=gcp` This flag is need in this exact form to set up the manifest to use instance-specific\n  certificates, keys and CAs.\n- `-P keystorePassword=super-secret-password` (Optional) It's recommended to override the default password used in the keystore\n  generated for the GCP deployment.\n\nRun the `deploymentManifest` gradle task to generate a sample manifest in the root of the `build` directory:\n\n```shell\n# For CloudSQL-specific certificate handling on GCP\n$ ./gradlew deploymentManifest -P iaas=gcp -P keystorePassword=super-secure-password\n\n# For AWS or GCP without TLS support no options are needed\n$ ./gradlew deploymentManifest \n```\n\n## Deploying from this repository\n\nIt's also possible to use gradle in order to deploy this application to Cloud Foundry. As the deployment task depends\non the `bootJar` and the `deploymentManifest` tasks, it requires the same configuration, namely, running the database\nengine configuration tasks, and requiring the `-P iaas=gcp` flag when deploying to GCP with TLS support. The deployment\ntasks rely on the CF CLI, and expect it to be logged in.\n\nThere are two gradle deployment tasks: `initialDeploy` and `deploy`. The first is intended to deploy the app before\nbinding it to a service, passing a `--no-start` flag to the `cf push` command.\n\n## Test endpoints\n\nThe application provides a set of Create (`POST /?name=\u003cnew-user-name\u003e`), Get (`GET /\u003cuser-id\u003e`), List (`GET /`), and\nDelete (`DELETE /\u003cuser-id\u003e`) operations on a\n`User` entity, mounted at the application root. The `User` is an extremely simple entity that has only two attributes:\n`id` and `name`.\n\n## SSL information endpoints\n\n### PostgreSQL\n\n`GET /postgres-ssl` provides the full `pg_stat_ssl` report on the current connection encoded as JSON, e.g.:\n\n```json\n{\n  \"pid\": 8546,\n  \"ssl\": true,\n  \"version\": \"TLSv1.2\",\n  \"cipher\": \"ECDHE-RSA-AES256-GCM-SHA384\",\n  \"bits\": 256,\n  \"clientDN\": \"/CN=DaH08q7h0487hF8u/O=Google\\\\, Inc/C=US\",\n  \"clientSerial\": \"948546794\",\n  \"issuerDN\": \"/dnQualifier=58a5c5f4-55b0-4d22-aba7-87880d1ad0ab/CN=Google Clo\"\n}\n```\n\nPlease Note:\n\n- The `clientDN`, `clientSerial` and `issuerDN` will be filled in only if a client certificate is used.\n- The `version`, `cipher` and `bits` fields will only be filled in if the current database connection is secure.\n\n### MySQL\n\n`GET /mysql-ssl` reports the ciphers used for the current connection, e.g.:\n\n```json\n{\n  \"variableName\": \"Ssl_cipher\",\n  \"value\": \"ECDHE-RSA-AES128-GCM-SHA256\"\n}\n```\n\nThe value will only be blank if the database connection is not encrypted.\n\n## Troubleshooting\n\nThe application won't start with the following error message\n\n```\nFound non-empty schema(s) \"XXX\" but no schema history table. Use baseline() or set baselineOnMigrate to true to initialize the schema history table.\n```\n\nThis problem can be resolved by one of the following options:\n\n- create a new schema or database to use with the application\n- set application property `spring.flyway.baseline-on-migrate` to `true` and property `spring.flyway.baseline-version`\n  to `0`\n- delete all objects from the current schema before running the application for the first time","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudfoundry%2Fjdbctestapp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcloudfoundry%2Fjdbctestapp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudfoundry%2Fjdbctestapp/lists"}