zmoog / public-notes

Apache License 2.0
0 stars 1 forks source link

Figure out how to install Elastic APM on Wildfly #58

Open zmoog opened 8 months ago

zmoog commented 8 months ago

I have a Wildfly application server 26.1.3 and I want to use Elastic APM to collect data.

zmoog commented 8 months ago

The first step is to install Wildfly application server. I'll use my tiny old Intel NUC running Ubuntu 20.04.6 LTS, but I think the OS doesn't matter that much from the APM perspective.

zmoog commented 8 months ago

I'll use the following guide: https://linux.how2shout.com/install-wildfly-application-server-on-ubuntu-20-04-22-04-lts/

zmoog commented 8 months ago

Install Wildfly

Pick a Wildfly release version:

export WILDFLY_RELEASE="26.1.3.Final"

Install OpenJDK 11

sudo apt install default-jdk

$ java -version
openjdk version "11.0.20.1" 2023-08-24
OpenJDK Runtime Environment (build 11.0.20.1+1-post-Ubuntu-0ubuntu120.04)
OpenJDK 64-Bit Server VM (build 11.0.20.1+1-post-Ubuntu-0ubuntu120.04, mixed mode, sharing)

Download Wildfly:

wget https://github.com/wildfly/wildfly/releases/download/${WILDFLY_RELEASE}/wildfly-${WILDFLY_RELEASE}.tar.gz

The tarball size is 207M.

Extract the Tar file and move it to the target dir:

tar -xf wildfly-*.Final.tar.gz

sudo mv wildfly-*Final /opt/wildfly

Created a dedicated WildFly user:

sudo groupadd -r wildfly

sudo useradd -r -g wildfly -d /opt/wildfly -s /sbin/nologin wildfly

Ownership:

sudo chown -RH wildfly:wildfly /opt/wildfly

Configure:

sudo mkdir -p /etc/wildfly

sudo cp /opt/wildfly/docs/contrib/scripts/systemd/wildfly.conf /etc/wildfly/

sudo cp /opt/wildfly/docs/contrib/scripts/systemd/wildfly.service /etc/systemd/system/

sudo cp /opt/wildfly/docs/contrib/scripts/systemd/launch.sh /opt/wildfly/bin/

Make the script executable:

sudo chmod +x /opt/wildfly/bin/*.sh

Start and Enable the Service:

sudo systemctl enable --now wildfly

sudo systemctl daemon-reload

systemctl status wildfly

Create WildFly Management Console and Application user:

sh /opt/wildfly/bin/add-user.sh

Access WildFly Remotely:

# replace 127.0.0.1 with 0.0.0.0 in the following file
# (this is for testing only, no security concerns here, but
# don't to in production environments):
sudo vi /opt/wildfly/standalone/configuration/standalone.xml

sudo systemctl restart wildfly