-
Notifications
You must be signed in to change notification settings - Fork 85
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
O3-339: Fix auto Docker setup in Sdk (Sorry Currently lost the commit in reabse. Trying to undo the commit) #296
Conversation
Thanks @kb019 . This code base is out of my depth. I'm adding @wikumChamith for this PR; feel free to add others along. The changes are simple enough, but we want to make sure it doesn't break other systems. @kb019 can you list out which platform (Windows 11?) / java version / mysql version (mysql v8.4.1?) you tested this change on? |
I Tested this on windows 11, using jdk 1.8. The mysql version is automatically setup by the jdk,I think its 8.4.1. Thanks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @wikumChamith . Thanks. I made the change because i was getting the below error when installing sdk. I think what your thinking is right. I will recheck on this change and get back to you. Thanks |
What is the server name you are using? |
Oh k got it. I was giving it as 1.Its mistake on my side.I will update the commit. Thanks. |
560f445
to
aa553c5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please update the PR and commit titles to reflect the ticket name?
https://openmrs.atlassian.net/wiki/spaces/docs/pages/25477199/Pull+Request+Tips
@@ -62,7 +64,9 @@ public void executeTask() throws MojoExecutionException { | |||
} | |||
|
|||
private boolean noMySqlImage(DockerClient docker) { | |||
List<Image> mysql = docker.listImagesCmd().withImageNameFilter(MYSQL_8_4_1).exec(); | |||
ListImagesCmd listImagesCmd = docker.listImagesCmd(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need these changes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes @wikumChamith . The withImageNameFilter doesnt seem to work.It returns all the images instead of only mysql images. The reference is here .Thanks
@@ -627,7 +627,7 @@ public String determineDbName(String uri, String serverId) throws MojoExecutionE | |||
} | |||
|
|||
dbName = dbName.substring(1); | |||
|
|||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this extra space
@@ -32,7 +32,7 @@ public class DockerHelper { | |||
public static final String DOCKER_MYSQL_PASSWORD = "Admin123"; | |||
private static final String DOCKER_HOST_KEY = "dockerHost"; | |||
public static final String DEFAULT_DOCKER_HOST_UNIX_SOCKET = "unix:///var/run/docker.sock"; | |||
public static final String DEFAULT_HOST_DOCKER_FOR_WINDOWS = "http://127.0.0.1:2375/"; | |||
public static final String DEFAULT_HOST_DOCKER_FOR_WINDOWS = "tcp://127.0.0.1:2375/"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to be careful with this. It isn't universally true (i.e., the default value here is accurate for some Docker setups, depending on the version of Docker installed). Better would probably be to switch the Docker library to auto-detecting as much as possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok @ibacher .I will look into that. Thanks
aa553c5
to
4538e2b
Compare
4538e2b
to
7e10aaf
Compare
Description of what I changed
When setting up openmrs sdk by running mvn org.openmrs.maven.plugins:openmrs-sdk-maven-plugin:5.14.0-SNAPSHOT:setup i get a bunch of errors.
The first one is protocol unsupported error → This is because we use http instead of tcp to talk to docker daemon
Once the protocol error is tackeled we get the mysql image not found error ->The withImageFilterCommand doesn't seem to work. Reference With Docker 20.10.0 listImages filter no longer works · Issue #1516 · docker-java/docker-java
Finally we get the db name is incorrect error → I think we are again performing a slice on a already sliced db name
Openmrs Talk Link - OpenMRS SDK installation_BUILD FAILURE_Failed to setup server
Issue I worked on
https://openmrs.atlassian.net/browse/SDK-339
Checklist: I completed these to help reviewers :)
My IDE is configured to follow the code style of this project.
No? Unsure? -> configure your IDE, format the code and add the changes with
git add . && git commit --amend
I have added tests to cover my changes. (If you refactored
existing code that was well tested you do not have to add tests)
No? -> write tests and add them to this commit
git add . && git commit --amend
I ran
mvn clean install
right before creating this pull request andadded all formatting changes to my commit.
No? -> execute the above command
All new and existing tests passed.
No? -> figure out why and add the fix to your commit. It is your responsibility to make sure your code works.
My pull request is based on the latest changes of the master branch.
No? Unsure? -> execute command
git pull --rebase upstream master
Video.1.mp4
Video.2.1.mp4
co-credit - @chibongho