How can I export the postgresql database?

201 views
Skip to first unread message

acevedo...@gmail.com

unread,
Aug 28, 2023, 6:14:42 PM8/28/23
to BigBlueButton-dev
Hi,
I have been asked to generate a report of all the BigBlueButton rooms created between 2 dates.
I'm running BBB 2.6.8 with Greenlight V2
I was looking to export the Postgresql database with pqsl but I don't know if it's safe to install the postgresql-client-common package, and how to run it as the Postgresql is executed inside a docker container.
Any guidance on how to achieve this will be appreciated.
Regards,
German

DistanceLearning.cloud

unread,
Aug 29, 2023, 7:09:37 AM8/29/23
to BigBlueButton-dev
you can use PGADMIN from windows client, or the pgsql client on command line.
the trick is getting the IP address from the docker inspect command 

i use this, not eloquent but works 

#!/bin/bash
#    Note if you are rails person use rake migrations :)
#install psql client
#   apt install postgresql-client-common
#   apt install postgresql-client
#  Get PGPASSWORD from /root/greenlight-v3/.env
#  Get ip address from docker inspect container postgres (NOTE this ip changes with a docker compose down)
pgpass=$(cat .env | grep DATABASE_URL | cut -d':' -f3 | cut -d'@' -f1)
export PGPASSWORD=$pgpass
ipaddr=$(docker inspect postgres | grep "IPAddress" | tail -n1 | cut -d'"' -f4)
export POSTGRES=$ipaddr

then run your sql

psql -a -h $POSTGRES -d greenlight-v3-production postgres -f yourcode.sql

Regards,
Stephen

acevedo...@gmail.com

unread,
Aug 29, 2023, 6:32:56 PM8/29/23
to BigBlueButton-dev
Thank you!
I will give it a try.

acevedo...@gmail.com

unread,
Aug 30, 2023, 6:13:43 PM8/30/23
to BigBlueButton-dev
Hi Stepen,
Sorry to ask you again, but in this installation we still using Greenlight V2, so I cant get the ip of the postgresql running. 
So when I run the ipaddr... I get the following message:

root@miaulavirtual:~/greenlight# ipaddr=$(docker inspect postgres | grep "IPAddress" | tail -n1 | cut -d'"' -f4)
Error: No such object: postgres
root@miaulavirtual:~/greenlight# 

Do you now what should I change in this instructions to get the IP?

#  Get ip address from docker inspect container postgres (NOTE this ip changes with a docker compose down)
pgpass=$(cat .env | grep DATABASE_URL | cut -d':' -f3 | cut -d'@' -f1)
export PGPASSWORD=$pgpass
ipaddr=$(docker inspect postgres | grep "IPAddress" | tail -n1 | cut -d'"' -f4)
export POSTGRES=$ipaddr

Regards,
German

Thierry Kauffmann

unread,
Aug 31, 2023, 3:06:36 AM8/31/23
to BigBlueButton-dev
Hi,

psql is already installed inside the container.
You can access it this way :

docker exec -it <greenlight_db_1> psql -U postgres -b <greenlight_production>

where <greenlight_db_1> must be replaced vy the name of your Postgresql container and <greenlight_production> by the name of your database

sd...@distancelearning.cloud

unread,
Aug 31, 2023, 7:01:19 AM8/31/23
to bigblueb...@googlegroups.com

Even better way 😊

--
You received this message because you are subscribed to the Google Groups "BigBlueButton-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bigbluebutton-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bigbluebutton-dev/3bbbb86f-fd62-4d1c-bf87-1242afc5c430n%40googlegroups.com.

acevedo...@gmail.com

unread,
Aug 31, 2023, 12:19:03 PM8/31/23
to BigBlueButton-dev
Thank you Thierry and Stephen! 
Following your directions I was able to export the needed data.
You are amazing!
Reply all
Reply to author
Forward
0 new messages