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

SSL to MySQL from CLI: need to add extra arguments #2788

Closed
vazhnov opened this issue Apr 26, 2020 · 6 comments
Closed

SSL to MySQL from CLI: need to add extra arguments #2788

vazhnov opened this issue Apr 26, 2020 · 6 comments

Comments

@vazhnov
Copy link

vazhnov commented Apr 26, 2020

Which version and edition of Flyway are you using?

Flyway Community Edition 6.4.0 by Redgate

If this is not the latest version, can you reproduce the issue with the latest one as well?
Which client are you using? (Command-line, Java API, Maven plugin, Gradle plugin)

Command-line.

Which database are you using (type & version)?

AWS RDS MySQL 5.7.22.

Which operating system are you using?
 $ cat /etc/os-release 
PRETTY_NAME="Devuan GNU/Linux 3 (beowulf)"
NAME="Devuan GNU/Linux"
VERSION_ID="3"
VERSION="3 (beowulf)"
VERSION_CODENAME=beowulf
ID=debian
ID_LIKE=debian
HOME_URL="https://www.devuan.org/"
SUPPORT_URL="https://devuan.org/os/community"
BUG_REPORT_URL="https://bugs.devuan.org/"
What did you do?
What did you expect to see?
What did you see instead?

I've successfully established SSL connection to AWS RDS with Flyway CLI, but I had to edit shell-script https://github.com/flyway/flyway/blob/master/flyway-commandline/src/main/assembly/flyway to add extra arguments:

EXTRA_ARGS=
if $linux; then
  EXTRA_ARGS=-Djava.security.egd=file:/dev/../dev/urandom
fi
EXTRA_ARGS="$EXTRA_ARGS -Djavax.net.ssl.trustStore=~/aws_rds_truststore.jks -Djavax.net.ssl.trustStorePassword=changeit"

if `command -v cygpath > /dev/null`; then CP=`cygpath -pw "$CP"`; fi
"$JAVA_CMD" $JAVA_ARGS $EXTRA_ARGS -cp "$CP" org.flywaydb.commandline.Main "$@"

Could you please add possibility to add arguments without patching your shell script?

For example, by FLYWAY_EXTRA_ARGS:

EXTRA_ARGS=${FLYWAY_EXTRA_ARGS:=}
if $linux; then
  EXTRA_ARGS="$EXTRA_ARGS -Djava.security.egd=file:/dev/../dev/urandom"
fi

Then I will create documentation how to connect Flyway to MySQL with SSL.

@vazhnov vazhnov changed the title SSL to MySQL: need to add extra arguments SSL to MySQL from CLI: need to add extra arguments Apr 26, 2020
@vazhnov
Copy link
Author

vazhnov commented Apr 26, 2020

Pull request: #2789.

@MikielAgutu
Copy link

Thanks for reporting this. Ideally we'd like to add built in support for things like this, instead of allowing arbitrary extra arguments, properties, etc. Is this the only reason you'd like the 'extra arg' feature?

@vazhnov
Copy link
Author

vazhnov commented Apr 27, 2020

@MikielAgutu , yes, right now I need to add SSL support to Flyway CLI only, I see no other reason for this patch.

@MikielAgutu MikielAgutu added this to the Flyway 6.x milestone Apr 27, 2020
@MikielAgutu
Copy link

Have you seen #1727? Apparently this has come up before a while ago. You can use the JAVA_ARGS environment variable.

@vazhnov
Copy link
Author

vazhnov commented Apr 30, 2020

@MikielAgutu , JAVA_ARGS looks good! Let me check…

@vazhnov
Copy link
Author

vazhnov commented Apr 30, 2020

export JAVA_ARGS="-Djavax.net.ssl.trustStore=~/aws_rds_truststore.jks -Djavax.net.ssl.trustStorePassword=changeit"

works fine. Thank you very much!

@vazhnov vazhnov closed this as completed Apr 30, 2020
@MikielAgutu MikielAgutu removed this from the Flyway 6.x milestone May 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants