Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow streaming apps to use custom datasources #4361

Conversation

tzolov
Copy link
Contributor

@tzolov tzolov commented Feb 1, 2021

  • In the docker-compose configuration, replace the datasource env. variables (e.g. like SPRING_DATASOURCE_URL) by Spring properties to allow the apps to override it.

Resolves #4359

 - In the docker-compose configuration, replace the datasource env. variables (e.g. like SPRING_DATASOURCE_URL) by Spring properties to allow the apps to override it.

 Resolves spring-cloud#4359
@ilayaperumalg
Copy link
Contributor

LGTM

- SPRING_DATASOURCE_USERNAME=root
- SPRING_DATASOURCE_PASSWORD=rootpw
- SPRING_DATASOURCE_DRIVER_CLASS_NAME=org.postgresql.Driver
- spring.datasource.url=jdbc:postgresql://postgres:5432/dataflow
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tzolov The way I understood was that, the properties under environment would always be ENV properties irrespective of the case. Can you help me understand how this works this way?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ilayaperumalg , when you deploy an app you can set apps's own --spring.datasource.url that would override the one coming form the Skipper. But if skipper uses env variables (e.g. SPRING_DATASOURCE_URL) then apparently children's property is ignored in favor of the inherited env variable. I guess in boot the env. vars has precedence over properties.
The above behaviors observed by the local deployers used by the docker-compose configurations.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a bit weird as it's still coming from a boot's property resolver which resolves from environment and thus format in it should not make any difference.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jvalkeal Do you think this PR needs to change? Maybe there are some caveats we miss? What do you think @tzolov ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets say that environment variables have SPRING_DATASOURCE_URL and spring.datasource.url a `XXX_XXX_XXX takes precedence. Then this may be a symptom of how local deployer is setting properties into environment variables using dot style so it would override that but not the normal underscore type. Running apps in a same container is not so supported scenario being testing. Maybe local deployer could be setup not to inherit those database values automatically?

@jvalkeal
Copy link
Contributor

We should fix the issue on a local deployer as those environment inherit settings were wrongly removed a long time ago. That would be a proper fix and possible compose config could then choose what to inherit into local processes.

@ilayaperumalg
Copy link
Contributor

We have decided to apply the changes into local deployer. Hence, closing this here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants