-
Notifications
You must be signed in to change notification settings - Fork 3
Deployments
Eregansu Deployments is a way of using the Git version control system to automate much of the heavy lifting of deploying a release of your application to a remote host. Deployment targets are specially-configured Git repositories which are accessible with SSH and have a particular directory structure:
/path/to/target
repository.git/current/son/father/grandfather/shared/private/
When a deployment target is configured, a new remote configuration is added to your local Git repository. The name of the remote, used in git push commands, is the same of the name of the Eregansu instance used by that copy of the application. The URL of the deployment target takes the form user@host:/path/to/target, and this results in the remote being registered with a URL of user\@host:/path/to/target/repository.git.
Within the structure outlined above, each of the subdirectories within /path/to/target on the server has a specific purpose.
repository.git is an (initially bare) Git repository, configured with a post-receive hook to perform the server-side portion of deployments. It is also configured with a detached work tree (i.e., git config core.worktree /path/to/target/son) amongst other options.
The current subdirectory is the directory you set as your web server’s document root (i.e., the DocumentRoot statement in Apache’s configuration).
The son subdirectory exists only while a deployment is in progress, and contains the copy of the application which will be current once the deployment is complete.
The father subdirectory contains the version of the application which was previously current.
The grandfather subdirectory contains the version of the application which was current prior to the father.
The shared subdirectory contains files and directories which are not maintained by Git, but need to be part of the deployment; the post-receive hook which manages the deployment creates symbolic links to each file or directory within shared automatically.
The private subdirectory is designed for files which need to be writeable by the web server user, but are not exposed to users. The post-receive hook will not touch the private subdirectory.