Skip to main content

Simple git deployment tool

Project description

What is it

Durant is a simple deployment tool for git repositories. It sends the files to servers using rsync over ssh. Basically, this means that you can use durant to deploy any kind of application, no matter the language used.

Latest version

Durant is a work in progress, currently in beta phase. Latest available version is 0.2.3.

Requirements

Linux operating system and:

  • python (2.6, 2.7, 3.3, 3.4)

  • git

  • rsync

Installation

To install first make sure you have pip installed. Then simply run:

$ pip install durant

This will install durant globally. If you want to install for your user only use the --user option and make sure that you have $HOME/.local/bin added to your PATH:

$ pip install --user durant

Usage

Configuration file

First thing you need to set up is a configuration file. This is needed in order for the tool to know what and where to do the deployments. The configuration is named durant.conf and you have to place it in the root directory where your projects resides.

A sample config file is provided in this repository. You can define multiple stages to deploy to, each section of the config file representing a deployment stage. As you can see in the sample file, the structure follows the INI file format.

The first section of the file, called DEFAULT, holds general options such as the project’s repository, files to exclude when deploying or the local path where to clone the project before performing the deploy.

[DEFAULT]
repository: /repository/path/or/url
temp_dir: /local/directory/where/to/clone/before/deploy
exclude: .git, .gitignore, .gitmodules

The sections that follow can be as many as your deployment stages are. For instance, in the case of the production stage one configuration section could look like the following:

[production]
server: example.com, 127.0.0.1
user: username
branch: master
project_dir: /server/project/directory/root
before_deploy:
    composer install --no-dev --no-interaction --optimize-autoloader
    nosetests
    phpunit
    etc.

For each stage you can define the corresponding server, the username used when communicating via ssh, what branch to use, the project’s root directory on the server or some commands to execute before deployment. Please note that each of these commands must exit with return code 0 or else the deployment considers that something went wrong and halts the process, thus failing.

Some of the options can take multiple values, like when declaring servers or before deploy commands. In such cases you can separate multiple values by using commas or by entering each value on a different line, properly indented.

Please note that the deploy process works best if you have already setup ssh authentication for your servers by defining hosts and authentication details using the ~/.ssh/config file. If you haven’t, you can specify the identity key file to use when connecting to the server by using the ssh_identity option and also the ssh_port if you use a custom ssh port.

Command line tool

After everything is setup you can start using the command line tool. As you may have guessed, you can invoke it by using the name durant, from inside your project’s root directory:

$ durant deploy [OPTIONS] <stage>

If you want to test if the deploy process will perform well, without actually deploying to servers, you can specify the -n option in order to do a trial run.

$ durant deploy -n <stage>

This will give a view of the files that will be modified. I highly advice to use this option first to check if everything will go as expected and not have any surprises.

Examples

A successfully completed deployment may look like this:

./screens/success.gif

In case something turns out wrong, a corresponding error is raised and the process is stopped:

./screens/fail.gif

Contribute

If you find any bugs please feel free to open a related issue. You can also send directly a pull request with the bug fix if you want (please use the current stable branch in this case).

Release History

Please see the file called HISTORY.rst.

Licensing

Please see the file called LICENSE.

Release History

0.2.3 (2015-05-07)

  • Add the possibility to specify the remote to use (default is origin)

  • Internal changes:
    • Refactor code to use separated commands

    • Add console class to better handle console output

    • Add config class to handle config options

0.2.2 (2015-04-19)

  • Switch to argparse module for command line interface

0.2.1 (2015-04-14)

Bugfixes

  • Fix rsync exclude command build error

0.2.0 (2015-04-14)

  • Use common git files such as .gitignore, .gitmodules, .gitkeep and the .git directory as default exclude patterns when building the rsync command

0.1.0 (2015-04-14)

  • Initial public release

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

durant-0.2.3.tar.gz (6.8 kB view details)

Uploaded Source

File details

Details for the file durant-0.2.3.tar.gz.

File metadata

  • Download URL: durant-0.2.3.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for durant-0.2.3.tar.gz
Algorithm Hash digest
SHA256 1c58da8f116ad66f3f41503c8a10883f4b2ab95adefb27c54f7e214516142fe9
MD5 18effa85d87d5f111c0abbbfcaeb5bde
BLAKE2b-256 8a7b62e3e529420cd26534fe23a471a9d2429c58410b49e34b18be1eeb7b80a8

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page