Обсуждение: Re: Using pgadmin in docker via compose

Поиск
Список
Период
Сортировка

Re: Using pgadmin in docker via compose

От
Yogesh Mahajan
Дата:
Hi,

Order should not matter here.I tried with above docker-compose & its working fine.
Could you please  try adding the below variable in the environment and creating a container?
PGADMIN_CONFIG_CONSOLE_LOG_LEVEL: 10
And check if logs shows - 
2023-05-17 16:06:15 pgAdmin 4 - Application Initialisation
2023-05-17 16:06:15 ======================================
2023-05-17 16:06:15
2023-05-17 16:06:24 ----------
2023-05-17 16:06:24 Loading servers with:
2023-05-17 16:06:24 User: *****@***.com
2023-05-17 16:06:24 SQLite pgAdmin config: /var/lib/pgadmin/pgadmin4.db
2023-05-17 16:06:24 ----------
2023-05-17 16:06:24 Added 1 Server Group(s) and 7 Server(s).

Also can you please check if the source file path for servers.json is correct? If the source file path is incorrect, servers will not be loaded.

Thanks,
Yogesh Mahajan
EnterpriseDB


On Wed, May 17, 2023 at 3:31 PM Tim Uckun <timuckun@gmail.com> wrote:
Hi.

I want to set up pgadmin in a docker compose and have it automatically
be able to connect to the database running in the same compose file.

I have set up the following entry in the compose file (excuse the indents)

pgadmin:
image: dpage/pgadmin4:latest
volumes:
- ./pgadmin_servers.json:/pgadmin4/servers.json
- ./pgpass:/pgadmin4/.pgpass:ro
ports:
- 5050:5050
environment:
PGADMIN_DEFAULT_EMAIL: timuckun@gmail.com
PGADMIN_DEFAULT_PASSWORD: admin
PGADMIN_LISTEN_PORT: 5050
PGADMIN_SERVER_JSON_FILE: /pgadmin4/servers.json

This is the servers file

{
"Servers": {
"1": {
"Name": "Minimally Defined Server",
"Group": "Server Group 1",
"Port": 5432,
"Username": "benchmarkdbuser",
"Host": "tfb-database",
"SSLMode": "prefer",
"MaintenanceDB": "hello_world",
"PassFile": "/pgadmin4/.pgpass"
}
}
}

This launched the pgadmin app but the server doesn't show up in the list.

I am wondering what I need to do in order to make this happen. Ideally
the app would also log in as admin and go right to the startup screen.

Thanks.


Re: Using pgadmin in docker via compose

От
Tim Uckun
Дата:
Thanks Yogesh.

It's now working for some reason but for some strange reason it
creates two empty directories called .pgpass and pgadmin_servers.json
in the directory where the compose file is. Very odd.

Can pgadmin use a pg_service.conf file so I don't have to map two
files? Alternatively is there a way to specify all this in environment
variables instead of mapping files?

finally is there any way to bypass the initial login screen?

Ideally I would specify a set of env variables like I do for the
postgres containers

POSTGRES_DB
POSTGRES_USER
POSTGRES_PASSWORD
POSTGRES_HOST

Ideally they would be the same variables!

Thanks.

On Wed, May 17, 2023 at 10:39 PM Yogesh Mahajan
<yogesh.mahajan@enterprisedb.com> wrote:
>
> Hi,
>
> Order should not matter here.I tried with above docker-compose & its working fine.
> Could you please  try adding the below variable in the environment and creating a container?
> PGADMIN_CONFIG_CONSOLE_LOG_LEVEL: 10
> And check if logs shows -
> 2023-05-17 16:06:15 pgAdmin 4 - Application Initialisation
> 2023-05-17 16:06:15 ======================================
> 2023-05-17 16:06:15
> 2023-05-17 16:06:24 ----------
> 2023-05-17 16:06:24 Loading servers with:
> 2023-05-17 16:06:24 User: *****@***.com
> 2023-05-17 16:06:24 SQLite pgAdmin config: /var/lib/pgadmin/pgadmin4.db
> 2023-05-17 16:06:24 ----------
> 2023-05-17 16:06:24 Added 1 Server Group(s) and 7 Server(s).
>
> Also can you please check if the source file path for servers.json is correct? If the source file path is incorrect,
serverswill not be loaded. 
>
> Thanks,
> Yogesh Mahajan
> EnterpriseDB
>
>
> On Wed, May 17, 2023 at 3:31 PM Tim Uckun <timuckun@gmail.com> wrote:
>>
>> Hi.
>>
>> I want to set up pgadmin in a docker compose and have it automatically
>> be able to connect to the database running in the same compose file.
>>
>> I have set up the following entry in the compose file (excuse the indents)
>>
>> pgadmin:
>> image: dpage/pgadmin4:latest
>> volumes:
>> - ./pgadmin_servers.json:/pgadmin4/servers.json
>> - ./pgpass:/pgadmin4/.pgpass:ro
>> ports:
>> - 5050:5050
>> environment:
>> PGADMIN_DEFAULT_EMAIL: timuckun@gmail.com
>> PGADMIN_DEFAULT_PASSWORD: admin
>> PGADMIN_LISTEN_PORT: 5050
>> PGADMIN_SERVER_JSON_FILE: /pgadmin4/servers.json
>>
>> This is the servers file
>>
>> {
>> "Servers": {
>> "1": {
>> "Name": "Minimally Defined Server",
>> "Group": "Server Group 1",
>> "Port": 5432,
>> "Username": "benchmarkdbuser",
>> "Host": "tfb-database",
>> "SSLMode": "prefer",
>> "MaintenanceDB": "hello_world",
>> "PassFile": "/pgadmin4/.pgpass"
>> }
>> }
>> }
>>
>> This launched the pgadmin app but the server doesn't show up in the list.
>>
>> I am wondering what I need to do in order to make this happen. Ideally
>> the app would also log in as admin and go right to the startup screen.
>>
>> Thanks.
>>
>>