https://kotlinlang.org logo
Title
b

Brian Estrada

05/09/2023, 2:01 PM
hey everyone, does anyone have experience running flyway + mysql inside of a shadow jar? i’ve really been struggling to get the two to work with ktor, we are also using micronaut and in there it seems to work fine but as far as I know they’re not using shadowJar to run the application
I get some wierd errors with the migration not being named correctly, or H2 drivers not being found
it runs perfectly locally (i.e through the IDE) but as soon as it’s turned into a jar everything goes crazy… I’ve tried a lot of things but none of them have seemed to work any help would be appreciated 🙏
a

Andrew O'Hara

05/09/2023, 2:03 PM
An error about H2 might suggest your connection string is set to h2 rather than mysql. Is there any difference in how your config is injected between your IDE and jar invocations?
b

Brian Estrada

05/09/2023, 2:04 PM
well both work locally! (H2 and MySQL jdbc)
I’m using an .env file to inject the env vars
DATABASE_URL=jdbc:h2:mem:test;MODE=MySQL;DATABASE_TO_LOWER=TRUE;CASE_INSENSITIVE_IDENTIFIERS=TRUE;DB_CLOSE_DELAY=-1;
DATABASE_USER=sa
DATABASE_PASSWORD=

DATABASE_URL=jdbc:<mysql://localhost/solar?serverTimezone=UTC>
DATABASE_USER=root
DATABASE_PASSWORD=password
and then using the same env file inside of docker (that’s running the shadowJar) so as far as I know it’s all the same minus the fact that one is running in the IDE and the other is running inside of docker using the shadowJar
a

Andrew O'Hara

05/09/2023, 2:07 PM
Are those two sets of vars in the same file?
b

Brian Estrada

05/09/2023, 2:07 PM
oh sorry I have both of them in the above just to show the different configurations but they’re commented out based on which one I want to test
a

Andrew O'Hara

05/09/2023, 2:08 PM
Not sure then 🤷 . Hope you get some help.
b

Brian Estrada

05/09/2023, 2:08 PM
Me either 😒ad-panda:
thanks tho!
a

Andrew O'Hara

05/09/2023, 2:08 PM
You might get better help elsewhere though. This issue doesn't really have anything to do with ktor.
Maybe #server