Developer Docs

Using pgAdmin to manage your bots PostgeSQL database

Note, this article assumes you are using docker to run your application as per the How do I run my app? article.

Initial steps

  1. Start your application if it is not already running

     docker-compose up -d
    
  2. After a few moments, the docker containers should start, one of which is running pgAdmin. Before connecting to pgAdmin, you will need to know the port number it is listening on.

     docker-compose ps
    

    Doing so will show you the running containers, one of which is pgAdmin (in this case, the third one)

     Name                   Command               State                    Ports
     -------------------------------------------------------------------------------------------------
     a086_client_1    docker-entrypoint.sh sh -c ...   Up
     a086_db_1        docker-entrypoint.sh postgres    Up      5432/tcp
     a086_pgAdmin_1   /entrypoint.sh                   Up      443/tcp, 80/tcp, 0.0.0.0:9091->9090/tcp
     a086_server_1    sh -c  dotnet new tool-man ...   Up      0.0.0.0:8001->5000/tcp
    
  3. Under the “ports” column for the “pgAdmin” container, look for the entry which contains 0.0.0.0:xxxx. In this case, it is 0.0.0.0:9091 (Please note that different bots may use different ports) This indicates that we can access pgAdmin on port 9091 of the local host. (eg http://localhost:9091)

Logging in

  1. Open your browser to the URL you determined above (eg http://localhost:9091) and you will be presented with a login screen.
  2. The credentials for the login screen can be found in the docker-compose.yml file in the root of your repository. Specifically, look for the PGADMIN_DEFAULT_EMAIL and PGADMIN_DEFAULT_PASSWORD environment variables.

    Image Image
  3. If this is your first time logging in to pgAdmin, you will need to add the connection to your application’s PostgreSQL server, otherwise you can skip these steps.

    1. Before you proceed, you will need to know the credentials to the PostgreSQL database. This can be found in the docker-compose.yml file in the root of your repository. Specifically, look for the POSTGRES_DB, POSTGRES_USER, and POSTGRES_PASSWORD environment variables.

      Image
    2. Click “Add New Server”

      Image
    3. On the first tab (General), give your connection a name. This can be anything you like, though we recommend using the name of your application

      Image
    4. On the second tab (Connection), fill in the following fields, then click the Save button

       Host name/address:  db
         Maintenance database:  [the value of the POSTGRES_DB environment variable from step 3a above]
         Username:  [the value of the POSTGRES_USER environment variable from step 3a above]
         Password:  [the value of the POSTGRES_PASSWORD environment variable from step 3a above]
         Save Password:  Checked/Ticked
      
      Image
  4. Your connection should now show up on in the left-hand menu. If it doesn’t automatically connect (little red cross on the connection), you can click on the connection and it should initiate the connection

    Image
  5. You should now be connected to your PostgreSQL database and can manage the database, tables, data, etc.

    Image

For further information on how to use pgAdmin, head over to pgAdmin’s website and check out the official documentation

Was this article helpful?

Thanks for your feedback!

If you would like to tell us more, please click on the link below to send us a message with more details.

Tool:

Generate

Iterate

Bot:

C#Bot

SpringBot

On this page

New to Codebots?

We know our software can be complicated, so we are always happy to have a chat if you have any questions.