XMPP/Metronome: Setting file expiration / File storage

Hello :slight_smile: This isn’t reporting a bug or a problem. I am just trying to figure out how Metronome’s config file works, in terms how it treats file storage & expiration.

I have set up two XMPP accounts, one on my own server and one on conversations.im. I have two XMPP chat apps on my phone, so I can send messages from one account to the other as if I were two separate people (for testing).

With default settings, Metronome stores images and videos I send in

Metronome’s global config file is at /etc/metronome/metronome.cfg.lua.

To it, I have added:

---Set up a HTTP Upload service
Component "xmpp-upload.DOMAIN.TLD" "http_upload"
  name = "DOMAIN.TLD Sharing Service"

  http_file_path = "/var/xmpp-upload/DOMAIN.TLD/upload"
  http_external_url = "https://xmpp-upload.DOMAIN.TLD:443"
  http_file_base_path = "/upload"
  http_file_size_limit = 6*1024*1024
  http_file_quota = 60*1024*1024
  http_upload_file_size_limit = 100*1024*1024
  http_upload_quota = 10*1024*1024*1024
  http_file_expire_after = 60    # seconds? just for testing

…then checked everything is correct with sudo luac -p /etc/metronome/metronome.cfg.lua, and restarted Metronome with systemctl restart metronome.

When I put all of the above in the config file, I can no longer find newly uploaded files in /var/xmpp-upload/.../upload/, and the option in the apps to “Copy source URL” of the file no longer appears.

I have tried removing all of the above from the config file, except for http_file_expire_after = 60. When I do this, new files are uploaded to new folders in the /uploads directory, but the ones sent when the other options were active remain absent. The option to “Copy source URL” reappears in the apps, but only for newly uploaded files.

Also, after 60 seconds, the files remain in my /uploads directory despite that expiry setting being active.


  1. When all of the settings are active, where do uploaded files “go” if they’re not in my /uploads folder? I can still send and receive them to both servers.
  2. Does the expiry setting http_file_expire_after only apply when the rest of the options are in the config file too?
  3. What do values such as 6*1024*1024 mean? I know it’s the file sizes in bytes, but what’s the significance of the values laid out like that?
  4. All of this is just for images that I send to others. Does it store images/files I receive? If so, where?

Partial update: For anyone else wondering, I’ve worked out that values such as 6*1024*1024 symbolise the number of files (n) and the size of the files in (1024 bytes = 1)KiB, MiB, etc. For example, 2 GiB is represented as:

2 * 1024 * 1024 * 1024   = 2 GiB, e.g.:
n *  GiB *  MiB *  KiB 

This post says that any changes to the config file (I guess the global one?) must also be reflected in the modules files, located in /usr/lib/metronome/modules/.

E.g., in the module file mod_http_upload.lua, there’s a section called “config”:

-- config
local file_size_limit = module:get_option_number("http_file_size_limit", 3*1024*1024); -- 3 MiB
local quota = module:get_option_number("http_file_quota", 40*1024*1024);
local max_age = module:get_option_number("http_file_expire_after", 172800);
local expire_any = module:get_option_number("http_file_perfom_expire_any", 1800);
local expire_slot = module:get_option_number("http_file_expire_upload_slots", 900);
local expire_cache = module:get_option_number("http_file_expire_file_caches", 450);
local throttle_time = module:get_option_number("http_file_throttle_time", 180);
local default_base_path = module:get_option_string("http_file_base_path", "share");
local storage_path = module:get_option_string("http_file_path", join_path(metronome.paths.data, "http_file_upload"));

What’s now unclear to me is how this relates to the global and domain config files. The global config file does not contain values for these modules (by default), but the domain-specific ones in the /etc/metronome/conf.d/ folder do – that’s where I got the values in my first post from; I’d moved them to my global config file – and they don’t match with the values in the “--config” section above.
The above values do however match with what metronome.im’s configuration page says are the default values.

So… do we ignore the global config file and only edit the domain-specific one, as this user thinks (and then edit the module file so it matches)?

This is my learning curve. The quest continues.

1 Like

Update: I tried:

  • Editing the global config file, changed the module file to match and then restarted the metronome service;
  • Edited the domain config file, changed the module file to match and then restarted the service; then
  • Edited all three files to make them match, and restarted the metronome service.

No change in behaviour. I want to try asking in the XMPP support group at some point, when it comes back online.

Edit: Still no change :upside_down_face:

1 Like

if I understand you correctly you want that your server deletes uploaded files to upload folder after x time set in config, so (i.e.) files older than a month are automatically deleted in the server.

In documentation:

  • http_file_expire_after: expiration time for file uploads in seconds. Default: 172800 (2 days)

applies to the time given to clients to try to upload a file. You compose a message with a file, push the message to the server so time starts to count to http file expire after value. If it fails to upload, retries up to time value set in config.

I might be wrong, though.

Well, if you’re not sure and I don’t know, I think this just highlights the importance of writing good quality documentation, doesn’t it? :laughing:


Right, small progress. I have found some well-written explanations of Prosody’s modules on this page. I tried again to edit the http_upload module and the domain-level config file as before, and again had no change in behaviour. But, I found that the files I uploaded previously – from a few days ago – had been deleted from my /upload folder. So it seems http_upload_expire_after refers to marking files for expiry after the current upload slot ends. However, I don’t know how to view or edit upload slots.

I also tried http_file_share, which is a module that apparently superseded http_file_upload in a later Prosody version.
I created a .cfg.lua module file in the modules directory for it – Metronome threw up an error in the logs saying that it couldn’t find it. All I put in it was the single line

http_file_share_expires_after = 7 * 86400

I understand that these module files contain the default values, so I set this to be 1 week (i.e. 7 x 86400 seconds in a day).
Restarted the metronome service; no error appeared… so I assumed it was OK :person_shrugging:

I then went back to the domain’s cfg.lua file and took out all of the http_upload stuff, replacing it with:

---Set up a HTTP Upload service
Component "xmpp-upload.domain.tld" "http_file_share"
  name = "domain.tld Sharing Service"

  http_file_share_expires_after = 0 * 0 * 0 * 60

…60 seconds’ expiry, just for testing. I restarted the metronome service.

But, the phone apps no longer give me the option to copy the image file’s URL, and I cannot find out how to view where the default upload location is (Prosody’s docs say it’s /file_share but I don’t know how to check this - I don’t know how to get to mod_http_file_share’s logs, and http://xmpp-upload.domain.tld/file_share results in a 404 error). Therefore, when using mod_http_file_share, I have no way to check whether my files really are deleted after 60 seconds.

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.