Setting up PostgreSQL
Backstage offers SQLite, an in-memory database, for easy local setup with no external dependencies. SQLite is a great way to kick the tires. But we recommend setting up PostgreSQL for a production-ready deployment. Backstage uses the Knex database library under the covers, which supports many popular databases.
First, let's stop Backstage before we continue. Stop Backstage from the terminal, by pressing
Expand your Operating System to view the specific instructions.
1. For Mac, we recommend Postgres.app which is a desktop solution. Download the latest release and drag Postgres.app into the Applications folder. 2. Launch Postgres from Spotlight or from the Applications folder directly. 3. Click the Initialize button, then you’ll see PostgreSQL running with some default databases: 4. The default Postgres.app installation creates a server with two users — postgres, and your Mac username. Neither has a password, since this is designed for an easy, insecure local setup. 5. From a terminal window, you can connect to the database and see these userspsql -U postgres postgres=# \du6. For this tutorial we are going to use the existing postgres user. The next step is to set the password:postgres=# ALTER USER postgres PASSWORD 'secret';7. It will respond with `ALTER ROLE`. Type '\q', followed by pressing the 'enter' key.
1. Install postgresqlsudo apt-get install postgresql2. Test if your database is working:sudo -u postgres psql3. You should see a very welcoming message, like:psql (12.9 (Ubuntu 12.9-0ubuntu0.20.04.1)) Type "help" for help.4. For this tutorial we are going to use the existing postgres user. The next step is to set the password:
postgres=#postgres=# ALTER USER postgres PASSWORD 'secret';5. It will respond with `ALTER ROLE`. Type '\q', followed by pressing the 'enter' key.