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

fixing run.bat and run.sh #14451

Merged
merged 1 commit into from
Nov 9, 2015
Merged

fixing run.bat and run.sh #14451

merged 1 commit into from
Nov 9, 2015

Conversation

andrejserafim
Copy link
Contributor

fixed #14423

I'm a little new to gradle, so do double check I haven't missed something basic.

def runEsHome="${project.buildDir}/run-elastic"
mainClassName = "org.elasticsearch.bootstrap.Elasticsearch"
applicationDefaultJvmArgs = ["-Xms256m", "-Xmx1g", "-Djava.awt.headless=true", "-Delasticsearch", "-Des.foreground=yes",
"-ea", "-Des.path.home=" + runEsHome, "-Des.security.manager.enabled=false",
Copy link
Member

Choose a reason for hiding this comment

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

run.sh was good because it was "real". It run with the security manager and with bin/elasticsearch. So much real. Sadly this sacrifices a lot.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Interesting, good to know, let me play around with these options. I took them from someone's configuration in the build-tools.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think its hard to reproduce the previous behavior without fixing #14361 first, but afaik, @rjernst is working on that right now.

at a high level: thats' what the previous code did: invoke the "integration test setup" but passing "fork=false", passing different port numbers (the conventional 9200/9300), and passing some additional jvm args to enable the remote debugger.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've removed the test argument, but the security manager has to stay disabled unfortunately.

Another way would be take the fresh distribution, unpackage, run. But that sounds like an overkill at this stage.

At least the run scripts will start a node, it can be improved on later.

@rjernst
Copy link
Member

rjernst commented Nov 2, 2015

I think we should do this right, which means mimicking what we did before with maven. The framework is mostly already there, it just needs to be setup. This means creating a "run" task, which uses ClusterFormationTasks, and also stalls when the task is executed. Unfortunately, this won't work as nice until gradle fixes finalizedBy (https://discuss.gradle.org/t/run-finalizedby-when-task-is-interrupted-ctrl-c-continued-from-old-forum/12036), which means the cluster will remain alive until you run a follow up task...

@rjernst
Copy link
Member

rjernst commented Nov 2, 2015

Note that the task should also not be under core, but at the root, or under distribution, since it will need to depend on the zip distribution.

@andrejserafim
Copy link
Contributor Author

I was surprised it worked in core to be honest, I only put it there because I had classpath issues with the previous run task.

And now gradle is cheating on my behalf and I didn't even notice - it's gone off to the distribution module. Is there any way to enforce which modules should depend on which?

andrej@black:~/dev/elasticsearch/core$ gradle run
:buildSrc:compileJava UP-TO-DATE
:buildSrc:compileGroovy
:buildSrc:processResources UP-TO-DATE
:buildSrc:classes
:buildSrc:jar
:buildSrc:sourcesJar
:buildSrc:signArchives SKIPPED
:buildSrc:assemble
:buildSrc:compileTestJava UP-TO-DATE
:buildSrc:compileTestGroovy UP-TO-DATE
:buildSrc:processTestResources UP-TO-DATE
:buildSrc:testClasses UP-TO-DATE
:buildSrc:test UP-TO-DATE
:buildSrc:check UP-TO-DATE
:buildSrc:build
=======================================
Elasticsearch Build Hamster says Hello!
=======================================
  Gradle Version : 2.8
  JDK Version    : 1.8.0_66-b17 (Oracle Corporation)
  OS Info        : Linux 3.19.0-31-generic (amd64)
:core:compileJava UP-TO-DATE
:core:processResources UP-TO-DATE
:core:classes UP-TO-DATE
:core:jar
:distribution:zip:buildZip      <-------------- 
:core:run#setup
:core:run#clean
:core:run#configure
:core:run#start

@rjernst
Copy link
Member

rjernst commented Nov 3, 2015

It's not cheating. The cluster formation tasks add a dependency on the zip distribution. It's doing exactly what is expected. I just think it is confusing to have core depend on distribution (since it looks like a circular dep, even though it isn't in this case). So I would move the run task to either the root (my preference for ease of use) or distribution.

@andrejserafim
Copy link
Contributor Author

I've moved it to distribution, since if I move it to the root it can't find the zip.

* What went wrong:
Could not resolve all dependencies for configuration ':elasticsearchZip'.
> Cannot resolve external dependency org.elasticsearch.distribution.zip:elasticsearch:3.0.0-SNAPSHOT because no repositories are defined.
  Required by:
      org.elasticsearch:elasticsearch:3.0.0-SNAPSHOT

Is there something I can configure to make it work? - first time I'm working with gradle.

@rjernst
Copy link
Member

rjernst commented Nov 3, 2015

It tells you exactly the problem:

Cannot resolve ... because no repositories are defined.

However, rather than adding repositories to the root project, I think defining it under distribution is fine. We can even add a shortcut I think from the root file:

task run(dependsOn: ':distribution:runZip')

@andrejserafim
Copy link
Contributor Author

rebasing to master, uhh, that generated a lot of commits on the pr.

@rjernst
Copy link
Member

rjernst commented Nov 3, 2015

I think you just need to pull the latest master? Also, can you remove the run.sh and run.bat scripts? I don't think they are useful now (before they were saving from typing a complicated mvn command).

@rjernst
Copy link
Member

rjernst commented Nov 5, 2015

@andrejserafim This looks good, can you sync up with master and I will merge?

@andrejserafim
Copy link
Contributor Author

And done.

@rjernst
Copy link
Member

rjernst commented Nov 6, 2015

@andrejserafim, sorry to ask one more thing. I hadn't realized how many small noisy commits there are here. Can you rebase on master so there is one commit with a clear commit message?

@rjernst rjernst mentioned this pull request Nov 6, 2015
16 tasks
@clintongormley clintongormley added the :Delivery/Build Build or test infrastructure label Nov 8, 2015
run.sh and run.bat were calling out to the old maven build system.
This is no longer in place, so we've created new gradle tasks to
start an elasticsearch node from the current codebase.

fixed elastic#14423
@andrejserafim
Copy link
Contributor Author

@rjernst anything else?

rjernst added a commit that referenced this pull request Nov 9, 2015
Add gradle run command to replace run.bat and run.sh
@rjernst rjernst merged commit 7034fee into elastic:master Nov 9, 2015
@rjernst
Copy link
Member

rjernst commented Nov 9, 2015

Thank you @andrejserafim!!

@mark-vieira mark-vieira added the Team:Delivery Meta label for Delivery team label Nov 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Delivery/Build Build or test infrastructure Team:Delivery Meta label for Delivery team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Starting checked out elasticsearch cluster
6 participants