====== WildFly ======
WildFly je komunitní fork a pokračování JBoss Application Server 7.1.1.
**Homepage:** http://wildfly.org/
===== Integrace s NetBeans =====
==== WildFly ====
- stáhnout aktuální verzi (8.2.0.Final) z http://wildfly.org/downloads/
- rozbalit např. do C:\work\JAVA\as\wildfly-8.2.0.Final
==== NetBeans ====
1. menu **Tools** -> **Servers** -> kliknout na **Add server...**
{{::netbeans-wildfly-01.png?600|}}
2. vybart **WildFly Application Server** -> pokračovat **Next >**
{{::netbeans-wildfly-02.png?600|}}
3. vybrat umístění serveru **Server Location** a jeho konfigurace **Server Configuration**, pokračovat **Next >**
**Server Location:** C:\work\JAVA\as\wildfly-8.2.0.Final\\
**Server Configuration:** C:\work\JAVA\as\wildfly-8.2.0.Final\standalone\configuration\standalone-full.xml
{{::netbeans-wildfly-03.png?600|}}
4. nastavení serveru
Ponecháme **Host:** localhost, protože chceme mít aplikační server lokálně pro vývoj, **Port:** 8080 si můžeme nastavit na jiný, pokud nám na výchozím již nějakou službu provozujeme (jiný AS, Jenkins, apod.).
{{::netbeans-wildfly-04.png?600|}}
5. hotovo, aplikační server bude nyní dostupný pro výběr u nového nebo současného projektu v NetBeans
===== Instalace na CentOS 7 =====
Aplikační server WildFly pro JAVA EE aplikace.
==== ORACLE JAVA 1.8 pro WildFly ====
Download: http://www.oracle.com/technetwork/java/javase/downloads/index.html
shell# mkdir /opt/java-wildfly
shell# cp /data/install/java/jdk-8u131-linux-x64.tar.gz /opt/java-wildfly
shell# cd /opt/java-wildfly
shell# tar xvzf jdk-8u131-linux-x64.tar.gz
shell# chown -R root:0 /opt/java-wildfly
**Nastavení výchozí JAVA**
shell# alternatives --install /usr/bin/java java /opt/java-wildfly/jdk1.8.0_131/bin/java 1
==== WildFly 10 ====
Download: http://wildfly.org/downloads
Stáhnout verzi 10.1.0 Final Java EE7 Full & Web Distribution.
**Rozbalení staženého WildFly v /opt**
shell# cp /data/install/wildfly/wildfly-10.1.0.Final.zip /opt
shell# cd /opt
shell# unzip /opt/wildfly-10.1.0.Final.zip
**Vytvoření uživatele wildfly**
shell# useradd -m -d /opt/wildfly-10.1.0.Final -s /bin/bash wildfly
**Nastavení práv vlastníka**
shell# chown -R wildfly:wildfly /opt/wildfly-10.1.0.Final
**Úprava konfigurace /etc/sysconfig/wildfly**
JBOSS_USER=wildfly
JBOSS_HOME=/opt/wildfly-10.1.0.Final
STARTUP_WAIT=60
SHUTDOWN_WAIT=60
JBOSS_CONSOLE_LOG="/var/log/wildfly/console.log"
**Úprava /opt/wildfly-10.1.0.Final/bin/wildfly-init-redhat.sh**
shell# cp /opt/wildfly-10.1.0.Final/docs/contrib/scripts/init.d/wildfly-init-redhat.sh /opt/wildfly-10.1.0.Final/bin/wildfly-init-redhat.sh
WILDFLY_NAME=wildfly
JBOSS_CONF="/etc/sysconfig/wildfly"
**Vytvoření /etc/profile.d/wildfly.sh**
Nastavení proměnných pro WildFly a JAVA cest.
# wildfly java
JAVA_HOME=/opt/java-wildfly/jdk1.8.0_131
PATH=$PATH:$JAVA_HOME/bin
CLASSPATH=$JAVA_HOME/lib
LD_LIBRARY_PATH=$JAVA_HOME/jre/lib
export JAVA_HOME PATH CLASSPATH LD_LIBRARY_PATH
# wildfly settings
JBOSS_HOME=/opt/wildfly-10.1.0.Final
PATH=$PATH:$JBOSS_HOME/bin
export JBOSS_HOME PATH
**Vytvoření adresářů pro log a běh**
shell# mkdir /var/log/wildfly
shell# mkdir /var/run/wildfly
shell# chown -R wildfly:wildfly /var/log/wildfly
shell# chown -R wildfly:root /var/run/wildfly
**Konfigurace /opt/wildfly-10.1.0.Final/standalone/configuration/standalone.xml**
0.0.0.0 platí pro všechna rozhraní.
**Vytvoření service skriptu pro systemd**
[Unit]
Description=WildFly Application Server
After=syslog.target network.target
Before=httpd.service
[Service]
Type=forking
User=root
PIDFile=/var/run/wildfly/wildfly.pid
ExecStop=/opt/wildfly-10.1.0.Final/bin/wildfly-init-redhat.sh stop
ExecStart=/opt/wildfly-10.1.0.Final/bin/wildfly-init-redhat.sh start
[Install]
WantedBy=multi-user.target
**Systemd service wildfly**
shell# systemctl daemon-reload
shell# systemctl start wildfly.service
shell# systemctl status wildfly.service
shell# systemctl enable wildfly.service
===== HTTPS Let's encrypt =====
https://example.com:8443
[[let-s-encrypt#novy-certifikat|Vygenerování certifikátu Let's encrypt (netcat)]]
Převod z PEM na P12 (zadat heslo pro export ... netriviální)
shell# openssl pkcs12 -export -in /root/.acme.sh/example.com_ecc/fullchain.cer -inkey /root/.acme.sh/example.com_ecc/example.com.key -out wildfly.p12 -name wildfly
Vytvoření keystore (storepass, keypass ... netriviální hesla)
shell# /opt/java-wildfly/jdk1.8.0_131/bin/keytool -importkeystore -deststorepass storepass -destkeypass keypass -destkeystore wildfly.jks -srckeystore wildfly.p12 -srcstoretype PKCS12 -srcstorepass heslo_export_p12 -alias wildfly
Nakopírování keystore do adresáře s konfigurací WildFly
shell# cp wildfly.jks /opt/wildfly/standalone/configuration/
Úprava konfigurace WildFly
===== Web management =====
https://example.com:9990
shell# /opt/wildfly-10.1.0.Final/bin/add-user.sh
What type of user do you wish to add?
a) Management User (mgmt-users.properties)
b) Application User (application-users.properties)
(a): a
Enter the details of the new user to add.
Using realm 'ManagementRealm' as discovered from the existing property files.
Username : blazek
Password recommendations are listed below. To modify these restrictions edit the add-user.properties configuration file.
- The password should be different from the username
- The password should not be one of the following restricted values {root, admin, administrator}
- The password should contain at least 8 characters, 1 alphabetic character(s), 1 digit(s), 1 non-alphanumeric symbol(s)
Password :
Re-enter Password :
What groups do you want this user to belong to? (Please enter a comma separated list, or leave blank for none)[ ]:
About to add user 'blazek' for realm 'ManagementRealm'
Is this correct yes/no? yes
Added user 'blazek' to file '/opt/wildfly-10.1.0.Final/standalone/configuration/mgmt-users.properties'
Added user 'blazek' with groups to file '/opt/wildfly-10.1.0.Final/standalone/configuration/mgmt-groups.properties'
Is this new user going to be used for one AS process to connect to another AS process?
e.g. for a slave host controller connecting to the master or for a Remoting connection for server to server EJB calls.
yes/no? yes
To represent the user add the following to the server-identities definition