{"id":23757158,"url":"https://github.com/mmitch/gbdt","last_synced_at":"2026-05-19T15:13:13.168Z","repository":{"id":138318822,"uuid":"48197229","full_name":"mmitch/gbdt","owner":"mmitch","description":"git based deployment tool","archived":false,"fork":false,"pushed_at":"2021-12-29T22:48:39.000Z","size":32,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-25T02:44:38.607Z","etag":null,"topics":["deployment","git","review","staging","static","webroot","website","workflow"],"latest_commit_sha":null,"homepage":null,"language":"Shell","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/mmitch.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,"zenodo":null}},"created_at":"2015-12-17T20:41:33.000Z","updated_at":"2023-08-26T19:10:40.000Z","dependencies_parsed_at":null,"dependency_job_id":"a2381aa9-c9cd-43dc-9790-3a92662bbe69","html_url":"https://github.com/mmitch/gbdt","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mmitch/gbdt","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mmitch%2Fgbdt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mmitch%2Fgbdt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mmitch%2Fgbdt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mmitch%2Fgbdt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mmitch","download_url":"https://codeload.github.com/mmitch/gbdt/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mmitch%2Fgbdt/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260640055,"owners_count":23040463,"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":["deployment","git","review","staging","static","webroot","website","workflow"],"created_at":"2024-12-31T19:38:15.552Z","updated_at":"2026-05-19T15:13:13.124Z","avatar_url":"https://github.com/mmitch.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"gbdt - git based deployment tool\n================================\n\n[![Build Status](https://travis-ci.org/mmitch/gbdt.svg?branch=master)](https://travis-ci.org/mmitch/gbdt)\n[![GPL 3+](https://img.shields.io/badge/license-GPL%203%2B-blue.svg)](http://www.gnu.org/licenses/gpl-3.0-standalone.html)\n\n\nusage\n-----\n\n    usage:\n      gbdt [-v] \u003cenv\u003e init           - initialize environment with CURRENT(!) state\n      gbdt [-v] \u003cenv\u003e deploy \u003ctag\u003e   - deploys tagged state to environment\n      gbdt [-v] \u003cenv\u003e status         - show status of an environment\n      gbdt [-v] \u003cenv\u003e tags           - show available \u003ctags\u003e in an environment\n    \n      gbdt [-v] stage deploy         - deploys CURRENT state to staging\n      gbdt [-v] stage stop           - remove staging environment\n    \n      gbdt [-v] status               - show status of all environments\n    \n      \u003cenv\u003e is an environment, see below\n      \u003ctag\u003e is a git tag\n  \n    environments:  \n      prod    - production  \n      stage   - staging  \n\n\nwhat? why?\n----------\n\nI wanted to develop a static website with a separate staging and\nproduction environment.  I sketched out a crude workflow for the\nwebpage development:\n\n* develop locally\n* deploy to staging\n* get feedback and review based on the staging version\n* either go back to development or deploy the staging version to\n  production\n\nAs I work on different machines, I needed some kind of source\nmanagement.  As I already do everything with it, git was the way to\ngo.  As I did not find a suitable existing tool after 5 minutes of\nsearching, I went into \"roll your own\" mode and gbdt was born to\nsupport the workflow shown above.  Being more of an infrastructure\nscript, gbdt will propably also work for other things than just\nwebsites.\n\n\nhow?\n----\n\n1. Initialize a git repository containg the website (e.g. the full\n   webroot with the initial `index.html` as well as all needed\n   subfolders).  The production and staging environment access the\n   same branch in the repository, normally `master`.\n\n2. Create `~/.gbdt` containing the following: (look out, the file gets\n   sourced, so don't put anything like `rm -rf` in it!)\n\n   * `GIT_REPO` - the git repository to use,\n     e.g. `ssh://somehost/home/foo/git/website.git`\n\n   * `PRODUCTION_DIR` - the directory where the production\n     environment should be checked out, e.g. `/var/www`\n\n   * `STAGING_DIR` - the directory where the staging\n     environment should be checked out, e.g. `/var/www/staging`\n     (yes, I simply use a subdirectory on the normal production\n      server - after testing I can stop the staging environment)\n\n   * `GIT_BRANCH` (optional) - the branch to use for the checkouts to\n     both environments (default if unset is `master`)\n\n   * `TAG_REGEXP` (optional) - an extended regular expression that\n     filters the tags shown on `gbdt tags` and prevents any tags not\n     matching to be deployed to production (deployment to staging is\n     still possible) (default if unset is `.`, matching everything)\n\n   * `post_deploy()` (optional) - a shell function to be run after\n     every deployment, see below\n\n3. Initialize the production environment with `gbdt prod init`\n\n4. To update production, run `gbdt prod deploy \u003ctag\u003e`, where `\u003ctag\u003e`\n   is a git tag from repository.  Deployments to production need a tag\n   so you can't just deploy arbitrary intermediate states of\n   development (in fact, you can propably trick gbdt into deploying\n   anything that looks like a git ref, e.g. a commit hash, but then\n   that's your problem).\n\n5. Likewise, to deploy a tagged version to staging, use `gbdt stage\n   deploy \u003ctag\u003e`.  Unlike production, staging can also be pointed to\n   the most current development version with `gbdt stage deploy`.\n\n6. After a review, the staging checkout can be thrown away with\n   `gbdt stage stop`.  This is very useful for me, as the staging\n   tree is located inside my production webroot and I don't want the\n   staging version accessible for everyone at all times.\n\n### post_deploy() power\n\nTo run an arbitrary deployment script, define the `post_deploy()`\nshell function in your configuration file like this:\n\n```bash\n\n    # post-deployment hook\n    # $1: target_dir\n    # $2: environment_name\n    post_deploy()\n    {\n        # disable Apache access to the .git subdirectory\n        cd \"$1\"\n        chmod 700 .git\n    }\n\t\n```\n\nYou could also write logfiles, ping Feedburner for an update or send\nan email.  Sky's the limit!\n\n\nfuture plans\n------------\n\ngbdt was specifically designed to support my workflow.  Both the\nworkflow and gbdt have been conceived in just about 24 hours.\nRegarding the proposed workflow gbdt is already feature complete, so\nno immediate changes are planned.  Whether my workflow will hold up to\nthe needs of reality, only time will tell :-) If it does not work out,\ngbdt will propably evolve.\n\n### possible functional improvements\n\n* support branch switching for staging\n  * As a developer I want to switch branches in the staging\n    environment so I can showcase different features.\n  * but is it really needed? trying to live without it for now\n\n### possible technical improvements\n\n* switch to getopt option parsing\n  * document all options (`-vv` and `-v -v` currently missing)\n  * provide -c option to select different configuration files\n* remove init command\n  * deploy command could initialize automatically\n  * this would also prevent initializing production without a proper\n    tag\n\n\nwhere to get it\n---------------\n\nThe project is hosted at https://github.com/mmitch/gbdt\n\n\ncopyright\n---------\n\nCopyright (C) 2015, 2016, 2018  Christian Garbs \u003cmitch@cgarbs.de\u003e  \nLicensed under GNU GPL v3 or later.\n\ngbdt is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\ngbdt is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with gbdt.  If not, see \u003chttp://www.gnu.org/licenses/\u003e.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmmitch%2Fgbdt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmmitch%2Fgbdt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmmitch%2Fgbdt/lists"}