Moving from Heroku to Render

1. Deploy the Rails app to Render

Deploy a Rails app on Render

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
databases:
- name: hocthoi_api
databaseName: hocthoi_api
user: hocthoi_api
plan: free

services:
- type: web
name: hocthoi_api
env: ruby
plan: free
autoDeploy: true
buildCommand: "./bin/render-build.sh"
startCommand: "bundle exec puma -C config/puma.rb"
envVars:
- key: DATABASE_URL
fromDatabase:
name: hocthoi_api
property: connectionString
- key: RAILS_MASTER_KEY
sync: false

Regenerate master.key if needed.

2. Export the database from Heroku

Migrate from Heroku

1
heroku pg:backups:capture --app <HEROKU APP NAME>
1
heroku pg:backups:download --app <HEROKU APP NAME>
1
pg_restore --clean --verbose --no-acl --no-owner -d <EXTERNAL CONNECTION STRING> latest.dump

The --clean flag drops existing database objects before restoring them when needed.