← Back to Guides
Header image for guide: Deploy pgAdmin with PostgreSQL on Northflank
Profile image for Marco Suter

By Marco Suter

Published 30th March 2022

Deploy pgAdmin with PostgreSQL on Northflank

pgAdmin is an administration and management tool for PostgreSQL. pgAdmin is an open-source and feature-rich development platform used to interact with the Postgres database sessions, in both local and remote servers. You can use pgAdmin to perform database administration required for your PostgreSQL database.

Following this guide, you will learn how to connect your PostgreSQL database on Northflank to pgAdmin.

  1. Create a new PostgreSQL database or use an existing PostgreSQL addon you want to connect to.

    • For increased security, keep SSL enabled and External Access disabled. You can start with the smallest compute plan with 4 GB of storage and one replica.

  2. After your addon is created, create a secret group and ensure the secret group is properly linked with the addon. Check the aliases:

    northflank secret group database linking

  3. In your project, create a new deployment service:

    1. Under Deployment choose External image and set the image path to dpage/pgadmin4:latest.

    2. Under Environment variables expand Runtime variables and under View add the following:

      KeyValue
      PGADMIN_DEFAULT_EMAILmyemail@example.com
      PGADMIN_DEFAULT_PASSWORDmypassword
      PGADMIN_LISTEN_ADDRESS0.0.0.0
      PGADMIN_LISTEN_PORT8000
    3. Under Advanced create a Secret file with mount path /pgadmin4/servers.json and the following content:

      {
        "Servers": {
          "1": {
            "Name": "Minimally Defined Server",
            "Group": "Server Group 1",
            "Port": 5432,
            "Username": "${USERNAME}",
            "Host": "${PG_HOST}",
            "SSLMode": "allow",
            "MaintenanceDB": "${DATABASE}"
          }
        }
      }
      • This secret file will persist the configuration so you don't need to add your PostgreSQL connection details with each restart of your service. This persistence is achieved thanks to ConfigMaps.

    4. Under Networking, add Port 8000 with the HTTP protocol.

    5. Under Resources select the compute plan nf-compute-50.

    • This compute plan will provide your service with 0.5 vCPU and 1024 MB memory.

    • If a smaller compute plan is selected, start-up will take longer than expected.

  4. Visit the service URL displayed on the top right corner of your service to open pgAdmin.

  5. Login with the email and password defined in your environment variables: PGADMIN_DEFAULT_EMAIL and PGADMIN_DEFAULT_PASSWORD.

  6. When prompted, add your password for the PostgreSQL instance.

  7. You are ready to manage your database!

    pgAdmin dashboard deployed via Docker on Northflank with PostgreSQL

Using Northflank to deploy pgAdmin with PostgreSQL

Northflank allows you to deploy your code and databases within minutes. Sign up for a Northflank account and create a free project to get started.

  • Multiple read and write replicas
  • Observe & monitor with real-time metrics & logs
  • Low latency and high performance
  • Backup, restore and fork databases
  • Private and optional public load balancing as well as Northflank local proxy

Share this article with your network