Skip to content

programmerShinobi/postgresql-fdw

🐘 PostgreSQL FDW Dev

A production-shaped, laptop-friendly PostgreSQL development environment. Foreign Data Wrappers + vector search + scheduling + partitioning + auditing β€” all pre-installed, tuned to coexist peacefully with Elasticsearch, Redis and NestJS.

CI PostgreSQL Docker License: MIT PRs Welcome


✨ What you get

  • PostgreSQL 17 on the official Debian image, fully reproducible.
  • 15+ extensions ready to use the moment the container is up β€” including postgres_fdw, mysql_fdw, tds_fdw, file_fdw, pgvector, pg_cron, pg_partman, pg_stat_statements, pgaudit, pg_repack, hypopg, pg_hint_plan, orafce, and the usual uuid-ossp/pgcrypto/pg_trgm toolbox.
  • Laptop-safe by design β€” hard Docker memory & CPU caps so Postgres can never starve your other heavy services.
  • One-command workflow via make (up, down, psql, backup, restore, stats…).
  • Documented end-to-end β€” a checklist you can tick off from requirements all the way to deployment.

πŸš€ Quick start (TL;DR)

# 1. Configure (edit the password!)
cp .env.example .env

# 2. Build the image (first build compiles mysql_fdw β€” grab a coffee β˜•)
make build

# 3. Start
make up

# 4. Verify extensions are live
make extensions

Then connect:

postgresql://local_dev:<your-password>@127.0.0.1:15409/local_db

Host port 15409 mirrors the original reference connection string; the generic local_dev / local_db names keep this reusable. Change anything in .env.


πŸ“š Documentation β€” read in order

Each document is a self-contained checklist. Tick the boxes as you go.

# Document What it covers
0 Getting Started πŸ‘ˆ New here? Start with this β€” friendly step-by-step walkthrough
1 Requirements Hardware/software prerequisites, your laptop's budget
2 Installation Step-by-step from clone to running container
3 Configuration Every .env & postgresql.conf knob explained
4 Extensions What each extension does + usage snippets
5 Resource Tuning Why the limits are what they are; how to rebalance
6 NestJS Integration Wiring this DB into a NestJS/TypeORM/Prisma app
7 Backup & Restore Dump, restore, and scheduled backups
8 Deployment Promoting the same setup toward staging/prod
9 Troubleshooting Common errors and fixes
10 Security Hardening checklist for dev and beyond
11 Import from Source Safely migrate data from an existing PostgreSQL
12 Optional Features Opt-in pooler / backups / UI / metrics β€” zero cost when off

πŸ—‚οΈ Repository layout

postgresql-fdw/
β”œβ”€β”€ docker-compose.yml          # the stack + hard resource caps
β”œβ”€β”€ Dockerfile                  # PG17 + extensions (compiles mysql_fdw)
β”œβ”€β”€ .env.example                # copy to .env and edit
β”œβ”€β”€ Makefile                    # make up / down / psql / backup ...
β”œβ”€β”€ config/
β”‚   └── postgresql.conf         # laptop-tuned server config
β”œβ”€β”€ scripts/
β”‚   β”œβ”€β”€ init/                   # auto-run on first boot
β”‚   β”‚   β”œβ”€β”€ 00-extensions.sql   #   CREATE EXTENSION for everything
β”‚   β”‚   └── 01-roles-and-grants.sql
β”‚   └── fdw-examples/           # copy-paste FDW recipes (not auto-run)
β”œβ”€β”€ backups/                    # pg_dump output lands here
└── docs/                       # the numbered guides above

βœ… Master checklist

A bird's-eye view. Detailed steps live in the linked docs.

  • Requirements met β€” Docker Engine + Compose v2, β‰₯2 GB free RAM budget β†’ doc 1
  • .env created and password changed β†’ doc 2
  • Image built (make build) β†’ doc 2
  • Container healthy (make health) β†’ doc 2
  • Extensions verified (make extensions) β†’ doc 4
  • Resource caps reviewed for your machine β†’ doc 5
  • App connected (NestJS) β†’ doc 6
  • Backup tested at least once β†’ doc 7
  • Security checklist reviewed β†’ doc 10

🧩 Optional features (off by default, zero cost when off)

A plain make up starts only PostgreSQL. Everything else is opt-in via Docker Compose profiles, each hard-capped so it never slows your laptop:

make up-pooler    # + PgBouncer connection pooler   (port 6432)
make up-backup    # + scheduled rotated backups
make up-ui        # + Adminer web UI                (http://localhost:8080)
make up-metrics   # + postgres-exporter             (http://localhost:9187)
make up-all       # + everything above

Full matrix & tuning: doc 12 β€” Optional Features.

🧰 Everyday commands

make up           # start ONLY core Postgres
make down         # stop everything (data kept)
make psql         # open a psql shell
make extensions   # list installed extensions
make stats        # live CPU/RAM of the container
make backup       # one-off dump to ./backups (manual)
make logs         # follow logs
make destroy      # stop AND delete data (careful!)
make help         # everything

πŸ‘€ Author

programmerShinobi Β· GitHub

If this project helps you, a ⭐ on the repo is appreciated!

πŸ“„ License

Copyright Β© 2026 programmerShinobi. Released under the MIT License.

About

Dockerized PostgreSQL 17 dev setup with FDW + many extensions, laptop-tuned. Optional pooler/backup/UI/metrics via compose profiles.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors