Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

🏠 Back to Blog

Backstage Infrastructure (22%)

Notes on backstage infrastructure.

Topics

  • Understand the Backstage framework
  • Configure Backstage
  • Deploy Backstage to production
  • Understand Backstage client-server architecture

Understand the Backstage framework

  • Backstage is an open-source framework for building IDPs (Internal Developer Portals)
  • Backstage includes a Software Catalog “out of the box”
    • The software catalog provides a centralized view of services used in an org, who owns the software, what lifecycle the software belongs to (production, dev, etc.)
  • Backstage includes templates
    • Templates enable a team to define reusable, standardized methods for scaffolding new projects
      • Templates Templates help maintain consistency across multiple projects, simplify the process of onboarding new members, etc.
  • Backstage includes a built-in tool for handling documentation
  • Backstage supports a robust search functionality
  • Backstage utilizes a plugin-based architecture
    • You can create your own plugins or choose from a marketplace of community-created plugins
    • All of the features listed above are plugins.
  • Backstage Architecture
    • Backstage is a typical 2 tier application (frontend + backend)
      • The backend has an API + database
    • Backstage utilizes React for the frontend and nodejs for the backend API
      • This makes it familiar and relatively easy to modify

Configure Backstage

  • Install Backstage

    1. Type the following command to install the Backstage application. npx @backstage/create-app@latest
    2. If this is the first time that you are installing a Backstage application on this device, the following question is displayed. Enter y and select Enter to proceed with the installation. Need to install the following packages:
        @backstage/create-app@<version>
        ok to proceed? (y)
      
    3. Enter the name for your application and select Enter. This is the root directory of your application. In this example, the name is set to my-backstage-app.
         ? Enter a name for the app [required] my-backstage-app
      
         Creating the app...
      
         Checking if the directory is available:
      
         checking      my-backstage-app ✔
      
         Creating a temporary app directory:
      
         Preparing files:
         copying       .dockerignore ✔
         copying       .eslintignore ✔
         templating    .eslintrc.js.hbs ✔
         ...
         Moving to final location:
         moving        my-backstage-app ✔
         fetching      yarn.lock seed ✔
      
         Installing dependencies:
         executing     yarn install ✔
         executing     yarn tsc ✔
      
         Successfully created my-backstage-app
      
  • To run the application:

    • Change to the root directory of your Backstage app. This is the same as the name of your application that you provided during the installation. In this example, it is my-backstage-app.
          cd my-backstage-app && yarn start
      
  • In the packages.json, subdirectories in the packages/ or plugins/ dirs are applications:

      "workspaces": [
        "packages/*",
        "plugins/*"
      ],
    
    λ backstage (main) $ tree packages/
    packages/
    ├── README.md
    ├── app
    │   ├── e2e-tests
    │   │   └── app.test.ts
    │   ├── node_modules
    │   │   ├── __backstage-autodetected-plugins__.js
    │   │   └── __backstage-module-federation-runtime-shared-dependencies__.js
    │   ├── package.json
    │   ├── public
    │   │   ├── android-chrome-192x192.png
    │   │   ├── apple-touch-icon.png
    │   │   ├── favicon-16x16.png
    │   │   ├── favicon-32x32.png
    │   │   ├── favicon.ico
    │   │   ├── index.html
    │   │   ├── manifest.json
    │   │   ├── robots.txt
    │   │   ├── safari-pinned-tab.svg
    │   │   └── theme.js
    │   └── src
    │       ├── App.test.tsx
    │       ├── App.tsx
    │       ├── index.tsx
    │       ├── modules
    │       │   ├── home
    │       │   │   ├── homeModule.tsx
    │       │   │   └── index.ts
    │       │   └── nav
    │       │       ├── LogoFull.tsx
    │       │       ├── LogoIcon.tsx
    │       │       ├── Sidebar.tsx
    │       │       ├── SidebarLogo.tsx
    │       │       └── index.ts
    │       └── setupTests.ts
    └── backend
        ├── Dockerfile
        ├── README.md
        ├── node_modules
        │   └── app -> ../../app
        ├── package.json
        └── src
            └── index.ts
    
  • the app-config.*.yaml contain the config for backstage. Multiple config files can exist for various environments. For example, app-config.production.yaml, app-config.local.yaml

    • these files are loaded at startup and are not hot-reloaded with changes. If you make any changes, you will need to restart the Backstage server
  • Verify config syntax:

yarn backstage-cli config:check --config app-config.yaml --config app-config.local.yaml

Deploy Backstage to production

Understand Backstage client-server architecture