Heroku is one of the top PaaS in the market thanks to many of its features that focus on development instead of configuration and maintenance. This has been an excellent option if you haven’t had the necessary budget to hire DevOps specialists, but with the rise of the competitors like Digital Ocean with their own services, it is a good time to start considering migrate your apps if you want to save some money. In this tutorial, we are going to learn how to migrate a Rails app with its PostgreSQL Database from Heroku to an App Platform of Digital Ocean. Some caveats to having into consideration before starting are that DigitalOcean App Platform only uses PostgreSQL 12 as its database and that, unlike Heroku, its deployments are made directly through push actions to the repositories of GitHub, GitLab, docker hub, or in one of its container registries. The prerequisites for this tutorial are: Having installed the . Heroku CLI Create a DigitalOcean . as of today, DigitalOcean offers $100 of credit for 60 days with the creation of your account, you can also gain more credits by referring to other accounts or being referred, that way you can start with more than $100. account Important note: That being said, let’s start with the creation of the App Platform, after signing in, on the home page, click on the option , as indicated in the image: Apps Click on the button: Create App Now you need to choose where you are going to retrieve your application from: For this tutorial, we are going to use a GitHub repo. After clicking on the GitHub option, you will be requested to select your specific repo: Choose your repo, and the branch, there’s also the option to auto-deploy whenever the code changes in that branch. After clicking , it should be automatically recognized as a Rails project, and you can add some extra configurations: next For this specific example, you can just change the port to 3000, but sometimes you will need to put a custom to install your gem dependencies or any other configuration that you need to build your project. Build Command After that, click on : Add a Database You can leave the default options, and upgrade them according to your specific necessities later. After clicking and clicking , you will be asked to name your web service and the region of your domain: Add Database next Before launching your App Platform, it’ll be displayed the plans available: We can select the plan and launch it: Basic the deployment of our platform will start, if you want to see it in more detail, you can tap on the tab and see them. Logs If everything went well, a message will be displayed: Deployed successfully Now we can start with the migration of our database, we can export the database in many ways and formats, for this case, we are going to use the basic way as shown in the , first we capture a backup: Heroku documentation to export/import the database $ heroku pg:backups:capture Starting backup of postgresql-rugged-66622... Use Ctrl-C at any time to stop monitoring progress; the backup will running. Use heroku pg:backups:info to check progress. Stop a running backup with heroku pg:backups:cancel. Backing up DATABASE to b002... done continue done then download the backup: $ heroku pg:backups:download Getting backup from ⬢ whispering-retreat-92662... , Downloading latest.dump... ████████████████████████▏ 100% 00:00 23.94KB done #2 This is going to download the backup at a file in your current directory, to import that file into our App Platform, we need to click on the tab, and copy the connection string of the database: latest.dump settings Make sure that the is in , and copy the connection string below, you can also connect to your database through connection parameters though. Connection Details Connection String And finally, you can use your connection string or parameters to restore your database with the pg_restore command: pg_restore --verbose --clean --no-acl --no-owner -d <YOUR_CONNECTION_STRING> latest.dump And that’s all, check if there are no errors in the logs, sometimes some errors are due to some of the drops of nonexistent objects just to clean the database. Hope you have found this article useful and discovered the wide range of options that these two tools offer to facilitate their migrations.