Skip to content

BehindTheMusicTree/db

Repository files navigation

bodzify-db-postgres

A customized PostgreSQL Docker image based on PostgreSQL 16.4, configured to allow remote connections with SCRAM-SHA-256 authentication.

Scope

This image is a generic Postgres runtime for BehindTheMusicTree services. It contains no application schema or migrations—those belong in your application repo (e.g. Django migrations). Use it with any Postgres client (Django, other backends). You can use the same image across multiple services or environments for consistent Postgres version and config.

Table of Contents

Features

  • Based on official PostgreSQL 16.4 image
  • Pre-installed dependencies: gettext, postgresql-client, net-tools
  • Configured for remote connections with SCRAM-SHA-256 authentication
  • Automatic configuration reload

When to use this image

  • Use when: You need Postgres 16.4 with remote SCRAM-SHA-256 and the included tools (gettext, postgresql-client, net-tools).
  • Look elsewhere when: You need a different Postgres version or additional extensions (extend this image or use the official one).

Prerequisites

  • Docker installed on your system

Building the Image

To build the Docker image, run the following command in the project directory:

docker build -t bodzify-db-postgres .

Running the Container

To run the PostgreSQL container, use:

docker run -d \
  --name my-postgres \
  -e POSTGRES_PASSWORD=mysecretpassword \
  -e POSTGRES_DB=mydatabase \
  -p 5432:5432 \
  bodzify-db-postgres

Environment Variables

The container supports standard PostgreSQL environment variables:

  • POSTGRES_PASSWORD: Sets the password for the default postgres user
  • POSTGRES_USER: Sets the username for the default user (defaults to postgres)
  • POSTGRES_DB: Sets the name of the default database

Ports

  • 5432: Default PostgreSQL port

Connecting to the Database

Once the container is running, you can connect to the database using any PostgreSQL client:

psql -h localhost -p 5432 -U postgres -d mydatabase

Configuration

The image includes custom configuration in setup_conf.sh that:

  • Adds a pg_hba.conf entry to allow remote connections from any IP with SCRAM-SHA-256 authentication
  • Reloads the PostgreSQL configuration

What this image does not include: No application schema or migrations (e.g. Django migrations live in your app repo). No default database name or app-specific users beyond what you set via POSTGRES_DB and POSTGRES_USER.

Files

  • Dockerfile: Docker image definition
  • install_dependencies.sh: Script to install additional dependencies
  • setup_conf.sh: Script to configure PostgreSQL for remote access
  • .github/workflows/publish.yaml: GitHub Actions workflow for automated builds and releases
  • .github/scripts/check-required-config.sh: Script to validate required variables and secrets

Contributing

Contributions are welcome! This project follows GitHub Flow and all changes go through Pull Requests.

Please read CONTRIBUTING.md for:

  • Development workflow and branching strategy
  • Code style and commit message conventions
  • Testing requirements
  • Pull request process and checklist
  • Release process (for maintainers)

License

[Specify your license here]

About

No description, website, or topics provided.

Resources

Contributing

Stars

Watchers

Forks

Sponsor this project

 

Packages

 
 
 

Contributors