{"id":20909920,"url":"https://github.com/escalopa/vault-playground","last_synced_at":"2026-05-26T14:02:58.043Z","repository":{"id":198082848,"uuid":"699952837","full_name":"escalopa/vault-playground","owner":"escalopa","description":"An enviroment to play with Hashicorp Vault \u0026 learn it in depth","archived":false,"fork":false,"pushed_at":"2023-10-14T18:58:15.000Z","size":30,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-28T01:11:15.301Z","etag":null,"topics":["golang","secrets","vault"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/escalopa.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2023-10-03T16:54:26.000Z","updated_at":"2023-10-03T20:45:16.000Z","dependencies_parsed_at":"2024-11-18T14:13:35.024Z","dependency_job_id":"0e046cc5-1cb8-4c54-b9d7-5b8c30c7c9dc","html_url":"https://github.com/escalopa/vault-playground","commit_stats":null,"previous_names":["escalopa/vault-playground"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/escalopa/vault-playground","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/escalopa%2Fvault-playground","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/escalopa%2Fvault-playground/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/escalopa%2Fvault-playground/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/escalopa%2Fvault-playground/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/escalopa","download_url":"https://codeload.github.com/escalopa/vault-playground/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/escalopa%2Fvault-playground/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33523669,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T03:12:49.672Z","status":"ssl_error","status_checked_at":"2026-05-26T03:12:47.976Z","response_time":63,"last_error":"SSL_read: 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":["golang","secrets","vault"],"created_at":"2024-11-18T14:13:15.043Z","updated_at":"2026-05-26T14:02:57.977Z","avatar_url":"https://github.com/escalopa.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# vault-playground 🔒\nAn enviroment to play with Hashicorp Vault \u0026amp; learn it in depth\n\n## Pre-requisites 📚\n\n- [Docker](https://www.docker.com/)\n- [Vault](https://www.vaultproject.io/)\n- [Go](https://go.dev/doc/install)\n\n## Run 💨\n\n1. Start the docker containers\n```bash\ndocker compose up -d\n```\n\n2. Run the migration scripts\n```bash\nmake migrate\n```\n\n3. Start vault in insecure mode\n```bash\nmake vault\n```\n\n4. Set vault address in shell (On TLS use `https`)\n```bash\nexport VAULT_ADDR=http://127.0.0.1:8200\n```\n\n5. Enable role path in vault\n```bash\nvault auth enable approle\n```\n\n6. Create role for app\n```bash\nmake role-create\n```\n\n7. Set role policy\n```bash\nmake policy-create\n```\n\n8. Set database dsn secret\n```bash\nmake dns-create\n```\n\n9. Run the app\n```bash\nmake run\n```\n\n10. Get user orders\n```bash\ncurl -q http://localhost:8080/order/101 | jq\n```\n\n--- \n\n## Production Use Case 🏘\n\n1. Create directory `./vault/data`\n```bash\nmkdir -p ./vault/data\n```\n\n2. Start server \n```shell \nsudo make vault-prod\n```\n\n3. Init the server\n```bash\nvault operator init\n```\n\n4. Unseal the server using 3 secrets, Secrets can be found in the output of the 3rd command\n```bash\nvault operator unseal\n```\n\n5. Login to the server, Token can be found in the output of the 3rd command\n```bash\nvault login\n```\n\n## Database \u0026 Dynamic Secrets 🗄\n\nBefore we start make sure vault is up and running\n\n1. Create a role for vault in postgres db\n```bash\ndocker exec -i  db psql -U postgres -c \"CREATE ROLE \\\"vault-ro\\\" NOINHERIT;\"\n```\n\n2. Grant the ability to read all tables to vault role\n```bash\ndocker exec -i  db psql -U postgres -c \"GRANT SELECT ON ALL TABLES IN SCHEMA public TO \\\"vault-ro\\\";\"\n``` \n\n3. Enable database secrets engine\n```bash\nvault secrets enable database\n```\n\n4. Create database configuration in vault\n```bash\nmake vault-db\n```\n\n5. Create database role in vault\n```bash\nmake db-role-create\n```\n\n6. Get sample database credentials\n```bash\nvault read database/creds/readonly\n```\n\n7. Check the database credentials in postgres\n```bash\ndocker exec -i \\       \n    db \\\n    psql -U postgres -c \"SELECT usename, valuntil FROM pg_user;\"\n```\n\n\n## Milestones 🚀\n\n### v1.0.0 🎯\n- Read secrets from Vault\n- Write secrets to Vault\n- Connect to databse with secrets from Vault\n\n### v2.0.0 🎯\n- Create approle, policy for application\n- Create a vault client with approle\n- Read secrets from vault with approle policies\n- Run vault in production mode\n\n### v3.0.0 🎯\n- Link vault with postgres\n- Create/Read dynamic secrets","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fescalopa%2Fvault-playground","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fescalopa%2Fvault-playground","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fescalopa%2Fvault-playground/lists"}