processone / ejabberd-contrib

Growing and curated ejabberd contributions repository - PR or ask to join !
http://ejabberd.im
250 stars 140 forks source link

mod_s3_upload support #335

Closed Cronoburn closed 6 months ago

Cronoburn commented 6 months ago

I'm not sure what to title this. I've been fighting with this for a month. I have a VPS with traditional volume storage that is running out, included with this VPS is S3 object storage with a terabyte of space. I have tried using mod_s3_upload and after a few errors that I was able to work through, nothing was uploaded to my bucket, I cant remember what the logs threw(reinstalls due to running out of space, and wanting fresh configs). My last attempt was to let mod_http_upload do its thing with a flask module listening to the route set in ejabberd.conf (this was not successful either) I can't afford more volume storage and I have that s3 bucket sitting there unused. any help with this would be appreciated.

licaon-kter commented 6 months ago

Config?

Cronoburn commented 6 months ago
 mod_s3_upload: 
    access_key_id: <key>
    access_key_secret: <secret>
    region: us-east-1
    bucket_url: <url to bucket>
    max_size: 1073741824
    put_ttl: 1600
    service_name: 'S3 Upload'
    access: local
    set_public: true
    hosts:
      - upload.@HOST@
licaon-kter commented 6 months ago

Logs at loglevel 4 or info? Nothing in ejabberd.log?

Cronoburn commented 6 months ago

give me twenty-four hours, to set it up with log level info, I have life getting in my way atm.

Cronoburn commented 6 months ago

now I'm getting an error about mod_s3_upload not supporting socket handoff in journalctl... I apologize, I'm trying to do this while under chemo treatments, some days it's like I can't remember my breakfast to save my life. others I can set up video conferencing like I do it for a living. but this gives me something to do other than staring at the walls, so I really do appreciate the help, and the patience.

Cronoburn commented 6 months ago

This is the listener entry inside of ejabberd config:

request_handlers:
      /admin: ejabberd_web_admin
      /api: mod_http_api
      /bosh: mod_bosh
      /captcha: ejabberd_captcha
      /upload: mod_s3_upload
      /ws: ejabberd_http_ws

This is the error:

2024-05-11 17:06:52.579537+00:00 [critical] <0.190.0>@ejabberd_app:start/2:72
 Failed to start ejabberd application:
 Invalid value of option listen->4->request_handlers->'/upload':
 Module 'mod_s3_upload' doesn't export function socket_handoff/3
badlop commented 6 months ago

Looking that the mod_s3_upload documentation and its example configuration, that module is not designed to be added in request_handler

Cronoburn commented 6 months ago

Forgive me, how do I use it, then? do I just remove the declaration in the request handler block? I'll give that a try.. Thank you for the help, I'm sorry, I am very much a newbie at anything involving S3.


tried it, still getting a 404 response inside of xmpp client when uploading an image

badlop commented 6 months ago

Looking at the mod_s3_upload documentation, it seems the server administrator just configures that module. There is also an example module configuration file.

I would say that when a XMPP client attempts to use XEP-0363: HTTP File Upload, that module takes care to upload the file to S3.

Cronoburn commented 6 months ago

ok.. I finally got it working, there are new errors, though. However, this issue was solved with the help of @badlop . Thank you, @badlop and @licaon-kter both, for dedicating your time.