I get a war file daily and deploy it on glass fish server via Remote Desktop connection (Windows server). I want make it do auto deployment e.g I just put war file on some predefined location and run script and that script deploy latest war and restart glass fish server as well.
So what should I do? Any batch script or any other script?
You can put your WAR file in the auto deploy folder of GlassFish:
as-install/domains/domain1/autodeploy
Or you can use a script to deploy with the asadmin tool
Or you can use the REST interface to deploy:
curl -s -S \
-H 'Accept: application/json' -X POST \
-H 'X-Requested-By: dummy' \
-F id=#/path/to/application.war \
-F force=true http://localhost:4848/management/domain/applications/application
Related
I am using sonar webapi to associate a project with a quality profile but not able to do it. On every run of sonnar-scanner it is associating default quality profile. Below is the code snippet.
Updated the code snippet
curl -k -X POST --insecure -H “X-Auth-Token:XXX” -d "language=py" -d "qualityProfile=test_profile" -d “project=test_1.0” https://sonartest.xxx.com/api/qualityprofiles/add_project
I am not sure what I am doing wrong. I have administrative access and followed the webapi of Version 6.7.3 (build 38370)
Finally got some help from Soanrqube community. I need to remove X-Auth-Token from code. It should be something like this
curl -u ur_token: -X POST -d language=py -d qualityProfile=test_profile -d projectKey=${params.ProjectName} https://sonar-url.com/api/qualityprofiles/add_project
On the /user/usr1/ path in HDFS, I placed two scripts pySparkScript.py and relatedModule.py. relatedModule.py is a python module which will be imported into pySparkScript.py.
I can run the scripts with spark-submit pySparkScript.py
However, I need to run these scripts through Livy. Normally, I run single scripts successfully as the following:
curl -H "Content-Type:application/json" -X POST -d '{"file": "/user/usr1/pySparkScript.py"}' livyNodeAddress/batches
However, when I run the above code, as soon as it gets to import relatedModule.py it fails. I realize I should give the path to the relatedModule also in the parameters of Livy. I tried the following option:
curl -H "Content-Type:application/json" -X POST -d '{"file": "/user/usr1/pySparkScript.py", "files": ["/user/usr1/relatedModule.py"]}' livyNodeAddress/batches
How should I pass both files to Livy?
Try to use pyFiles property.
Please refer Livy REST API docs.
I would like to be able to deploy reports to jasperserver using some kind of scripts, not via the Jaspersoft Studio GUI
I tried
js-export --uris /reports --output-dir myExportedReports
hoping to re-import the same.
However, while exploring the myExportedReports folder, there were only *.xml and associated *.data files without the original *.jrxml.
Did anyone deploy new reports (report folders) to Jasper Server without using Jaspersoft Studio?
So I checked out the Jasper Server REST interface.
It looks like a two steps process
Upload the JRXML file
JRXML_DATA=`cat "report.jrxml"`
curl -X POST http://localhost:8080/jasperserver/rest_v2/resources/reports/ \
-H "Content-Type:application/jrxml" \
-H "Content-Disposition:attachment; filename=My-report" \
-H "Content-Description:My-report-description" \
-d "$JRXML_DATA" \
--user jasperadmin:jasperadmin
Create the Report Unit and assign a data source
curl -X POST http://localhost:8080/jasperserver/rest_v2/resources/reports \
-H "Content-Type:application/repository.reportUnit+json" \
-d '{"uri": "/reports/my_report","label": "my-report","description": "My-report description", "permissionMask": "0", "version": "0" , "alwaysPromptControls": "true","controlsLayout": "popupScreen", "jrxml": {"jrxmlFileReference": { "uri": "/reports/my-report"} },"dataSource": {"dataSourceReference": { "uri": "/datasources/Reporting_DB"}}}' \
--user jasperadmin:jasperadmin
We're building a package with Jenkins on a linux slave, and want to upload the package to an Octopus instance, but we don't have access to Nuget or Powershell on the linux box.
The Octopus examples say you can do this by
$wc = new-object System.Net.WebClient
$wc.UploadFile("http://octopus.example.com/api/packages/raw?apiKey=<Your API Key>", "YourApp.1.0.0.zip")
Can I do this with curl?
Yes, the following is the curl equivalent.
curl -X POST \
-H "X-Octopus-ApiKey: <Your API Key>" \
-F "file=#\"YourApp.1.0.0.zip\";filename=\"YourApp.1.0.0.zip\";type=application/zip" \
http://octopus.example.com/api/packages/raw?replace=true
I've spent far more time on this than I care to admit. I am trying to just deploy one file into my Artifactory server from the command line. I'm doing this using gradle because that is how we manage our java builds. However, this artifact is an NDK/JNI build artifact, and does not use gradle.
So I just need the simplest gradle script to do the deploy. Something equivalent to:
scp <file> <remote>
I am currently trying to use the artifactory plugin, and am having little luck in locating a reference for the plugin.
curl POST did not work for me . PUT worked correctly . The usage is
curl -X PUT $SERVER/$PATH/$FILE --data-binary #localfile
example :
$ curl -v --user username:password --data-binary #local-file -X PUT "http://<artifactory server >/artifactory/abc-snapshot-local/remotepath/remotefile"
Instead of using the curl command, I recommend using the jfrog CLI.
Download from here - https://www.jfrog.com/getcli/ and use the following command (make sure the file is executable) -
./jfrog rt u <file-name> <upload-path>
Here is a simple example:
./jfrog rt u sample-service-1.0.0.jar libs-release-local/com/sample-service/1.0.0/
You will be prompted for credentials and the repo URL the first time.
You can do lots of other stuff with this CLI tool. Check out the detailed instructions here - https://www.jfrog.com/confluence/display/RTF/JFrog+CLI.
The documentation for the artifactory plugin can be found, as expected, in Artifactory User Guide.
Please note that it is adviced to use the newer plugin - artifactory-publish, which supports the new Gradle publishing model.
Regarding uploading from the command line, you really don't need gradle for that. You can execute a simple PUT query using CURL or any other tool.
And of course if you just want to get your file into Artifactory, you can always deploy it via the UI.
Take a look the Artifactory REST API, mostly you can't use scp command, instead use the curl command towards REST API.
$ curl -X POST $SERVER/$PATH/$FILE --data #localfile
Mostly it looks like
$ curl -X POST http://localhost:8081/artifactory/abc-snapshot-local/remotepath/remotefile --data #localfile
The scp command is only used if you really want to access the internal folder which is managed by artifactory
$ curl -v -X PUT \
--user username:password \
--upload-file <path to your file> \
http://localhost:8080/artifactory/libs-release-local/my/jar/1.0/jar-1.0.jar
Ironically, I'm answering my own question. After a couple more hours working on the problem, I found a sample project on github: https://github.com/JFrogDev/project-examples
The project even includes a straightforward bash script for doing the exact deploy/copy from the command line that I was looking for, as well as a couple of less straightforward gradle scripts.
As per official docs, You can upload any file using the following command:
curl -u username:password -T <PATH_TO_FILE> "https://<ARTIFACTORY_SERVER>/<REPOSITORY_PATH>/<TARGET_FILE>"
Note: The user should have write access to this path.