| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
PostgreSQL and Redis in Docker containers.
bash setup.shTakes ~1-2 minutes (downloads Docker images).
PostgreSQL:
Redis:
Both services are bound to localhost (127.0.0.1) for security and use SSL/TLS encryption:
# PostgreSQL
psql -h localhost -U postgres
# Redis
redis-cli -h localhostFor secure remote access, use SSH port forwarding:
# From your local machine - PostgreSQL
ssh -L 5432:localhost:5432 user@your-server
# From your local machine - Redis
ssh -L 6379:localhost:6379 user@your-server
# Then connect from your local machine
psql -h localhost -U postgres
redis-cli -h localhostPasswords are stored securely in ~/.db_passwords.env:
# View PostgreSQL password
grep POSTGRES_PASSWORD ~/.db_passwords.env
# View Redis password
grep REDIS_PASSWORD ~/.db_passwords.env
# Or view the entire file
cat ~/.db_passwords.env# Using psql
psql -h localhost -U postgres
# Enter password when prompted (retrieve from ~/.db_passwords.env)
# Or using Docker exec (no password needed)
docker exec -it postgres psql -U postgres
# Or install client
sudo apt install postgresql-client
psql -h localhost -U postgresUsing password from environment:
source ~/.db_passwords.env
psql -h localhost -U postgres -W
# Enter password: $POSTGRES_PASSWORD# Using redis-cli
redis-cli -h localhost
# Enter password: AUTH <password> (retrieve from ~/.db_passwords.env)
# Or using Docker exec (no password needed)
docker exec -it redis redis-cli
# Or install client
sudo apt install redis-tools
redis-cli -h localhostUsing password from environment:
source ~/.db_passwords.env
redis-cli -h localhost -a "$REDIS_PASSWORD"PostgreSQL:
# From environment file
source ~/.db_passwords.env
export PGPASSWORD="$POSTGRES_PASSWORD"
psql -h localhost -U postgres -d postgresRedis:
# From environment file
source ~/.db_passwords.env
redis-cli -h localhost -a "$REDIS_PASSWORD"
## Manage containers
```bash
docker ps # See running containers
docker stop postgres redis # Stop databases
docker start postgres redis # Start databases
docker logs postgres # View logs
docker logs redis # View Redis logs
docker exec -it postgres bash # Get shell in container
docker exec -it redis redis-cli # Redis CLI| Back | FazBrowse Home | New Git URL |