Cloud Computing, DevOps

< 1 min

Backstage in Production with PostgreSQL and Docker

Voiced by Amazon Polly

Overview

Running Backstage locally is quick and convenient. By default, it uses an in-memory database and minimal configuration, which makes it ideal for development and experimentation. However, production environments require durability, stability, and consistent deployment practices.

To move Backstage from a development setup to a production-ready system, two foundational improvements are necessary:

  1. Replace the in-memory database with PostgreSQL
  2. Containerize the application using Docker

We’ll walk through both steps and explain why they are critical for a stable production deployment.

Pioneers in Cloud Consulting & Migration Services

  • Reduced infrastructural costs
  • Accelerated application deployment
Get Started

Why the Default Database Is Not Suitable for Production?

Out of the box, Backstage runs with an in-memory database. While this is convenient for testing, it comes with a major limitation:

All data is lost whenever the backend restarts.

That means:

  • Catalog entities disappear
  • Registered components vanish
  • Metadata resets
  • Plugin-related data is wiped

For a developer portal that serves as a central source of truth, losing data on restart is unacceptable. Production systems require persistent storage that survives restarts, deployments, and upgrades.

Switching to PostgreSQL for Persistent Storage

PostgreSQL is the recommended database for running Backstage in production. It ensures that all catalog entities, metadata, and plugin data remain intact across restarts.

Provisioning PostgreSQL

You can deploy PostgreSQL in several ways depending on your infrastructure:

Local (Docker-Based) Setup

For testing production-like environments locally:

This runs a PostgreSQL container accessible on port 5432.

Managed Cloud Databases

For real production workloads, managed services are recommended:

  • Amazon RDS
  • Google Cloud SQL
  • Azure Database for PostgreSQL

Managed services offer:

  • Automated backups
  • High availability
  • Failover mechanisms
  • Monitoring and scaling support

After provisioning, gather the following details:

  • Host
  • Port (default 5432)
  • Database name
  • Username
  • Password

These values will be used in the Backstage configuration.

Updating Backstage Configuration

To connect Backstage to PostgreSQL, update the app-config.yaml file:

Field Explanation

  • host – PostgreSQL server hostname or IP
  • port – Database port (usually 5432)
  • user – Database user with proper permissions
  • password – Password for the database user
  • database – Target database name

Using Environment Variables for Security

Instead of hardcoding credentials inside configuration files, use environment variables:

This approach:

  • Keeps sensitive information out of source code
  • Simplifies environment separation (dev/stage/prod)
  • Integrates well with secret management

Ensure these variables are available in your runtime environment or container.

Starting the Backstage Backend

Once the configuration is complete, start the backend:

yarn workspace backend start

If everything is configured correctly:

  • Backstage connects to PostgreSQL
  • Required tables are initialized automatically
  • Catalog data persists permanently

At this stage, your Backstage instance is no longer ephemeral, a durable relational database backs it.

Containerizing Backstage with Docker

Production systems require consistent deployments across environments. Differences in Node.js versions, operating systems, or dependencies can cause unpredictable behavior.

Docker solves this by packaging:

  • Application code
  • Dependencies
  • Runtime configuration

into a single container image.

Benefits of Containerization

Running Backstage in Docker provides:

  • Consistent runtime environments
  • Easier CI/CD integration
  • Simplified deployment across servers
  • Improved portability
  • Reduced environment-specific issues

Once containerized, Backstage can be deployed:

  • On virtual machines
  • Inside container orchestration platforms
  • Across staging and production clusters

This ensures predictable and repeatable deployments.

Upgrade Best Practices

Backstage evolves frequently, and upgrading should be handled carefully in production.

Best practices include:

  1. Testing upgrades in staging before production rollout
  2. Taking PostgreSQL backups before applying updates
  3. Reviewing release notes for breaking changes
  4. Monitoring database migrations

Because your data resides in PostgreSQL, restarts and upgrades will not erase catalog metadata, but proper planning is essential to avoid disruption.

Conclusion

Moving Backstage to production requires more than simply running the backend server.

Replacing the in-memory database with PostgreSQL ensures that catalog entities and metadata persist across restarts. Containerizing the application with Docker ensures consistent deployments and reduces environment-related issues.

Together, PostgreSQL and Docker form the foundation of a stable, scalable, and production-ready Backstage deployment.

Drop a query if you have any questions regarding Backstage and we will get back to you quickly.

Empowering organizations to become ‘data driven’ enterprises with our Cloud experts.

  • Reduced infrastructure costs
  • Timely data-driven decisions
Get Started

About CloudThat

CloudThat is an award-winning company and the first in India to offer cloud training and consulting services worldwide. As an AWS Premier Tier Services Partner, AWS Advanced Training Partner, Microsoft Solutions Partner, and Google Cloud Platform Partner, CloudThat has empowered over 1.1 million professionals through 1000+ cloud certifications, winning global recognition for its training excellence, including 20 MCT Trainers in Microsoft’s Global Top 100 and an impressive 14 awards in the last 9 years. CloudThat specializes in Cloud Migration, Data Platforms, DevOps, Security, IoT, and advanced technologies like Gen AI & AI/ML. It has delivered over 750 consulting projects for 850+ organizations in 30+ countries as it continues to empower professionals and enterprises to thrive in the digital-first world.

FAQs

1. Can I run Backstage in production without PostgreSQL?

ANS: – Technically, yes, but it is not recommended. The default in-memory database erases all data on restart, making it unsuitable for real-world production environments. PostgreSQL ensures durability and data persistence.

2. Do I need Docker to run Backstage in production?

ANS: – Docker is not strictly mandatory, but it is strongly recommended. Containerization ensures consistent runtime environments, simplifies CI/CD workflows, and reduces deployment issues across different servers.

WRITTEN BY Anirudh Singh

Anirudh works as a DevOps Engineer at CloudThat. He specializes in building scalable, automated, and secure cloud infrastructure solutions. With hands-on experience in tools like Terraform, Kubernetes, Jenkins, and AWS services, he plays a key role in streamlining CI/CD pipelines and improving deployment efficiency. Anirudh is passionate about infrastructure as code, cloud-native architectures, and automation best practices. In his free time, he explores new trends and enjoys optimizing workflows to enhance system reliability and performance.

Share

Comments

    Click to Comment

Get The Most Out Of Us

Our support doesn't end here. We have monthly newsletters, study guides, practice questions, and more to assist you in upgrading your cloud career. Subscribe to get them all!