Skip to content

Conversation

@srijan2607
Copy link
Contributor

This pull request updates the way multiple Prosody instances are managed for extra-large conference deployments by switching from per-instance systemd unit files to a single systemd template unit. This simplifies configuration, reduces duplication, and standardizes service management commands. The most important changes are grouped below:
Related issue: #16654

Systemd service management improvements:

Configuration simplification:

These changes make managing multiple Prosody instances more maintainable and consistent.

@srijan2607
Copy link
Contributor Author

@saghul can you review the changes ?

@jitsi-jenkins
Copy link

Hi, thanks for your contribution!
If you haven't already done so, could you please make sure you sign our CLA (https://jitsi.org/icla for individuals and https://jitsi.org/ccla for corporations)? We would unfortunately be unable to merge your patch unless we have that piece :(.

for (( i=1 ; i<=${NUMBER_OF_INSTANCES} ; i++ ));
do
service prosody-v${i} restart
systemctl restart prosody-v@${i}.service
Copy link

@stokito stokito Nov 15, 2025

Choose a reason for hiding this comment

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

It looks like we can restart all services by systemctl restart prosody-v@*

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed this will removes the redundant loop and uses one command to restart all instances.

systemctl restart prosody-v@${i}.service
done
service jicofo restart
systemctl restart jicofo.service
Copy link

Choose a reason for hiding this comment

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

jicofo.service can be just jicofo

JICOFO_HOSTNAME=$(echo get jitsi-videobridge/jvb-hostname | sudo debconf-communicate jicofo | cut -d' ' -f2-)

# Install SystemD template unit (once, outside loop)
cp [email protected] /lib/systemd/system/[email protected]
Copy link

Choose a reason for hiding this comment

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

It's better to save it to the /usr/lib/systemd/system/[email protected], not just /lib.

@srijan2607
Copy link
Contributor Author

@stokito i have made the the suggested changes

@srijan2607 srijan2607 requested a review from stokito November 15, 2025 12:04
@srijan2607
Copy link
Contributor Author

@damencho can you please take a look at this

Copy link
Member

@saghul saghul left a comment

Choose a reason for hiding this comment

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

LGTM, but I also want @damencho to take a look.

@damencho
Copy link
Member

On a running system where I have prosody-v0 installed and running I did:

cp [email protected] /usr/lib/systemd/system/[email protected]
systemctl restart 'prosody-v@*.service'

And it did not restart my prosody-v0.

@stokito
Copy link

stokito commented Nov 17, 2025

systemctl daemon-reload should be executed after installing the service file

@damencho
Copy link
Member

Still nothing

@stokito
Copy link

stokito commented Nov 17, 2025

Check what shows the sudo systemctl status postgresql@*
Check of these services are recognized systemctl list-units | grep prosody

@damencho
Copy link
Member

Check of these services are recognized systemctl list-units | grep prosody

Yeah, seems it is not correct on my end. Will continue testing and will let you know how it goes.

@srijan2607
Copy link
Contributor Author

@damencho @stokito Thanks for testing! I've identified and fixed the issue.

Cause

The template instances were never created or started. The script only copied the template file and created config directories, but never told systemd to actually start the service instances.

Changes

1. Added daemon-reload after copying template:

cp [email protected] /usr/lib/systemd/system/[email protected]
systemctl daemon-reload

2. Added instance creation in the config loop:

for (( i=1 ; i<=${NUMBER_OF_INSTANCES} ; i++ )); do
    # ... config creation ...
    systemctl enable --now prosody-v@${i}.service  # Creates and starts each instance
done

3. Reverted to explicit restart loop:

for (( i=1 ; i<=${NUMBER_OF_INSTANCES} ; i++ )); do
  systemctl restart prosody-v@${i}.service
done

The wildcard prosody-v@*.service doesn't work because no instances exist yet to match. The enable --now command is what actually instantiates the template into running services.

@damencho Could you please test again? Running systemctl list-units | grep prosody should now show all instances as active and running.

@srijan2607
Copy link
Contributor Author

@damencho can you please test it again

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.

5 participants