This repository provides a simple docker compose
setup to run a self-hosted PostgreSQL instance.
It's configured to connect to a shared Docker network, making it easy to integrate with other services like n8n.
- Uses the official PostgreSQL Docker image.
- Data is persisted in a local volume.
- Pre-configured for a shared network for easy inter-service communication.
- Includes scripts for easy management (
restart-docker.sh
,update-docker.sh
). - Includes a
backup.sh
script for easy database backups.
-
Clone the repository:
git clone https://github.com/AiratTop/postgresql-self-hosted.git cd postgresql-self-hosted
-
Create the shared network: If you haven't already, create the shared Docker network:
docker network create shared_network
-
Configure environment variables: Update a
.env
file and specify your database credentials. -
Start the service:
docker compose up -d
- Start:
docker compose up -d
- Restart:
./restart-docker.sh
- Update:
./update-docker.sh
(Pulls the latest Docker image and restarts the container) - Backup:
./backup.sh
(Creates a compressed backup in thebackups
directory)
This setup is designed to work seamlessly with the n8n-self-hosted configuration. Since both services are on the shared_network
, you can connect to PostgreSQL from n8n using the container name psql
as the host.
Check out other self-hosted solutions:
- postgresql-self-hosted: A simple and robust PostgreSQL setup.
- mysql-self-hosted: A self-hosted MySQL instance.
- clickhouse-self-hosted: High-performance columnar database for analytics.
- metabase-self-hosted: Self-hosted Metabase on Docker for business intelligence and analytics.
- qdrant-self-hosted: A vector database for AI applications.
- redis-self-hosted: A fast in-memory data store, often used as a cache or message broker.
- caddy-self-hosted: A modern, easy-to-use web server with automatic HTTPS.
- wordpress-self-hosted: Production-ready WordPress stack with MySQL, phpMyAdmin, and WP-CLI.
- n8n-self-hosted: Scalable n8n with workers, Caddy for auto-HTTPS, and backup scripts.
- monitoring-self-hosted: Self-hosted monitoring stack with Prometheus and Grafana.
- ollama-self-hosted: Ready-to-use solution for running Ollama with the Open WebUI on Docker.
- authentik-self-hosted: Authentik is a flexible, open-source Identity & Access Management (IAM) solution.
This project is licensed under the MIT License - see the LICENSE file for details.
Airat Halitov
- Website: airat.top
- GitHub: @AiratTop
- Email: mail@airat.top
- Repository: postgresql-self-hosted