Configuring Backstage

40 MINS

Configuring PostgreSQL

Now that PostgreSQL is installed on your machine, we can tell Backstage to use it.

Earlier you saw the main Backstage configuration file, app-config.yaml in the root directory of your Backstage app. Backstage also supports environment-specific configuration overrides, by way of an app-config.<environment>.yaml file. This is where you'll add the database configuration, since you’re setting up a database on your local machine right now.

Open the app-config.local.yaml file in the root directory of your Backstage app (create if it doesn't exist), and add:

<span class="line"><span style="color:#85E89D">backend</span><span style="color:#E1E4E8">:</span></span>
<span class="line"><span style="color:#85E89D">  database</span><span style="color:#E1E4E8">:</span></span>
<span class="line"><span style="color:#85E89D">    connection</span><span style="color:#E1E4E8">:</span></span>
<span class="line"><span style="color:#85E89D">      host</span><span style="color:#E1E4E8">: </span><span style="color:#9ECBFF">localhost</span></span>
<span class="line"><span style="color:#6A737D">      # Default postgresql port is 5432; this might be different for your installation</span></span>
<span class="line"><span style="color:#85E89D">      port</span><span style="color:#E1E4E8">: </span><span style="color:#79B8FF">5432</span></span>
<span class="line"><span style="color:#85E89D">      user</span><span style="color:#E1E4E8">: </span><span style="color:#9ECBFF">postgres</span></span>
<span class="line"><span style="color:#6A737D">      # Replace the password below with your postgresql password:</span></span>
<span class="line"><span style="color:#85E89D">      password</span><span style="color:#E1E4E8">: </span><span style="color:#9ECBFF">secret</span></span>
<span class="line"></span>

The default .gitignore file created with the app excludes *.local.yaml from source control for you, so you can add passwords or tokens directly into the app-config.local.yaml.

Start Backstage from the terminal, by typing yarn dev and pressing enter. As soon as it states:

<span class="line"><span style="color:#E1E4E8">[0] webpack compiled successfully</span></span>
<span class="line"></span>

You're good to go and explore Backstage again. Note that if you've made any changes before, they might be gone. The default database is not persistent.