Linux Labs

Web stack / Stage 7 of 9

Connection, role and pg_hba

Not running Starting usually ~20 s
Leave the lesson

Step 6 of 7 · lab · 25 minmedium

App can't connect to PostgreSQL

A service fails on start with a database connection error, although PostgreSQL is running. Give it password access back.

Situation

The app service works with the PostgreSQL database appdb as the database user appuser and connects to it over TCP at 127.0.0.1:5432. Since this morning the service will not come up: it fails on start, and systemd restarts it every few seconds. PostgreSQL itself is running.

Run administrative commands with sudo. There is no internet on the machine.

Task

Make it so that:

  1. appuser connects to appdb over TCP on 127.0.0.1 with its password, the same way the service does;
  2. without the right password appuser cannot connect to the database;
  3. the app service is running and holds its database connection.

Lab · on your own

No commands are given in this lab: type them in the terminal yourself. Goals are checked on the machine after every command.

Goals

0 of 3
  • appuser connects to appdb over TCP on 127.0.0.1 with its password — not done yet
  • appuser cannot connect with a wrong password — not done yet
  • The app service is running and connected to the database — not done yet
Ctrl+Enter
Starts the machine node1 · Ubuntu 24.04

The machine is starting

Hints

0 of 3

Lab goals

0 of 3
  • appuser connects to appdb over TCP on 127.0.0.1 with its password — not done yet
  • appuser cannot connect with a wrong password — not done yet
  • The app service is running and connected to the database — not done yet
node1 Ubuntu 24.04

Lab goals

0 of 3
  • appuser connects to appdb over TCP on 127.0.0.1 with its password — not done yet
  • appuser cannot connect with a wrong password — not done yet
  • The app service is running and connected to the database — not done yet
Loading…