hapistrano: A deployment library for Haskell applications

[ library, mit, program, system ] [ Propose Tags ]

Hapistrano makes it easy to reliably deploy Haskell applications to a server.

Following popular libraries like Ruby's <http://capistranorb.com/ Capistrano>, Hapistrano does the work of building the application with dependencies into a distinct folder, and then atomically moves a symlink to the latest complete build.

This allows for atomic switchovers to new application code after the build is complete. Rollback is even simpler, since Hapistrano can just point the current symlink to the previous release.

See the project readme on GitHub for more information.


[Skip to Readme]

Modules

[Index]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 0.1.0.0, 0.1.0.1, 0.1.0.2, 0.2.0.1, 0.2.0.2, 0.2.1, 0.2.1.1, 0.2.1.2, 0.3.0.0, 0.3.0.1, 0.3.1.0, 0.3.2.0, 0.3.2.1, 0.3.2.2, 0.3.2.3, 0.3.2.4, 0.3.3.0, 0.3.4.0, 0.3.5.0, 0.3.5.1, 0.3.5.2, 0.3.5.3, 0.3.5.4, 0.3.5.5, 0.3.5.6, 0.3.5.7, 0.3.5.8, 0.3.5.9, 0.3.5.10, 0.3.6.0, 0.3.6.1, 0.3.7.0, 0.3.8.0, 0.3.9.0, 0.3.9.1, 0.3.9.2, 0.3.9.3, 0.3.9.4, 0.3.10.0, 0.4.0.0, 0.4.0.1, 0.4.1.0, 0.4.1.1, 0.4.1.2, 0.4.1.3, 0.4.1.4, 0.4.2.0, 0.4.3.0, 0.4.4.0, 0.4.5.0, 0.4.6.0, 0.4.7.0, 0.4.8.0
Change log changes.md
Dependencies base (>=4.5 && <4.10), base-compat, either, filepath, hapistrano, mtl, process, time, time-locale-compat, transformers [details]
License MIT
Copyright 2015 Stack Builders Inc.
Author Justin Leitgeb
Maintainer justin@stackbuilders.com
Category System
Home page https://github.com/stackbuilders/hapistrano
Bug tracker https://github.com/stackbuilders/hapistrano/issues
Source repo head: git clone https://github.com/stackbuilders/hapistrano
Uploaded by jpvillaisaza at 2016-05-30T18:52:29Z
Distributions
Reverse Dependencies 1 direct, 0 indirect [details]
Executables hap
Downloads 28474 total (109 in the last 30 days)
Rating 2.25 (votes: 2) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2016-05-30 [all 1 reports]

Readme for hapistrano-0.2.1.2

[back to package description]

Build Status Hackage version

Hapistrano

Hapistrano is a deployment library for Haskell applications similar to Ruby's Capistrano.

Purpose

We created Hapistrano because:

  • Deploys should be simple, but as close to atomic as possible (eg, they shouldn't require much application downtime).
  • Rollback should be trivial to achieve to bring the application back to the last-deployed state.
  • Deploys shouldn't fail because of dependency problems.

How it Works

Hapistrano (like Capistrano for Ruby) deploys applications to a new directory marked with a timestamp on the remote host. It creates this new directory quickly by placing a git repository for caching purposes on the remote server.

When the build process completes, it switches a symlink to the 'current' release directory, and optionally restarts the web server.

By default, Hapistrano keeps the last five releases on the target host filesystem and deletes previous releases to avoid filling up the disk.

Usage

The deploy requires the following environment variables:

  • DEPLOY_PATH - The root of the deploy target on the remote host
  • HOST - The target host
  • REPOSITORY - The origin repository
  • REVISION - The SHA1 or branch to deploy. If a branch, you will need to specify it as origin/branch_name due to the way that the cache repo is configured.

The following environment variables are optional and affect the deploy process:

  • BUILD_SCRIPT - The local path to a file that should be executed on the remote server to build the application. The script isn't executed verbatim - instead, every line is joined with && so that the script aborts if any component fails. See a sample script for a clean build of a Haskell/Cabal application in this project under [script/clean-build.sh].
  • RESTART_COMMAND - If you need to restart a remote web server after a successful deploy, specify the command that you use in this variable. It will be run after both deploy and rollback.

You may want to save the environment variables that you need for your deploy in a shell script that you source before deploy. Make sure you export these variables so that they're available in the shell after you run the script. For example, you could use the following to configure your deploy:

export DEPLOY_PATH="/var/project"
export HOST="my-app-staging"
export REPOSITORY="git@github.com:yourorg/yourrepo.com.git"
export REVISION="origin/staging"
export BUILD_SCRIPT="/home/you/Code/hapistrano/script/clean-build.sh"
export RESTART_COMMAND="echo Replace me with your restart command"

After creating a configuration script as above, deploying is as simple as:

source your-config-script.sh && hap deploy

License

MIT, see the LICENSE file.

Contributing

Pull requests for modifications to this program are welcome. Fork and open a PR. Feel free to email me if you have questions about what may be accepted before working on a PR.

If you're looking for a place to start, you may want to check the open issue.