{"id":24489716,"url":"https://github.com/big-data-forge/postgres-worksheet","last_synced_at":"2025-03-15T01:20:57.365Z","repository":{"id":271141288,"uuid":"912509207","full_name":"Big-Data-Forge/postgres-worksheet","owner":"Big-Data-Forge","description":"Preconfigured containerized environment for working with PostgreSQL database infrastructure using PgBouncer and pgAdmin with custom setup.","archived":false,"fork":false,"pushed_at":"2025-01-21T14:07:41.000Z","size":27,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-01-21T15:22:27.487Z","etag":null,"topics":["containerization","docker","docker-compose","pgadmin","pgbouncer","postgres","postgres-database","postgres-docker","postgresql","postgresql-database","sandbox","worksheet"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Big-Data-Forge.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":"FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"ko_fi":"kyryloktl"}},"created_at":"2025-01-05T19:10:20.000Z","updated_at":"2025-01-21T14:07:45.000Z","dependencies_parsed_at":null,"dependency_job_id":"843a9b1c-bac1-4771-893e-ac373cad4382","html_url":"https://github.com/Big-Data-Forge/postgres-worksheet","commit_stats":null,"previous_names":["big-data-forge/postgres-worksheet"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Big-Data-Forge%2Fpostgres-worksheet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Big-Data-Forge%2Fpostgres-worksheet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Big-Data-Forge%2Fpostgres-worksheet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Big-Data-Forge%2Fpostgres-worksheet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Big-Data-Forge","download_url":"https://codeload.github.com/Big-Data-Forge/postgres-worksheet/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243668918,"owners_count":20328171,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["containerization","docker","docker-compose","pgadmin","pgbouncer","postgres","postgres-database","postgres-docker","postgresql","postgresql-database","sandbox","worksheet"],"created_at":"2025-01-21T17:15:41.919Z","updated_at":"2025-03-15T01:20:57.333Z","avatar_url":"https://github.com/Big-Data-Forge.png","language":null,"funding_links":["https://ko-fi.com/kyryloktl"],"categories":[],"sub_categories":[],"readme":"[![Docker](https://img.shields.io/badge/Docker-%230db7ed.svg?logo=docker\u0026logoColor=white)](https://www.docker.com/)\n[![Docker Compose](https://img.shields.io/badge/Docker%20Compose-%230db7ed.svg?logo=docker\u0026logoColor=white)](https://docs.docker.com/compose/)\n[![PostgreSQL](https://img.shields.io/badge/PostgreSQL-%23316192.svg?logo=postgresql\u0026logoColor=white)](https://www.postgresql.org/)\n[![PgBouncer](https://img.shields.io/badge/PgBouncer-%23316192.svg?logo=postgresql\u0026logoColor=white)](https://www.pgbouncer.org/)\n[![pgAdmin](https://img.shields.io/badge/pgAdmin-%23316192.svg?logo=postgresql\u0026logoColor=white)](https://www.pgadmin.org/)\n\u003cbr\u003e\n![OS](https://img.shields.io/badge/OS-Linux%2C%20Windows%2C%20MacOS-0078D4)\n![CPU](https://img.shields.io/badge/CPU-x86%2C%20x64%2C%20ARM%2C%20ARM64-FF8C00)\n![GitHub last commit](https://img.shields.io/github/last-commit/Kyrylo-Ktl/advent-of-code)\n\n# Postgres worksheet\n\nThis project provides a preconfigured environment for working with PostgreSQL database infrastructure using Docker Compose.\nIt includes the following services:\n\n+ [PostgreSQL](https://www.postgresql.org/) - the primary database service with custom configuration;\n+ [PgBouncer](https://www.pgbouncer.org/) - a lightweight connection pooler for PostgreSQL;\n+ [pgAdmin](https://www.pgadmin.org/) - a web-based PostgreSQL database management tool.\n\n\n## Architecture\n\n### Components\n\n![Architecture diagram](https://github.com/user-attachments/assets/d20e472b-6c2d-4561-b31c-f8cd13c6a020)\n\n### Features\n\nThis preconfigured project environment provides the following features:\n\n+ **PostgreSQL**\n  + Custom configuration through a mounted `postgresql.conf` file;\n  + Automated data model creation with scripts from mounted `docker-entrypoint-initdb.d` folder;\n  + Persistent data model storage via volumes;\n  + Resources optimal setup - CPU (2) and memory (4G);\n  + Health checks to ensure the database is ready before other services start;\n  + Isolated in the internal Docker network;\n\n\n+ **PgBouncer**;\n  + Connection pooling for database to optimize resource usage;\n  + SCRAM-SHA-256 authentication for secure connections;\n  + Resources optimal setup - CPU (0.5) and memory (1G);\n  + Accessible via the external Docker network;\n\n\n+ **pgAdmin**;\n  + Persistent configurations storage via volumes;\n  + Resources optimal setup - CPU (0.5) and memory (1G);\n\n### Data model\n\nIn this project, an e-commerce data model is implemented by default to manage customers, products and related orders.\nThe data model is created automatically when the database is first started and is populated with synthetic records:\n\n+ Customers - [table](config/postgresql/scripts/01-create-0001-customers-table.sql) with information about 10,000 [randomly generated](config/postgresql/scripts/02-fill-0001-customers-table.sql) customers;\n+ Products - [table](config/postgresql/scripts/01-create-0002-products-table.sql) with information about 100,000 [randomly generated](config/postgresql/scripts/02-fill-0002-products-table.sql) products;\n+ Orders - [table](config/postgresql/scripts/01-create-0003-orders-table.sql) with information about 1,000,000 [randomly generated](config/postgresql/scripts/02-fill-0003-orders-table.sql) orders;\n\n![postgres-worksheet-er](https://github.com/user-attachments/assets/dd8c7574-8d83-4bc8-b134-2d17b6686fa3)\n\n\n## Usage\n\n### Prerequisites\n\nMake sure you have [Docker](https://www.docker.com/) and [Docker Compose](https://docs.docker.com/compose/) installed on your machine.\n\n### Setup\n\nProject uses an `.env` file with environment variables to manage configurations and tool settings.\nThe file should be created using the `.env.example` file provided in the root directory using the following command:\n\n\n```shell\ncp .env.example .env\n```\n\nAnd then filled with the corresponding values: \n\n```dotenv\nPOSTGRES_DB=\u003cdatabase-name\u003e\nPOSTGRES_USER=\u003cpostgres-user\u003e\nPOSTGRES_PASSWORD=\u003cpostgres-password\u003e\n\nPGADMIN_DEFAULT_EMAIL=\u003cpgadmin-email\u003e\nPGADMIN_DEFAULT_PASSWORD=\u003cpgadmin-password\u003e\n\nPOSTGRESQL_HOST=postgres\nPOSTGRESQL_PORT=5432\n```\n\n### Run\n\nBuild and start the database services infrastructure by running:\n\n```shell\ndocker compose up -d --build\n```\n\n\u003e [!NOTE]  \n\u003e First run will take some time, as all necessary docker images will be loaded and the data model will be created and populated with synthetic records.\n\nCheck that all services are successfully started by running:\n\n```shell\ndocker compose ps\n```\n\nTo stop all running services, execute:\n\n```shell\ndocker compose down\n```\n\n\u003e [!NOTE]  \n\u003e After stopping the services, the data will not be deleted and will be available when the services are restarted.\n\nIf you want to stop the services and remove all associated data use:\n\n```shell\ndocker compose down --volumes\n```\n\n\u003e [!WARNING]\n\u003e This command deletes all service data (e.g. data model, stored passwords and configurations).\n\n\n## License\n\nThis project is licensed under the [MIT License](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbig-data-forge%2Fpostgres-worksheet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbig-data-forge%2Fpostgres-worksheet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbig-data-forge%2Fpostgres-worksheet/lists"}