Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5988835
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:00:54+00:00 2026-05-22T23:00:54+00:00

I need to periodically import some data into my rails app on Heroku. The

  • 0

I need to periodically import some data into my rails app on Heroku.

The task to execute is split into the following parts:
* download a big zip file (e.g. ~100mb) from a website
* unzip the file (unzipped space is ~1.50gb)
* run a rake script that reads those file and create or update records using my active record models
* cleanup

How can I do this on heroku? Is it better to use some external storage (e.g. S3).
How would you approach such a thing?

Ideally this needs to run every night.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T23:00:55+00:00Added an answer on May 22, 2026 at 11:00 pm

    I have tried exact same thing couple of days back and the conclusion that I came up with was this can’t be done because of memory limit restrictions that heroku imposes on each process. (I build a data structure with the files that I read from the internet and try to push to DB)

    I was using a rake task that would pull and parse couple of big file and then populate the database.

    As a work around I run this rake task in my local machine now and push the database to S3 and issue a heroku command from my local machine to restore the heroku DB instance.

    "heroku pgbackups:restore 'http://s3.amazonaws.com/#{yourfilepath}' --app  #{APP_NAME} --confirm #{APP_NAME}"
    

    You could push to S3 using fog library

    require 'rubygems'
    require 'fog'
    connection = Fog::Storage.new(
        :provider              => 'AWS',
        :aws_secret_access_key => "#{YOUR_SECRECT}",
        :aws_access_key_id     => "#{YOUR_ACCESS_KEY}"
    )
    
    directory = connection.directories.get("#{YOUR_BACKUP_DIRECTORY}")
    
    # upload the file
    file = directory.files.create(
        :key    => '#{REMOTE_FILE_NAME}',
        :body   => File.open("#{LOCAL_BACKUP_FILE_PATH}"),
        :public => true
    )
    

    The command that I use to make a pgbackup on my local machine is

    system "PGPASSWORD=#{YOUR_DB_PASSWORD} pg_dump -Fc --no-acl --no-owner -h localhost -U #{YOUR_DB_USER_NAME} #{YOUR_DB_DATABSE_NAME} > #{LOCAL_BACKUP_FILE_PATH}"
    

    I have put a rake task that automates all these steps.

    After thing your might try is use worker(DelayedJob). I guess you can configure your workers to run every 24 hours. I think workers don’t have the restriction of 30 seconds limit. But I am not sure about the memory usage.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to periodically download, extract and save the contents of http://data.dot.state.mn.us/dds/det_sample.xml.gz to disk.
we periodically need to import a CSV that looks like this: Name,SpecID,TestResult1,TestResult2,TestResult3 Alex,ASD123,3.23,452.2,232 Craig,DFG444,453.56,345.3,23
Is there a way to periodically run some code on app engine? I have
We're designing data import from an external source like MAS200 into our production SQL
I need a service to start at boot that periodically checks some database for
We have a rather large library that we need to periodically import (and then
I need to periodically update a local cache with new additions to some DB
I need to periodically add new data in the grid's store. The store is
I need to create a script to periodically send emails to some users. I
in threads, i need to periodically do some work in some different intervals, what

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.