{"id":34168009,"url":"https://github.com/tendant/dbstrap","last_synced_at":"2026-03-12T06:39:21.826Z","repository":{"id":288172179,"uuid":"967042616","full_name":"tendant/dbstrap","owner":"tendant","description":"A CLI tool for bootstrapping PostgreSQL databases, users, schemas, and extensions from a YAML configuration.","archived":false,"fork":false,"pushed_at":"2025-04-19T20:50:44.000Z","size":38,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-12T15:48:16.475Z","etag":null,"topics":["database","postgresql"],"latest_commit_sha":null,"homepage":"","language":"Go","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/tendant.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-04-15T20:53:32.000Z","updated_at":"2025-05-13T18:36:47.000Z","dependencies_parsed_at":"2025-04-15T23:46:31.250Z","dependency_job_id":null,"html_url":"https://github.com/tendant/dbstrap","commit_stats":null,"previous_names":["tendant/db-bootstrap","tendant/db-setup-tool"],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/tendant/dbstrap","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tendant%2Fdbstrap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tendant%2Fdbstrap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tendant%2Fdbstrap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tendant%2Fdbstrap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tendant","download_url":"https://codeload.github.com/tendant/dbstrap/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tendant%2Fdbstrap/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30417524,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-12T04:41:02.746Z","status":"ssl_error","status_checked_at":"2026-03-12T04:40:12.571Z","response_time":114,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["database","postgresql"],"created_at":"2025-12-15T10:44:07.863Z","updated_at":"2026-03-12T06:39:21.810Z","avatar_url":"https://github.com/tendant.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dbstrap\n\nA CLI tool for bootstrapping PostgreSQL databases, users, schemas, and extensions from a YAML configuration. Powered by Golang and [kong](https://github.com/alecthomas/kong) CLI library.\n\n## Features\n\n- Create users with login privileges\n- Set user roles and ownerships\n- Bootstrap databases with custom encoding, collation, and templates\n- Create schemas with specific grants to users and roles, including table, sequence, function, and default privileges\n- Install database extensions\n- Manage grants at both database and schema levels\n\n## Installation\n\nClone the repo and build the CLI:\n\n```bash\ngo install github.com/tendant/dbstrap/cmd/dbstrap@latest\n```\n\n## Run from binary\n\n```bash\nexport DATABASE_URL=postgres://postgres:pwd@localhost:5432/postgres\nexport TEST_USER_PASSWORD=pass123\ndbstrap run --config=samples/bootstrap.yaml\n```\n\n## How to run from source\n\n1. **Set environment variables**:\n\n   ```bash\n   export DATABASE_URL=postgres://postgres:pwd@localhost:5432/postgres\n   export TEST_USER_PASSWORD=pass123\n   \n2. Create your config file (bootstrap.yaml):\n\nSee the Sample Config section for a working example.\n\n3. Run the CLI:\n\n    go run ./cmd/dbstrap run --config=samples/bootstrap.yaml\n\n## Sample Config\n\nHere's an example configuration that demonstrates the main features:\n\n```yaml\nusers:\n  - name: test_user\n    password_env: TEST_USER_PASSWORD\n    can_login: true\n    owns_schemas:\n      - public\n    roles: []\n  - name: read_only_user\n    password_env: TEST_USER_PASSWORD\n    can_login: true\n    owns_schemas: []\n    roles: [readonly_role]\n\ndatabases:\n  - name: test_db\n    owner: test_user\n    encoding: UTF8\n    lc_collate: en_US.UTF-8\n    lc_ctype: en_US.UTF-8\n    template: template0\n    extensions:\n      - \"uuid-ossp\"\n    grants:\n      - user: test_user\n        privileges: [CONNECT]\n    schemas:\n      - name: public\n        owner: test_user\n        grants:\n          - user: test_user\n            privileges: [USAGE, CREATE]\n            table_privileges: [SELECT, INSERT, UPDATE, DELETE]\n            sequence_privileges: [USAGE, SELECT, UPDATE]\n            function_privileges: [EXECUTE]\n            default_privileges: [SELECT, INSERT, UPDATE, DELETE]\n          - role: readonly_role\n            privileges: [USAGE]\n            table_privileges: [SELECT]\n            sequence_privileges: [USAGE, SELECT]\n            function_privileges: [EXECUTE]\n            default_privileges: [SELECT]\n      - name: analytics\n        owner: test_user\n        grants:\n          - user: test_user\n            privileges: [USAGE, CREATE]\n            table_privileges: [SELECT, INSERT, UPDATE, DELETE]\n            sequence_privileges: [USAGE, SELECT, UPDATE]\n            function_privileges: [EXECUTE]\n            default_privileges: [SELECT, INSERT, UPDATE, DELETE]\n          - role: readonly_role\n            privileges: [USAGE]\n            table_privileges: [SELECT]\n            sequence_privileges: [USAGE, SELECT]\n            function_privileges: [EXECUTE]\n            default_privileges: [SELECT]\n```\n\nIn this example, we're creating:\n- Two users: `test_user` (owner) and `read_only_user` (with readonly access)\n- A database named `test_db` with the UUID extension\n- Two schemas: `public` and `analytics`\n- Grants at both database and schema levels, including role-based permissions\n- Comprehensive object privileges within schemas:\n  - Table privileges for all existing tables\n  - Sequence privileges for all sequences (important for auto-incrementing columns)\n  - Function privileges for all stored procedures and functions\n  - Default privileges for future objects created in the schema","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftendant%2Fdbstrap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftendant%2Fdbstrap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftendant%2Fdbstrap/lists"}