Little repo where to play with postgresql db
- docker-compose
- makefile
make start
: start containers postgres and pgadmin
make stop
: stop all containers
to run a custom query you can write it in the query-editor.sql file and after type make query-editor
from the terminal
go to a specific project folder inside /projects folder
you can find seed.sql and query-editor.sql files specific for the project
first install the seed with make seed
and after run make query-editor
you can access browse and query the database from pgadmin at http://localhost:5050
default configurations can be changed via .env variables:
PG_PORT: default 5432
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
pgadmin is a client to browse the database
you can use it opening locahost:5050
by default no passwords will be required to access to the test database
here you can find the entire list of environment variables.
in configs/pgadmin folder you can finf servers.json file and pgpass file
servers.json contains all server that will be preloaded in pgadmin
{
"Servers": {
"1": {
"Group": "Servers",
"Name": "pg-test-db",
"Host": "postgres",
"Port": 5432,
"MaintenanceDB": "postgres",
"Username": "postgres",
"PassFile": "/var/lib/pgadmin/pgpass",
"SSLMode": "prefer"
}
}
}
- Name: user friendly name to give to the server
- Host: container where postgres db is hosted
- Port: port of postgres db
- Username: user that will access to the db
- MaintenanceDB: main database name
pgpass: contains the password file for the db in this format
hostname:port:database:username:password