Thursday, June 29, 2023
We were trying out the new hosting tool, Render, for Receipt-AI.com, 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.
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.
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.
-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 error
pg_dump: error: aborting because of server version mismatch. `
Some additional details and instructions are available here. https://devcenter.heroku.com/articles/heroku-postgres-import-export#create-dump-file
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.
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
If your app is already running on Basic or Professional dynos, enable Automated Certificate Management
with the following command:
heroku certs:auto:enable
heroku data for redis
It's a way easier setup. Starting plan costs $3/month.
Source: https://devcenter.heroku.com/articles/heroku-redis
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
Source: https://github.com/sidekiq/sidekiq/wiki/Using-Redis
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.
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 https://receipt-ai.com βit's up and running.
ruby on rails
receipt scanner
Heroku
Render
receipt ai
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 ProjectsArticles
π The new Search Engine for your 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 Store 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 with 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