Skip to content
OPQAI.
Sourced intermediate / 🏪 SME Operations Free tools

Automate Render PostgreSQL Database Renewal with RelinkDB

Job to be done: Automate monthly PostgreSQL database renewal and data migration for Render free-tier services

🇳🇬 Ways to use this in Nigeria

Ideas to get you started, adapt to your situation.

  • Entrepreneur

    As an entrepreneur launching an MVP (Minimum Viable Product) on Render's free tier, automate the monthly migration of your PostgreSQL database to preserve early user sign-ups, product settings, and other critical data.

  • Student

    As a student building a web app for your final year project or a campus side hustle on Render's free tier, automate the monthly migration of your PostgreSQL database to preserve user accounts, posts, or other application data.

  • 9-5 employee

    As an employee developing a prototype internal tool or a departmental dashboard on Render's free tier, automate the monthly migration of your PostgreSQL database to preserve test data, user settings, or report configurations.

What you’ll get

You will learn how to use RelinkDB, an open-source tool, to automate the monthly renewal and data migration of your PostgreSQL databases on Render’s free tier. This process, which typically takes 15 minutes manually, can be reduced to a 2-minute workflow, preventing data loss.

Tools you need

  • RelinkDB (free): An open-source desktop application designed to automate Render’s free-tier PostgreSQL database renewal.
  • Render (freemium): A cloud platform where you host your applications and databases. The free tier has limitations, including database resets.
  • PostgreSQL (free): A powerful, open-source relational database system.
  • npm (free): The Node Package Manager, used to install and manage JavaScript packages, including RelinkDB.
  • Electron (free): A framework for building desktop applications using web technologies. RelinkDB uses this for its user interface.
  • pg (free): A popular PostgreSQL client for Node.js, used by RelinkDB for database operations.

Steps

  1. Install Node.js and npm: If you don’t have them, download and install Node.js from its official website. npm is included with Node.js. You should see confirmation messages indicating successful installation.
  2. Clone the RelinkDB repository: Open your terminal or command prompt and navigate to the directory where you want to save the project. Then, clone the repository.
    git clone https://github.com/shashcodes/relinkdb
    cd relinkdb
    You should now be inside the RelinkDB project folder in your terminal.
  3. Install RelinkDB dependencies: Inside the relinkdb folder, run the following command to install all the necessary packages.
    npm install
    You should see a long list of packages being installed, ending with a success message.
  4. Start the RelinkDB desktop console: Run the command to launch the RelinkDB application.
    npm run dev
    A desktop window for RelinkDB should open. This is your operator console.
  5. Backup your current database: Before your Render database expires, use the RelinkDB console to create a backup. The exact steps within the UI are not detailed in the source, but look for an option to ‘Dump’ or ‘Backup’ your database. You should get a data.sql file (or similar) saved locally.
  6. Recreate your Render PostgreSQL instance: Manually go to your Render dashboard. Delete your old PostgreSQL database and create a new one with the same name. This is a manual step Render requires. The new database instance should now be available on Render.
  7. Restore and Relink: Use the RelinkDB console to restore the backup to your new database instance. RelinkDB will then automatically update your application’s environment variables on Render and trigger a redeploy. Your application should now be connected to the new database and running.

Original source

This workflow is based on a blog post by shashcodes on DEV Community. The author developed RelinkDB to solve the recurring problem of Render’s free-tier PostgreSQL databases being wiped every 30 days, providing an automated solution to prevent data loss and manual effort.

Notes & variations

  • Free-tier alternative: While RelinkDB automates the process, Render’s free tier still requires manual recreation of the database instance. There isn’t a fully automated way around this due to Render’s API limitations on free resources. For critical data, consider Render’s paid tiers or other hosting providers.
  • Common pitfall: Forgetting to manually recreate the PostgreSQL instance on Render before it expires will mean you lose your data, as RelinkDB can only restore to a newly created instance. Pay close attention to Render’s 30-day expiry.
  • Tip for better results: Ensure you have a reliable internet connection during the backup and restore process, especially for larger databases, to avoid interruptions.

Keep going

More SME Operations workflows