|
|
|
# Payara
|
|
|
|
You can find Payara at [payara.mphslaats.com](https://payara.mphslaats.com). If you want to view the deployed websites you have to go to [app.mphslaats.com](https://app.mphslaats.com).
|
|
|
|
|
|
|
|
# Table of contents
|
|
|
|
- [Payara](#payara)
|
|
|
|
- [Table of contents](#table-of-contents)
|
|
|
|
- [Resources](#resources)
|
|
|
|
- [Ports](#ports)
|
|
|
|
- [Installation](#installation)
|
|
|
|
- [Deploy from Jenkins](#deploy-from-jenkins)
|
|
|
|
- [pom.xml](#pomxml)
|
|
|
|
- [sshpass](#sshpass)
|
|
|
|
|
|
|
|
## Resources
|
|
|
|
It is [recommended](http://info.payara.fish/hubfs/Payara_Server_Data_Sheet.pdf) to use at least 512 MB of RAM for Payara. I chose to give it 1 GB RAM and 1 CPU core.
|
|
|
|
|
|
|
|
## Ports
|
|
|
|
By default the Payara management website runs on port 4848 and the deployed websites run on 8080. However Payara is a website therefore you only need to add a new server section to the Proxy server.
|
|
|
|
|
|
|
|
## Installation
|
|
|
|
* Now we will install Java by using `apt-get install openjdk-8-jdk`;
|
|
|
|
* Go to https://www.payara.fish/all_downloads and find the latest version of Payara, now download it by using `wget https://s3-eu-west-1.amazonaws.com/payara.fish/Payara+Downloads/Payara+4.1.2.181/payara-4.1.2.181.tar.gz`;
|
|
|
|
* Extract Payara by using `tar -xf payara-4.1.2.181.tar.gz`;
|
|
|
|
* Now test Payara by going to `payara41/glassfish/bin` and run `./asadmin start-domain`;
|
|
|
|
* Change the admin password by using `./asadmin change-admin-password`;
|
|
|
|
* Enable HTTPS by using `./asadmin enable-secure-admin`;
|
|
|
|
* To apply the changes run `./asadmin restart-domain`.
|
|
|
|
|
|
|
|
## Deploy from Jenkins
|
|
|
|
### pom.xml
|
|
|
|
Add the following plugin to your `pom.xml`, do not forget to set the properties:
|
|
|
|
```xml
|
|
|
|
<!-- Deploy server configuration -->
|
|
|
|
<project>
|
|
|
|
<build>
|
|
|
|
<plugin>
|
|
|
|
<plugin>
|
|
|
|
<!-- https://mvnrepository.com/artifact/org.codehaus.cargo/cargo-maven2-plugin -->
|
|
|
|
<groupId>org.codehaus.cargo</groupId>
|
|
|
|
<artifactId>cargo-maven2-plugin</artifactId>
|
|
|
|
<version>1.7.3</version>
|
|
|
|
<configuration>
|
|
|
|
<container>
|
|
|
|
<containerId>glassfish5x</containerId>
|
|
|
|
<type>remote</type>
|
|
|
|
</container>
|
|
|
|
<configuration>
|
|
|
|
<type>runtime</type>
|
|
|
|
<properties>
|
|
|
|
<cargo.hostname>${payara.hostname}</cargo.hostname>
|
|
|
|
<cargo.remote.username>${payara.username}</cargo.remote.username>
|
|
|
|
<cargo.remote.password><![CDATA[${payara.password}]]></cargo.remote.password>
|
|
|
|
<cargo.glassfish.domain.name>/${contextroot}</cargo.glassfish.domain.name>
|
|
|
|
</properties>
|
|
|
|
</configuration>
|
|
|
|
<deployables>
|
|
|
|
<deployable>
|
|
|
|
<groupId>${project.groupId}</groupId>
|
|
|
|
<artifactId>${project.artifactId}</artifactId>
|
|
|
|
<type>war</type>
|
|
|
|
<properties>
|
|
|
|
<context>/${contextroot}</context>
|
|
|
|
</properties>
|
|
|
|
</deployable>
|
|
|
|
</deployables>
|
|
|
|
</configuration>
|
|
|
|
<dependencies>
|
|
|
|
<!-- https://mvnrepository.com/artifact/org.glassfish.main.deployment/deployment-client -->
|
|
|
|
<dependency>
|
|
|
|
<groupId>org.glassfish.main.deployment</groupId>
|
|
|
|
<artifactId>deployment-client</artifactId>
|
|
|
|
<version>5.1.0</version>
|
|
|
|
</dependency>
|
|
|
|
</dependencies>
|
|
|
|
</plugin>
|
|
|
|
</plugins>
|
|
|
|
</build>
|
|
|
|
</project>
|
|
|
|
```
|
|
|
|
Now go yo your Jenkins job and set `clean install cargo:redeploy -e` as Build goal.
|
|
|
|
|
|
|
|
### sshpass
|
|
|
|
* Go to the Jenkins terminal and install `sshpass` by using `apt-get instal sshpass`;
|
|
|
|
* Now login as the Jenkins user using `su jenkins`;
|
|
|
|
* SCP a test file to Payara and accept the key;
|
|
|
|
* Now go to the Jenkins website and create a Deploy item;
|
|
|
|
* Add Execute shell as a Post Step and use the following command: `sshpass -p "****" scp ./target/*.war root@<IP-address>:payara41/glassfish/domains/domain1/autodeploy/`. This will copy the created war file to the autodeploy folder from Payara. |
|
|
|
\ No newline at end of file |