how to use sidekiq worker to access uploaded file in a rails app on Dokku server
Asked Answered
B

1

6

I'm using sidekiq plugin: https://github.com/bigboxsoftware/dokku-sidekiq to enable sidekiq on the server. And the problem is the worker cannot access file in any of app folders.

As the plugin README said

Adds a post-deploy hook to Dokku to automatically deploy a container running a Sidekiq worker

I'm not sure this means my app and sidekiq are running in the different container? I have tried to use mounted folder to store uploaded file

cat /home/dokku/home/PERSISTENT_STORAGE
/home/dokku/shared/temp:/app/public/temp

But it still cannot work.

In rails console, I can use File.open('public/temp/file') to open the file, but once use Sidekiq::Worker.new('public/temp/file'), it raise Errno::ENOENT: No such file or directory error.

What I can do now?

Bargainbasement answered 17/6, 2015 at 8:28 Comment(1)
Did you manage to fix this?Vadim
A
0

In this situation Sidekiq is running it's own server (container) thus making it sandboxed from the application server (i.e. might or might not be running on the same physical hardware).

In the situation when you want to "share" anything between application server and sidekiq you need to share with a Database / Datastore. This could be S3, Redis, Postgres or the arguments to the sidekiq job itself.

I have have all of these in production for different purposes.

Acedia answered 1/9, 2020 at 20:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.