0

I have a scheduled job running every 12 hrs that unzips image files from an FTP server into my tmp folder. The problem is that due to Heroku's ephemeral filesystem, whenever I deploy new code, the tmp folder is cleared when the dyno's restart and the files are no longer there. I'd like to be able to deploy code at will, without this concern.

I have thought of creating a second app that runs this task and connects to the same database. As per this SO answer. This way I can deploy code updates unrelated to this task to my production server, and can chose more selectively when to deploy to the second server.

Does anyone have any experience with having two apps running on the same database? Or is there a better way to solve my issue? I've read that Heroku may change database URL's at any time, so the second app may lose its connection. How common is this? Thanks!

Community
  • 1
  • 1
tob88
  • 2,151
  • 8
  • 30
  • 33

2 Answers2

0

I believe that it is possible using an app on Heroku.

Check this out: https://devcenter.heroku.com/articles/s3

cionescu
  • 144
  • 9
0

I would create a folder under public e.g. public/storage and save unzipped files here.

Ajit Singh
  • 146
  • 5
  • Whilst this doesn't seem like the best practice. It has indeed solved my issue. I have a task that runs immediately after to clear files that have been uploaded so the app doesn't get too bloated. I think I will extract this feed functionality from my main app in the coming days into a separate app to build a simple api/gem, such that my main app can query the api and update itself that way without the need for sharing databases. Uploading to S3 just slowed everything right down and I don't need to keep the files once they have been uploaded to my database anyway so it seemed unnecessary. – tob88 Aug 08 '14 at 11:37
  • I suggested a possible solution. S3 or external storage would be ideal solution.. but for your immediate need my solution will work. – Ajit Singh Aug 08 '14 at 14:30