Deploy your project(s) using shell scripts.
This deployment strategy assumes:
- a server to build your project(s)
- bash is installed on every involved servers (build and target servers)
- project(s) versioned under git
- the build server can access target servers using ssh and rsync
This script is composed of mainly 2 commands: build
and release
.
The first one is meant to create an archive file for a given revision.
It should be immutable in a way that if you call this command twice for the same revision, it should produce the exact same content: an archive.
The latter command deploy an archive produced by the build
command to a determined target server(s).
deploy build [options] <revision>
- Refresh the local repository. The script maintains a repository stored within the build server. If you have specified a remote repository url, this steps will refresh the local repository
- Create a workspace in the build server's temporary directory.
- Extract git content of the specified revision using
git archive
- Generate a .REVISION file in the root directory of the workspace. This file will contain the commit sha of the current revision.
- Call a user defined hook name "build". This is where you can add some specific action to do during the build step.
- Archive the workspace in a tar.bz2 file.
For more details about this command, use the
--help
option or visit the build documentation
deploy release [options] <config-file> <archive-file> [<server-name> ...]
config-file: a configuration file containing every details needed to deploy to servers. TODO: explain the config file content
archive-file: the archive file produced by the build command.
server-name: optional. Name of one or more servers to deploy to. It filters the server list provided by the config-file and allows to deploy to less servers than in a normal process.
- Test ssh connection to specified servers
- Ensure directory structure exists within each servers, creating it if not. TODO: explain the directory structure
- Ensure defined shared items exists in the shared folder. Call hook "create_shared_links" if an item does not exists and check again.
- Send archive to every servers
- Extract archive within every servers and rename the folder with the current date
- Link release with shared items defined in the config file
- Activate the release. TODO: explain what it means
- Clean old releases.
Use the
--help
option for more details about this command.