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

OF-2526 Support SystemD for Debian #2563

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

stokito
Copy link
Contributor

@stokito stokito commented Oct 19, 2024

https://igniterealtime.atlassian.net/browse/OF-2526

I added the openfire.service to run the Openfire directly from SystemD.
The init.d script remains and even installed but it looks like it's not used if the unit's service file exists.
The SystemD itself will call the openfire.sh script. So I added the script to be installed into /usr/share/openfire/bin/openfire.sh. The script itself is has a problem with detection of OPENFIRE_HOME when the value of the var is overwritten few times. I didn't fixed that.

The existing file /etc/default/openfire is also supported by the SystemD unit.

There are additional commits to improve:

  1. Use Runtive.version() to compare JRE version. It works correctly with 23-ea JDK version.
  2. Added UFW firewall rules to make it easier to open ports. The Openfire has a lot of ports and it's difficult to collect the full list of them. The 8010 port is mentioned as Direct File Transfers and I'm not sure if this is a server thing of c2c connections. I added it anyway.
  3. Added openfire.slice file to easier limit resources by editing it with sudo systemctl edit openfire.slice. The JRE by default uses only 25% of total RAM. So many servers may simply not use the whole RAM that they have. We may change this with Java's -Xmx but I think it would be more correct to use the whole RAM with the -XX:MaxRAMPercentage=100 but limit with the SystemD slice settings if needed. This will be simpler for people who aren't familiar with Java options to reuse their existing knowledge.

@Fishbowler Fishbowler changed the title OF-2526 Support SystemD for Debain OF-2526 Support SystemD for Debian Nov 1, 2024
@Fishbowler
Copy link
Member

Rebased

[Openfire C2S]
title=Openfire XMPP Server - Client to Server (C2S) connections
description=Allow for XMPP clients to connect to the server and also use File Transfers
ports=5222|5223|8010|7777
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that the ports are configurable, wouldn't these need to be set at runtime?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if it possible. I think that 99% will leave a default. At least this should help to beginner users.

@Fishbowler
Copy link
Member

If I wanted to test this, how would I go about it?

@stokito
Copy link
Contributor Author

stokito commented Nov 2, 2024

To test it you need to build a debian package:

mvn package
./main/build/debian/build_debs.sh

Then install the deb package

sudo dpkg -i ./distribution/target/debian/openfire.deb

Now you can see a status of the service:

systemctl status openfire

to see the unit use:

systemctl cat openfire

Restart, stop, start:

systemctl restart openfire
systemctl stop openfire
systemctl start openfire

The old sysinit script also should work:

/etc/init.d./openfire start

@stokito
Copy link
Contributor Author

stokito commented Nov 22, 2024

Rebased, the build is green now

lib/*.jar usr/share/openfire/lib
lib/log4j2.xml etc/openfire
resources/database usr/share/openfire/resources
conf/openfire.xml etc/openfire
conf/security.xml etc/openfire
resources/security etc/openfire
plugins var/lib/openfire
dist/* /
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's happening with this line? and why is /usr above being mixed with usr

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added the dist folder for supplementary files that just needed to be copied as is. Currently there is the Systemd's openfire servise unit file and the UFW firewall rules. All the files and folders inside of it will be copied into root with the same paths.

[Openfire Connection Manager]
title=Openfire XMPP Server - Connection Manager
description=Openfire Connection Manager improves the scalability of server by handling a portion of the client connections
ports=5262|5263
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far I understood the connection manager is in fact an internal thing. And it probably not used so often. Then I think it would be better to remove the rule. Please confirm.
I added them anyway because I saw that the ports are exposed in the Dockerfile.

Copy link
Contributor Author

@stokito stokito left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of changes are cleanup of the existing shell scripts

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

Successfully merging this pull request may close these issues.

4 participants