Thursday, June 29, 2023

How to switch hosting from Render to Heroku for your Ruby on Rails application

We were trying out the new hosting tool, Render, for, and we ended up regretting it. Even though we were paying for their starter plan, we experienced numerous disconnection issues. After spending two days dealing with these problems, I decided to switch back to Heroku for my Rails app. Let me share with you the steps I took to make the transition.


Step 1. Download your Postgres Database from Render to your local machine

The process of downloading and uploading a Postgres database is called 'pgdump' and 'pgrestore'. Since we need to migrate from Render to Heroku, the first step is to connect to Render and download the database.


A. Add your local machine's ip address on Render.

Make sure your VPN is turned off and add the correct IP address. This will enable you to connect to your database on Render from your local machine.


B. Add -Fc for correct compression format.

Run pg_dump -Fc -d postgres://{YOUR_POSTGRESS_URL} on your local machine to download the database.

-Fc is the format for Heroku. If a backup is created with the incorrect format, pg_restore will not be able to restore the dump file. You may see an error like this: pg_restore: [archiver] did not find magic string in file header.

To run pg_dump from your local machine, install 'pgdump' using homebrew. Remember the version of `pgdumphas to be the same as Render's. Otherwise you will see this errorpg_dump: error: aborting because of server version mismatch. `

Some additional details and instructions are available here.


C. Upload your database to a cloud bucket.

Heroku doesn't allow database uploads from a local machine, so you need to store the database in a publicly accessible bucket in the cloud. Both Google Cloud and AWS are suitable options. Remember to delete it after restoring the database.


Step 2. Upload your Postgre Database to Heroku from a cloud bucket.

Assuming you have already created an account on Heroku and completed all the necessary preparations to run your app, you can now proceed by running this command to restore your database.heroku pg:backups:restore '<SIGNED URL>' DATABASE_URL --app example-app


Step 3. SSL certificate

If your app is already running on Basic or Professional dynos, enable Automated Certificate Management with the following command:
heroku certs:auto:enable


Step 4. Redis


A1: If you are using heroku data for redis

It's a way easier setup. Starting plan costs $3/month.




A2: If you want to use Redis Enterprise Cloud to save $3/month:

Set the REDIS_PROVIDER env var to the name of the env var containing the Redis server URL. (Example with RedisCloud: set REDISPROVIDER=REDISCLOUDURL and Sidekiq will use the value of the REDISCLOUD_URL env var when connecting to Redis.)

Run this command: heroku config:set REDIS_PROVIDER=REDISCLOUD_URL

You may see this error if you are running Sidekiq 7+
redis-client requires Redis 6+ with HELLO command available You have to downgrade Sidekiq to 6.5.8 version for it to work.


B: Add these lines to your procfile

worker: bundle exec sidekiq -C config/sidekiq.yml
release: bin/rails db:migrate

You are almost there:

Copy all your environment variables from Render to Heroku, ensure everything is up and running, and confirm that your Sidekiq jobs are executing. Once you have verified these aspects, you can safely suspend the usage of Render. You may also delete all the YAML files that were generated by Render from your repository.

πŸŽ‰ Congratulations! You have successfully migrated from Render to Heroku. Woo wee! I hope this guide proves helpful to you, and feel free to share it with anyone who may encounter similar challenges. Also, don't forget to check out β€”it's up and running.

ruby on rails

receipt scanner



receipt ai

Start uploading Receipts using SMS.

Save 97% of your time with efficient receipt processing

Works with Xero and QuickBooks

Perfect for businesses, big and small

No extra app downloads. Works with tools you already have (Email and SMS)

Start texting receipts β†’
Business owner using Receipt-AI to take a picture of a receipt in a coffee shop.

Receipt-AI with AI and SMS

What's new? How does Receipt-AI grow as a startup

2024 Receipt AI - Big Green Company Terms Privacy

Use Case

QuickBooks Receipt Scanner with Receipt-AI Your Top Choice Xero Receipt App Generate a Simple Expense Report with AI and SMS Receipt Management for Small Businesses Receipt-AI: The Best Receipt Organizer Track Receipts with PO numbers for Construction Projects


Purchase Order vs Invoice What is a Purchase Order? How to upload receipts to QuickBooks? How to upload receipts to Xero? How would you reconcile your bank account to avoid spending more than you have? Why is it important to reconcile your bank statements? How to reconcile in Xero app? How to reconcile in Xero? What does reconcile mean? How to reconcile in QuickBooks online app? How to reconcile in QuickBooks? How to add my phone number to Receipt-AI? What are the major travel expenses in Construction? Where are the receipts in QuickBooks? Are we raising capital for Receipt-AI? How to add a team member? QuickBooks vs Xero Invoice vs Receipt How to find receipt + new feature Why Receipt-AI works with QuickBooks πŸ” New feature: Look Up Receipts ⭐️ Introducing the new Receipt Insight 2.0 Receipt-AI is Now Officially Available on the QuickBooks Store πŸ—‚οΈ Folder AI 2.0 - Email First time vs Many many times Partnerships with QuickBooks From Humble Beginnings to Community Accomplishments Where can I find the receipts in QuickBooks or Xero? 7 reasons why your company should use Receipt-AI πŸ—‚οΈ Introducing the new Folder AI As of today, Receipt-AI has reached a milestone of 100k in total expenses. Hollywood and Silicon Valley Text Receipts and PO Numbers for Construction Projects Two tigers cannot share the same mountain Why do we start Receipt-AI? QuickBooks Disconnected The best receipt scanner for QuickBooks Upload receipts to QuickBooks using Receipt-AI and SMS What is expense report? πŸ“¦ New Receipt Insights How to reduce memory usage for your Rails app - R14 - Memory Quota Exceeded in Ruby (MRI) From Free Trial to Paid Trial Receipt-AI new feature: Upload Receipts using Email How to switch hosting from Render to Heroku for your Ruby on Rails application Receipt-AI: Take a picture and text