{ "info": { "author": "Git Tools", "author_email": "preilly@php.net,bobs.ur.uncle@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Console", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Topic :: Software Development :: Version Control", "Topic :: Utilities" ], "description": "git-deploy\n==========\n\nIt is a tool to manage using git as a deployment management tool implemented in Python and utilizing the dulwich [1]\nproject for native git functionality in Python.\n\nGit-deploy implements the front end of the deployment system while hooks give the user flexibility in the lower level\ndetails of the deploy. This client uses git to manage the state of your repository and deployment and assumes that on\nsync the hooks ensure that the target is made consistent with the client (see default.sync) however, the user is free to\nadd their own deployment flow and environment options (see examples below).\n\n[1] https://github.com/jelmer/dulwich\n\n\nUsage\n-----\n\nBasic usage involves cloning the remote working repo to the deploy target and all client nodes. When\na client is ready to deploy 'start' is invoked to obtain a lock on the remote and 'sync' is called to\npush changes to the target. On completion the lock is removed.\n\nTo start a new deployment, navigate to the working repo, issue a 'start' command:\n\n $ git deploy start [opts]\n\nAt this point you are free to make commits to the project and when ready for deployment issue \na 'sync' command - or simply 'sync' if you're work is already complete but, be sure to rebase\nyour local clone:\n\n $ git deploy sync [opts]\n\nThe process may be aborted at any point with an 'abort' command:\n\n $ git deploy abort [opts]\n\nYou can rollback to a tag with the revert call:\n\n $ git deploy revert [-t ] [opts]\n\nIf no tag is supplied the rollback uses the most recent tag. The default is to only commit the rollback locally\nhowever, by suppling the \"-a\" option for auto-sync the rollback automatically syncs also:\n\n $ git deploy revert [-t ] [opts]\n\n\nSetup\n-----\n\nThe following example illustrates how git-deploy can be configured and used for a single client and target. For this\nexample the client host and target host will be referred to as *client.realm.org* and *target.realm.org* respectively.\nThe home path on the client and target for our sample project is */home/me/project/* and */var/www/html/sample.com/*\nrespectively. It is assumed that the git remote is configured for your project and for this example the remote alias is\n*origin* and the remote branch is *master*.\n\n\n**CLIENT SETUP**\n\nThe client is any working machine from which deployments may be initiated. On *client.realm.org* clone git deploy, local\ninstall, configure settings and initialize:\n\n $ git clone git@github.com:Git-Tools/git-deploy.git\n\n ...\n\n $ cd git-deploy\n $ sudo pip install -e .\n\n ...\n\nNext configure the client instance with git config by assigning the following settings in *scripts/git-deploy.ini*:\n\n [deploy]\n target=target.realm.org\n path=/home/me/project/\n user=me\n hook-dir=.git/deploy/hooks/\n tag-prefix=sample.com\n remote=origin\n branch=master\n client-path=/home/me/project/\n key-path=/home/me/.ssh/id_rsa\n test-repo-path=/tmp/test_repo/\n [system]\n run_root=/usr/bin/\n\nOnce you have defined settings in *git-deploy.ini* call *init.py* to set the got config\n\n $ sudo ./scripts/init_gd\n\n\n**TARGET SETUP**\n\nOn *target.realm.org* there is no need to clone and install git-deploy but here the deploy hooks will need to be\ncreated. There is a default hook in *git-deploy/default-hooks/default-target-pull.py* that should be copied to\n*target.realm.org:/var/www/html/sample.com/.git/deploy/hooks/*. This is a basic hook that will pull the changes\npushed from the client instance on sync.\n\n\n**USING GIT DEPLOY**\n\nFirst initialize a new repository on your client:\n\n $ mkdir me.com\n $ cd me.com\n $ git init\n $ git remote add origin git@github.com:wikimedia/me.com.git\n $ git push origin master\n\nOn the target you only need to ensure that *path* in config exists and is configured as a git repo for your project.\n\n*Start* & *Sync*:\n\nEnsure that the client is correctly synced to the remote by issuing a git pull or rebase. Then you can issue a\na start command to write the lock file to the target to begin the deployment.\n\n $ cd me.com\n $ touch new_file\n $ git add new_file\n $ git commit -m \"add - my new file\"\n $ git pull --rebase origin master\n\nAt this point you are ready to enter the deployment process:\n\n client.realm.org:me.com me$ git deploy start\n\n \n\n client.realm.org:me.com me$ git deploy sync\n\nOnce you sync a the specified hooks will be invoked from the client and the target and a tag is written to the\nrepository on the latest commit of the deploy. If the default push and pull hooks are used the client will simply\npush its changes to the remote and the target will pull in the new changes. Deployment tags have the form\n*-sync--