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

Add a new profile to deploy to Payara Fish #7

Open
arun-gupta opened this issue Dec 3, 2015 · 13 comments
Open

Add a new profile to deploy to Payara Fish #7

arun-gupta opened this issue Dec 3, 2015 · 13 comments

Comments

@arun-gupta
Copy link
Owner

Possibly @mikecroft can help

@mikecroft
Copy link

Sure, happy to help out! I'm not that familiar with Maven, but I'll see what I can come up with

@OndroMih
Copy link

OndroMih commented Dec 5, 2015

Hi @arun-gupta, @mikecroft, I followed your communication over Twitter and found this issue to be an interesting exercise to play with docker and payara. It seems that with normal payara distribution, the standard glassfish maven plugin can be used as is (although it requires local installation of glassfish or payara with asadmin command).

With payara-micro, it should be enough to copy artifact into the docker instance. I will look into it later too. I think the best approach would be to mount a local folder as a docker volume, link it to payara deployment dir inside the docker, and then only copy the artifact to the local folder in order to deploy.

@arun-gupta
Copy link
Owner Author

@OndrejM thanks for contributing.

Requiring a local and manual install restricts the usability of this sample. Can you look at http://lauraliparulo.altervista.org/glassfish-4-0-hello-world-application-with-maven-3/ and see if no local installs are required?

@OndroMih
Copy link

OndroMih commented Dec 7, 2015

Hi Arun,
I am also not happy about it but this is the way how the glassfish maven plugin is implemented. It is simply a wrapper around asadmin command that exists in the server installation.

Another option is deploying asynchronously by copying the file over to the deployment directory inside docket. This could be done even with payara-micro, which has half the size of standard Payara image. Should I give it a try? Would that be a viable option?

----- Pôvodná správa -----
Od: "Arun Gupta" notifications@github.com
Odoslané: ‎7.‎12.‎2015 21:12
Komu: "arun-gupta/couchbase-javaee" couchbase-javaee@noreply.github.com
Kópia: "Ondrej Mihályi" ondrej.mihalyi@gmail.com
Predmet: Re: [couchbase-javaee] Add a new profile to deploy to Payara Fish(#7)

@OndrejM thanks for contributing.
Requiring a local and manual install restricts the usability of this sample. Can you look at http://lauraliparulo.altervista.org/glassfish-4-0-hello-world-application-with-maven-3/ and see if no local installs are required?

Reply to this email directly or view it on GitHub.

@arun-gupta
Copy link
Owner Author

@OndrejM https://maven-glassfish-plugin.java.net/usage.html does not seem to mention that GlassFish/Payara download is required. Mounting a local directory again introduces a local dependency. Any version of Payara where this application can be deployed will work.

@OndroMih
Copy link

OndroMih commented Dec 7, 2015

@arun-gupta, the usage site does not mention it, but path to local glassfish installation is a required parameter to the deploy goal: https://maven-glassfish-plugin.java.net/deploy-mojo.html#glassfishDirectory

@arun-gupta
Copy link
Owner Author

@OndrejM that is pretty lame! I don't expect glassfish-maven-plugin to be fixed in the near future given the current state at Oracle. Wondering if @mikecroft or @smillidge have any suggestions?

@OndroMih
Copy link

OndroMih commented Dec 7, 2015

The jar file, which is wrapped by asadmin script, is available in maven: http://search.maven.org/#artifactdetails|org.glassfish.main.admin|appserver-cli|4.1.1|glassfish-jar. It should not be much work to use it directly to deploy to Glassfish/Payara, instead of the maven plugin. Or even to patch maven plugin to use the JAR from maven central instead of from local glassfish installation.

@mikecroft
Copy link

Not being familiar with Maven, I'm not sure exactly what you can bend it to do, but you could always deploy via the REST api. A cURL POST should work like in this example:
http://blogs.steeplesoft.com/posts/2011/deploying-applications-to-glassfish-using-curl.html

@arun-gupta
Copy link
Owner Author

@mikecroft cURL would certainly be awesome. Do you have docs on how to deploy to Payara using REST?

@mikecroft
Copy link

No specific Payara docs, but any GlassFish docs will still be valid. So if you go to https://localhost:4848/management/domain/applications/deploy you'll get a basic HTML form wrapper for the REST interface.

The only required property is id, which is indicated by the asterisk next to it. Unintuitively, id in this case means the path to the WAR you want to POST and deploy. You'll probably also want to target it to the default server as well so, based on the example in that blog, you'd have something like this:

curl -s -S \
    -H 'Accept: application/json' -X POST \
    -H 'X-Requested-By: dummy' \
    -F id=@/path/to/application.war \
    -F target=server \
    -F force=true \
    http://localhost:4848/management/domain/applications/application

@OndroMih
Copy link

Glassfish documentation about REST administration interface can be found in this PDF https://glassfish.java.net/docs/4.0/administration-guide.pdf - section Using REST Interfaces to Administer GlassFish Server. But it is rather generic, you would need to know the resources you need to modify. In this case, the resource is to deploy applications is applications/application. Operations on resources are not documented in PDF, but can be retrieved from running server via GET method in JSON format - methods attribute in the JSON provides all available methods and attributes (the way how to retrieve this information is documented in the PDF).

@OndroMih
Copy link

OndroMih commented Jan 1, 2016

Hi @arun-gupta, I managed t use cargo maven plugin to deploy to Payara without the requirement of local Payara installation. The cargo maven plugin uses JSR88 API present in deployment-client artefact, which is available in maven central. See my pull request #9

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

No branches or pull requests

3 participants