Skip to content

A simple, production-ready Docker Compose setup for self-hosting PostgreSQL. Includes persistent storage, management scripts (backup, update), and is pre-configured for easy integration with services like n8n on a shared network.

License

Notifications You must be signed in to change notification settings

AiratTop/postgresql-self-hosted

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PostgreSQL Self-Hosted with Docker

postgresql-self-hosted

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.

Features

  • 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.

Getting Started

  1. Clone the repository:

    git clone https://github.com/AiratTop/postgresql-self-hosted.git
    cd postgresql-self-hosted
  2. Create the shared network: If you haven't already, create the shared Docker network:

    docker network create shared_network
  3. Configure environment variables: Update a .env file and specify your database credentials.

  4. Start the service:

    docker compose up -d

Usage

  • 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 the backups directory)

Connecting with n8n

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.

See Also

Check out other self-hosted solutions:

License

This project is licensed under the MIT License - see the LICENSE file for details.


Author

Airat Halitov

About

A simple, production-ready Docker Compose setup for self-hosting PostgreSQL. Includes persistent storage, management scripts (backup, update), and is pre-configured for easy integration with services like n8n on a shared network.

Topics

Resources

License

Stars

Watchers

Forks

Languages