4.2 KiB
4.2 KiB
pgAdmin - PostgreSQL Management
Table of Contents
- Overview
- What is pgAdmin?
- Why Use pgAdmin?
- Configuration in AI-Homelab
- Official Resources
- Docker Configuration
Overview
Category: Database Management
Docker Image: dpage/pgadmin4
Default Stack: development.yml
Web UI: http://SERVER_IP:5050
Purpose: PostgreSQL GUI management
Ports: 5050
What is pgAdmin?
pgAdmin is the most popular open-source management tool for PostgreSQL. It provides a web-based GUI for administering PostgreSQL databases - creating databases, running queries, managing users, viewing data, and more. Essential for PostgreSQL users who prefer visual tools over command-line.
Key Features
- Web Interface: Browser-based access
- Query Tool: SQL editor with syntax highlighting
- Visual Database Designer: Create tables visually
- Data Management: Browse and edit data
- User Management: Manage roles and permissions
- Backup/Restore: GUI backup operations
- Server Monitoring: Performance dashboards
- Multi-Server: Manage multiple PostgreSQL servers
- Free & Open Source: PostgreSQL license
Why Use pgAdmin?
- Visual Interface: Easier than command-line
- Query Editor: Write and test SQL visually
- Data Browser: Browse tables easily
- Backup Tools: GUI backup/restore
- Multi-Server: Manage all PostgreSQL instances
- Graphical Design: Design schemas visually
- Industry Standard: Most used PostgreSQL tool
Configuration in AI-Homelab
/opt/stacks/development/pgadmin/data/
pgadmin4.db # pgAdmin configuration
sessions/ # Session data
storage/ # Server connections
Official Resources
- Website: https://www.pgadmin.org
- Documentation: https://www.pgadmin.org/docs
- GitHub: https://github.com/pgadmin-org/pgadmin4
Docker Configuration
pgadmin:
image: dpage/pgadmin4:latest
container_name: pgadmin
restart: unless-stopped
networks:
- traefik-network
ports:
- "5050:80"
environment:
- PGADMIN_DEFAULT_EMAIL=admin@homelab.local
- PGADMIN_DEFAULT_PASSWORD=${PGADMIN_PASSWORD}
- PGADMIN_CONFIG_SERVER_MODE=False
- PGADMIN_CONFIG_MASTER_PASSWORD_REQUIRED=False
volumes:
- /opt/stacks/development/pgadmin/data:/var/lib/pgadmin
labels:
- "traefik.enable=true"
- "traefik.http.routers.pgadmin.rule=Host(`pgadmin.${DOMAIN}`)"
Setup
-
Start Container:
docker compose up -d pgadmin -
Access UI:
http://SERVER_IP:5050 -
Login:
- Email:
admin@homelab.local - Password: (from PGADMIN_PASSWORD env)
- Email:
-
Add Server:
- Right-click "Servers" → Register → Server
- General tab:
- Name:
PostgreSQL Dev
- Name:
- Connection tab:
- Host:
postgres(container name) - Port:
5432 - Maintenance database:
postgres - Username:
admin - Password: (from PostgreSQL)
- Save password: ✓
- Host:
- Save
-
Browse Database:
- Expand server tree
- Servers → PostgreSQL Dev → Databases
- Right-click database → Query Tool
-
Run Query:
- Query Tool (toolbar icon)
- Write SQL
- Execute (F5 or play button)
Summary
pgAdmin is your PostgreSQL GUI offering:
- Web-based interface
- SQL query editor
- Visual database design
- Data browsing and editing
- User management
- Backup/restore tools
- Multi-server support
- Free and open-source
Perfect for:
- PostgreSQL administration
- Visual database management
- SQL query development
- Database design
- Learning PostgreSQL
- Backup management
Key Points:
- Web-based (browser access)
- Manage multiple PostgreSQL servers
- Query tool with syntax highlighting
- Visual schema designer
- Default: admin@homelab.local
- Change default password!
- Save server passwords
Remember:
- Set strong admin password
- Add all PostgreSQL servers
- Use query tool for SQL
- Save server connections
- Regular backups via GUI
- Monitor server performance
- Explore visual tools
pgAdmin makes PostgreSQL management visual!