{"id":17571007,"url":"https://github.com/alphahydrae/deploy","last_synced_at":"2026-03-04T10:02:06.364Z","repository":{"id":66264881,"uuid":"91606118","full_name":"AlphaHydrae/deploy","owner":"AlphaHydrae","description":"A (magic) shell script to deploy Git repositories","archived":false,"fork":false,"pushed_at":"2018-03-16T15:18:57.000Z","size":668,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-10-20T22:38:05.791Z","etag":null,"topics":["deploy","deployment","git","shell-script"],"latest_commit_sha":null,"homepage":"https://alphahydrae.github.io/deploy/","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AlphaHydrae.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-05-17T18:07:20.000Z","updated_at":"2024-10-25T23:43:49.000Z","dependencies_parsed_at":"2023-02-26T23:30:35.893Z","dependency_job_id":null,"html_url":"https://github.com/AlphaHydrae/deploy","commit_stats":{"total_commits":106,"total_committers":1,"mean_commits":106.0,"dds":0.0,"last_synced_commit":"0032cce13fa74e2e13a3d0d9ae0cb66fad0053f8"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/AlphaHydrae/deploy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlphaHydrae%2Fdeploy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlphaHydrae%2Fdeploy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlphaHydrae%2Fdeploy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlphaHydrae%2Fdeploy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AlphaHydrae","download_url":"https://codeload.github.com/AlphaHydrae/deploy/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlphaHydrae%2Fdeploy/sbom","scorecard":{"id":12269,"data":{"date":"2025-08-11","repo":{"name":"github.com/AlphaHydrae/deploy","commit":"0032cce13fa74e2e13a3d0d9ae0cb66fad0053f8"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.7,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.txt:0","Info: FSF or OSI recognized license: MIT License: LICENSE.txt:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":0,"reason":"70 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-5ww9-9qp2-x524","Warn: Project is vulnerable to: GHSA-69p6-wvmq-27gg","Warn: Project is vulnerable to: GHSA-pfpr-3463-c6jh","Warn: Project is vulnerable to: GHSA-pphf-gfrm-v32r","Warn: Project is vulnerable to: GHSA-jppv-gw3r-w3q8","Warn: Project is vulnerable to: GHSA-v88g-cgmw-v5xw","Warn: Project is vulnerable to: GHSA-8w4h-3cm3-2pm2","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-cwfw-4gq5-mrqx","Warn: Project is vulnerable to: GHSA-g95f-p29q-9xw4","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-9vvw-cc9w-f27h","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-hr2v-3952-633q","Warn: Project is vulnerable to: GHSA-phwq-j96m-2c2q","Warn: Project is vulnerable to: GHSA-ghr5-ch3p-vcr6","Warn: Project is vulnerable to: GHSA-qrmc-fj45-qfc2","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-9qj9-36jm-prpv","Warn: Project is vulnerable to: GHSA-8r6j-v8pm-fqw3","Warn: Project is vulnerable to: MAL-2023-462","Warn: Project is vulnerable to: GHSA-xf7w-r453-m56c","Warn: Project is vulnerable to: GHSA-44pw-h2cw-w3vq","Warn: Project is vulnerable to: GHSA-vfrc-7r7c-w9mx","Warn: Project is vulnerable to: GHSA-7wwv-vh3v-89cq","Warn: Project is vulnerable to: GHSA-jp4x-w63m-7wgm","Warn: Project is vulnerable to: GHSA-c429-5p7v-vgjp","Warn: Project is vulnerable to: GHSA-qqgx-2p2h-9c37","Warn: Project is vulnerable to: GHSA-896r-f27r-55mw","Warn: Project is vulnerable to: GHSA-jf85-cpcp-j695","Warn: Project is vulnerable to: GHSA-fvqr-27wr-82fm","Warn: Project is vulnerable to: GHSA-4xc9-xhrj-v574","Warn: Project is vulnerable to: GHSA-x5rq-j2xg-h7qm","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw","Warn: Project is vulnerable to: GHSA-6vfc-qv3f-vr6c","Warn: Project is vulnerable to: GHSA-7px7-7xjx-hxm8","Warn: Project is vulnerable to: GHSA-x5pg-88wf-qq4p","Warn: Project is vulnerable to: GHSA-p9wx-2529-fp83","Warn: Project is vulnerable to: GHSA-5v2h-r2cx-5xgj","Warn: Project is vulnerable to: GHSA-rrrm-qjm4-v8hf","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-wrvr-8mpx-r7pp","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-gwg9-rgvj-4h5j","Warn: Project is vulnerable to: GHSA-w9mr-4mfr-499f","Warn: Project is vulnerable to: GHSA-76c9-3jph-rj3q","Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp","Warn: Project is vulnerable to: GHSA-6g33-f262-xjp4","Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-m6fv-jmcg-4jfg","Warn: Project is vulnerable to: GHSA-jxqq-cqm6-pfq9","Warn: Project is vulnerable to: GHSA-2m39-62fm-q8r3","Warn: Project is vulnerable to: GHSA-mf6x-7mm4-x2g7","Warn: Project is vulnerable to: GHSA-j44m-qm6p-hp7m","Warn: Project is vulnerable to: GHSA-3jfq-g458-7qm9","Warn: Project is vulnerable to: GHSA-5955-9wpr-37jh","Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36","Warn: Project is vulnerable to: GHSA-g7q5-pjjr-gqvp","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-884p-74jh-xrg2","Warn: Project is vulnerable to: GHSA-j7fq-p9q7-5wfv","Warn: Project is vulnerable to: GHSA-w5p7-h5w8-2hfq","Warn: Project is vulnerable to: GHSA-cf4h-3jhx-xvhq","Warn: Project is vulnerable to: GHSA-g78m-2chm-r7qv"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-14T14:53:39.901Z","repository_id":66264881,"created_at":"2025-08-14T14:53:39.901Z","updated_at":"2025-08-14T14:53:39.901Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30078306,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-04T08:01:56.766Z","status":"ssl_error","status_checked_at":"2026-03-04T08:00:42.919Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deploy","deployment","git","shell-script"],"created_at":"2024-10-21T18:05:02.517Z","updated_at":"2026-03-04T10:02:06.345Z","avatar_url":"https://github.com/AlphaHydrae.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# deploy\n\n\u003c!-- DO NOT EDIT THIS FILE! This README is generated by running `npm run readme` --\u003e\n\n**_A (magic) shell script to deploy Git repositories_**\n\n[![Build Status](https://travis-ci.org/AlphaHydrae/deploy.svg?branch=master)](https://travis-ci.org/AlphaHydrae/deploy)\n[![npm version](https://img.shields.io/badge/version-3.1.0-blue.svg)](https://badge.fury.io/js/bash-deploy)\n[![license](https://img.shields.io/npm/l/express.svg)](https://opensource.org/licenses/MIT)\n\nRead the [annotated source](https://alphahydrae.github.io/deploy/)\n\nRepository: [AlphaHydrae/deploy](https://github.com/AlphaHydrae/deploy)\n\nShamelessly inspired by: [visionmedia/deploy](https://github.com/visionmedia/deploy)\n\n\u003c!-- START doctoc generated TOC please keep comment here to allow auto update --\u003e\n\u003c!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --\u003e\n\n\n- [Usage](#usage)\n- [Installation](#installation)\n- [Requirements](#requirements)\n- [Configuration file](#configuration-file)\n  - [Single-value and multiple-value keys](#single-value-and-multiple-value-keys)\n  - [Environment inheritance](#environment-inheritance)\n- [Hooks](#hooks)\n- [Configuration file](#configuration-file-1)\n  - [Project](#project)\n  - [SSH connection](#ssh-connection)\n  - [Host environment variables](#host-environment-variables)\n- [Command line options \u0026 environment variables](#command-line-options--environment-variables)\n  - [General options](#general-options)\n  - [Project options](#project-options)\n  - [SSH options](#ssh-options)\n  - [Self-update options](#self-update-options)\n- [Command line options format](#command-line-options-format)\n  - [Short option format](#short-option-format)\n  - [Long option format](#long-option-format)\n  - [Invalid options](#invalid-options)\n  - [Changing the working directory](#changing-the-working-directory)\n- [Default command](#default-command)\n- [Sub-commands](#sub-commands)\n  - [`\u003cenv\u003e setup`](#env-setup)\n  - [`\u003cenv\u003e rev [rev]`](#env-rev-rev)\n  - [`[env] config [key]`](#env-config-key)\n  - [`\u003cenv\u003e config-all \u003ckey\u003e`](#env-config-all-key)\n  - [`[env] config-section`](#env-config-section)\n  - [`\u003cenv\u003e console [path]`](#env-console-path)\n  - [`\u003cenv\u003e cleanup`](#env-cleanup)\n  - [`\u003cenv\u003e exec \u003ccmd\u003e`](#env-exec-cmd)\n  - [`\u003cenv\u003e list`](#env-list)\n  - [`update [rev]`](#update-rev)\n- [Cleaning up old releases](#cleaning-up-old-releases)\n\n\u003c!-- END doctoc generated TOC please keep comment here to allow auto update --\u003e\n\n## Usage\n\n**deploy** is a shell script to deploy your Git projects through SSH.\nAdd a `deploy.conf` file in your project's directory.\nHere's an example for a Node.js project:\n\n    # deploy.conf\n    [production]\n    repo  https://github.com/me/my-app\n    host  my.server.com\n    user  deploy\n    path  /var/www/app\n\n    # describe how to deploy your app\n    env          NODE_ENV=production\n    deploy       npm install --production\n    post-deploy  npm start\n\n**deploy** is language-agnostic.\nFor a Rails project, you could replace the last 3 lines with:\n\n    env          RAILS_ENV=production\n    deploy       bundle install --without development test\n    deploy       rake assets:precompile\n    post-deploy  rails server\n\nNow run **deploy**!\n\n```sh\ndeploy production setup\ndeploy production rev master\n```\n\nIt will:\n* Connect to `my.server.com` as the `deploy` user through SSH\n* The `setup` command will set up a deployment structure and clone your repository\n* The second `rev` command will checkout the latest version of your `master` branch and run the deployment hooks you defined (`deploy` and `post-deploy` in the configuration file)\n\nRead on to learn what to write in the [configuration file](#configuration-file) or how to use each [sub-command](#sub-commands).\n\n## Installation\n\nWith npm:\n\n```sh\nnpm install -g bash-deploy\n```\n\nWith curl:\n\n```sh\nPREFIX=/usr/local/bin \\\n  FROM=https://raw.githubusercontent.com \\\n  \u0026\u0026 curl -sSLo $PREFIX/deploy \\\n  $FROM/AlphaHydrae/deploy/master/bin/deploy \\\n  \u0026\u0026 chmod +x $PREFIX/deploy\n```\n\nWith wget:\n\n```sh\nPREFIX=/usr/local/bin \\\n  FROM=https://raw.githubusercontent.com \\\n  \u0026\u0026 wget -qO $PREFIX/deploy \\\n  $FROM/AlphaHydrae/deploy/master/bin/deploy \\\n  \u0026\u0026 chmod +x $PREFIX/deploy\n```\n\nOr [download it](https://raw.githubusercontent.com/AlphaHydrae/deploy/master/bin/deploy) yourself.\n\n## Requirements\n\n**deploy** is a one-file bash script which requires the following commands: `cat`, `cut`, `date`, `git`, `grep`, `ls`, `mkdir`, `readlink`, `sed`, `ssh`, `tail`, `tar` and `wc`.\nMost bash shells have all of those out of the box except perhaps [Git](https://git-scm.com).\n\nIt also optionally requires the `chmod`, `cp` and `mktemp` commands to update itself.\n\n## Configuration file\n\n**deploy** reads its main configuration from a `deploy.conf` file in the current directory.\nIt can also be customized with [environment variables and command line options](#command-line-options-environment-variables).\n\nThe configuration file is basically a series of sections containing key/value pairs:\n\n    # deploy.conf\n    [staging]\n    host  staging.example.com\n    user  test\n    # how to deploy\n    post-deploy  ./run-test.sh\n\n    [production]\n    host 192.168.1.42\n    user root\n    # how to deploy\n    env           NODE_ENV=production\n    deploy        npm install --production\n    deploy        npm run build\n    post-deploy   pm2 start pm2.json\n\nEach named section, delimited by `[name]`, represents an **environment** (i.e. a host machine) to deploy to,\nin this example the *staging* and *production* environments.\n\nLines beginning with `#` are comments and are ignored.\n\nOther lines are key/value pairs.\nA key is a sequence of characters containing no whitespace, followed by at least one tab or space.\n\nFor example, in the line `deploy npm run build`, the key is `deploy` and its value is `npm run build`.\n\n### Single-value and multiple-value keys\n\nSome keys like `repo`, `host`, `port` or `user` are simple configuration properties that have one value per environment.\nIf multiple values are found, the last one is used.\n\nThese keys can be overriden through an environment variable of the same name in uppercase and prefixed by `DEPLOY_`.\nFor example, the environment variable to override the `repo` key is `DEPLOY_REPO`.\n\nOther keys like `setup`, `deploy` or `post-deploy` are multiple-value keys used for [hooks](#hooks).\nThey can be present multiple time in the same environment and all their values will be used in order.\n\n### Environment inheritance\n\nWhen deploying your project to multiple environments, there will probably be some configuration properties\nthat are identical for multiple environments.\nTo avoid repetition, an environment can **inherit** from one or multiple other environments:\n\n    # deploy.conf\n    [common]\n    user dev\n    deploy do-stuff\n    deploy do-more-stuff\n\n    [secure]\n    user sekret\n    deploy do-sensitive-stuff\n\n    [production]\n    inherits common\n    inherits secure\n    user root\n    deploy just-do-it\n\nIn this example, the `production` environment inherits from `common` and `secure` (in that order).\n\nThe value of a *single-value* key like `user` will be the last value found in the environment inheritance tree.\nIn this case, it will be `root` for the `production` environment (the values inherited from the `common` and `secure` environments are overwritten).\n\nA *multiple-value* key like `deploy` will include all values found in the entire inheritance tree.\nIn this case, it will have 4 values for the `production` environments, taken in order from the `common`, `secure` and `production` sections:\n\n    do-stuff\n    do-more-stuff\n    do-sensitive-stuff\n    just-do-it\n\nFor convenience in simple use cases, you can also add a **default environment** by including a nameless section in your configuration file:\n\n    # deploy.conf\n    []\n    user dev\n    deploy do-stuff\n    deploy do-more-stuff\n\n    [development]\n    deploy do-it-somehow\n\n    [production]\n    user root\n    deploy do-it-seriously\n\nAll environments that have no `inherits` key automatically inherit from the default environment.\n\n## Hooks\n\nHooks are user-defined commands that can be run during a *deployment phase*.\nThere are currently two phases defined: **setup** and **deploy**.\nThe *setup* phase happens when you run the `setup` command,\nwhile the *deploy* phase happens when you run the `rev` command.\n\nThere are various hooks for each phase: some that run before, some during and some after **deploy** does its thing.\nThese are the currently available hooks:\n\n    pre-setup\n    post-setup\n\n    pre-deploy\n    deploy\n    post-deploy\n\nHooks are multiple-value keys that are optional and can be used as many times as you want.\nThey will all be run in order.\n\nEach hook is run in a specific working directory and has access to various environment variables.\n`$DEPLOY_PATH` is always exported and indicates the deployment directory\n(which is not necessarily the same as the hook's working directory).\nAdditional user-defined variables may also be made available (see [environment variables](#host-environment-variables)).\n\nHere's an example of how you could use hooks to cache your `node_modules` directory after every deployment\nto shorten future installation times:\n\n    # restore cache (if present)\n    deploy       tar -xzf $DEPLOY_PATH/cache.gz -C . || exit 0\n    # install new dependencies\n    deploy       npm install --production\n    # update cache\n    post-deploy  tar -czf $DEPLOY_PATH/cache.gz node_modules\n\nSee the [`setup`](#setup) and [`rev`](#deploy) commands to learn exactly when and where hooks are executed.\n\n## Configuration file\n\n### Project\n\n* **`repo \u003curl\u003e`** (or the `$DEPLOY_REPO` variable) defines the Git URL from which your repository will be cloned at setup time.\n* **`path \u003cdir\u003e`** (or the `$DEPLOY_PATH` variable) defines the directory into which your project will be deployed on the host.\n\n* \u003ca name=\"keep\"\u003e\u003c/a\u003e\n  **`keep \u003cn\u003e`** (or the `$DEPLOY_KEEP` variable) defines how many releases to keep after deploying.\n  Older releases will be deleted. It must be either `all` (the default), or an integer greater than zero.\n\n  If it's a number, it indicates the number of releases that should be kept **after successful deployment**.\n  For example, with `keep` set to 3, if there are 5 old releases deployed before running the script, 3 will be deleted\n  (so that 2 old releases and the new one being deployed, 3 in total, remain).\n\n  It's also possible to manually trigger cleanup with the [cleanup](#cleanup) command.\n\n### SSH connection\n\nVarious SSH options can be specified through the configuration file or environment variables:\n\n* **`host \u003caddress\u003e`** (or the `$DEPLOY_HOST` variable) is mandatory for all environments.\n  It indicates which host or IP address to connect to.\n\n* **`user \u003cname\u003e`** (or the `$DEPLOY_USER` variable) specifies the user to connect as.\n  By default, you connect with the same name as your local user.\n\n* **`identity \u003cfile\u003e`** (or the `$DEPLOY_IDENTITY` variable) specifies a file from which the private key for public key authentication is read.\n\n* **`forward-agent yes`** (or the `$DEPLOY_FORWARD_AGENT` variable) enables agent forwarding.\n\n* **`port \u003cnumber\u003e`** (or the `$DEPLOY_PORT` variable) specifies the host port to connect to.\n\n* **`tty yes`** (or the `$DEPLOY_TTY` variable) forces pseudo-terminal allocation.\n\nCommands executed on the host through SSH will be logged to the console.\n\nFor some commands, the output may be retrieved and displayed in a more user-friendly manner.\n\n### Host environment variables\n\nYou can define environment variables that will be exported on the host when executing hooks.\n\nThe `$DEPLOY_PATH` variable is always exported and indicates the deployment directory\nconfigured by the user with the `path` config key or the local `$DEPLOY_PATH` variable.\n\n* **`env \u003cNAME\u003e=\u003cVALUE\u003e...`** defines one or multiple environment variables to export on the host when running hooks.\n\n      # deploy.conf\n      env FOO=BAR\n      env BAZ=QUX CORGE=GRAULT\n\n* **`forward-env \u003cNAME\u003e...`** defines the name(s) of one or multiple local environment variables\n  to export on the host when running hooks.\n\n      # deploy.conf\n      forward-env FOO\n      forward-env BAR BAZ QUX\n\nIf you have a **`.env`** file in your local project directory, it will automatically be sourced.\nThis can be handy to create local variables that you can forward to the host.\n\n    # .env\n    export FOO=BAR\n    export YEAR=$(date \"+%Y\")\n\n(Note that if you use the `-C, --chdir` command line option or the `$DEPLOY_CHDIR` variable,\nthe `.env` file is read *after* the working directory is changed, so setting `$DEPLOY_CHDIR`\nin the file has no effect.)\n\nIf you have an environment file named after the environment, it will also be sourced.\nFor example, when deploying in the \"production\" environment, a **`.env.production`** file\nwould be sourced if present in the local project directory.\n\nIf both `.env` and `.env.production` are present, they are sourced in that order.\n\n## Command line options \u0026 environment variables\n\nThe properties in the configuration file can also be specified through *command line options* or *environment variables*.\n\nFor example, the `repo` property in the configuration file can also be specified:\n\n* With the `-r, --repo \u003curl\u003e` command line option.\n* With the `$DEPLOY_REPO` environment variable.\n\nTheir precedence is as follows:\n\n* The command line option (e.g. `-r, --repo \u003curl\u003e`) always takes precedence if specified.\n* Next, the environment variable (e.g. `$DEPLOY_REPO`) takes precedence over the configuration file.\n* Otherwise, the value in the configuration file (e.g. `repo`) is used.\n\n### General options\n\nThese options are valid for most sub-commands:\n\n* **`-C, --chdir \u003cdir\u003e`** (or the `$DEPLOY_CHDIR` variable) changes **deploy**'s *local* working directory before loading the configuration file.\n\n* **`--color always|never|auto`** (or the `$DEPLOY_COLOR` variable) enables/disables colors in the output of the script.\n\n  This defaults to `auto`, which only enables colors if the current terminal is interactive.\n\n* **`-c, --config \u003cfile\u003e`** (or the `$DEPLOY_CONFIG` variable) allows you to set a custom path for the configuration file (defaults to `./deploy.conf`).\n\n* **`--help`** prints usage information and exits.\n\n* **`-v, -V, --version`** prints the current version and exits.\n\n* **`-y, --yes`** (or the `$DEPLOY_YES` variable) will automatically accept all confirmation prompts\n  (only valid for the `rev`, `cleanup` and `update` sub-commands).\n\n  **Use with caution:** old releases may be deleted with the `rev` or `cleanup` sub-commands if a [`keep` option](#keep) is configured.\n\n### Project options\n\nThese options configure where and how the project is deployed on the remote host:\n\n* **`-r, --repo \u003curl\u003e`** (or the `$DEPLOY_REPO` variable) sets the Git URL to fetch the project's source code from when deploying.\n\n* **`-P, --path \u003cdir\u003e`** sets the remote path to deploy the project to on the host\n  (this is the path to the directory managed by **deploy**, not to the current release).\n\n* **`-k, --keep \u003cn\u003e`** (or the `$DEPLOY_KEEP` variable) changes the number of old releases that are kept\n  after successful deployment (see the [`keep` option](#keep)).\n\n* **`-f, --force`** (or the `$DEPLOY_FORCE` variable) forces deployment to proceed even when you have uncommitted changes.\n\n### SSH options\n\nThese options are valid for all commands which connect to the remote host through SSH\n(`setup`, `rev`, `console`, `exec`, `list` and `cleanup`):\n\n* **`-A, --forward-agent`** (or the `$DEPLOY_FORWARD_AGENT` variable) enables forwarding of the authentication agent connection.\n\n  **Use with caution.**\n  Users with the ability to bypass file permissions on the remote host (for the agent's UNIX-domain socket)\n  can access the local agent through the forwarded connection.\n  An attacker cannot obtain key material from the agent,\n  however they can perform operations on the keys that enable them to authenticate\n  using the identities loaded into the agent.\n\n* **`-H, --host \u003caddress\u003e`** (or the `$DEPLOY_HOST` variable) sets the host to connect to.\n\n* **`-i, --identity \u003cfile\u003e`** (or the `$DEPLOY_IDENTITY` variable) selects a file from which the identity (private key)\n  for public key authentication is read.\n\n  The default is `~/.ssh/id_dsa`, `~/.ssh/id_ecdsa`, `~/.ssh/id_ed25519` and `~/.ssh/id_rsa`.\n\n* **`-p, --port \u003cn\u003e`** (or the `$DEPLOY_PORT` variable) sets the port to connect to.\n\n* **`-t, --tty`** (or the `$DEPLOY_TTY` variable) forces pseudo-terminal allocation.\n\n  This can be used to execute arbitrary screen-based programs on a remote machine,\n  which can be very useful, e.g. when implementing menu services.\n\n* **`-u, --user \u003cname\u003e`** (or the `$DEPLOY_USER` variable) sets the remote user to connect as.\n\n### Self-update options\n\nThese options can be used by **deploy** to update itself with the `update` sub-command:\n\n* **`--update-path \u003cfile\u003e`** (or the `$DEPLOY_UPDATE_PATH` variable) sets the path to save the updated script when using the **update** command.\n\n  This overrides the `--update-prefix` or `$DEPLOY_UPDATE_PREFIX` options.\n\n* **`--update-prefix \u003cdir\u003e`** (or the `$DEPLOY_UPDATE_PREFIX` variable) sets the base directory when using the **update** command.\n\n  The updated script will be saved in `bin/deploy` relative to this path.\n  (Note that setting `--update-path` or `$DEPLOY_UPDATE_PATH` overrides this option.)\n\n## Command line options format\n\nNote that all of **deploy**'s command line options can be used anywhere in a command.\nThe following 3 commands are equivalent:\n\n* `deploy -u deploy production --keep 3 --yes master`\n* `deploy -u deploy --keep 3 --yes production master`\n* `deploy production master -u deploy --keep 3 --yes`\n\n### Short option format\n\nSome options have a short form which may be specified with **one hyphen**,\ne.g. `-h` to display usage or `-f` to force deployment with uncommitted local changes.\n\nIf a short option takes a value, it may be provided either as the next argument\n(e.g. `-k 5`) or with an equal sign (e.g. `-k=5`).\n\n### Long option format\n\nAll options have a long form which may be specified with **two hyphens**,\ne.g. `--help` or `--force`.\n\nIf a long option takes a value, it may be provided either as the next argument\n(e.g. `--keep 5`) or with an equal sign (e.g. `--keep=5`).\n\n### Invalid options\n\nThe following errors will cause the script to be interrupted and print an error:\n\n* Badly formatted or unknown options (e.g. `---foo`, `-bar`, `--baz`).\n\n* Options that take no value specified with a value (e.g. `--help=3`).\n\n* Options that take a value specified without their value.\n\n* Duplicate options (e.g. both `-k 5` and `--keep 3`).\n\n### Changing the working directory\n\nBy default, **deploy** looks in the current directory to find its configuration file\nand optional environment files. This can be customized by setting the `-c, --chdir \u003cdir\u003e`\ncommand line option or the `$DEPLOY_CHDIR` variable.\n\nIf this option is set, **deploy** will first move to that directory before sourcing\nthe environment files and reading the configuration file.\n\n## Default command\n\n**deploy** is usually used this way:\n\n* `deploy prod setup`\n* `deploy prod list`\n* `deploy prod rev master`\n\nHowever, since the most often used sub-command is `rev`,\nit is also the **default command**. The following 2 commands are equivalent:\n\n* `deploy prod master`\n* `deploy prod rev master`\n\n## Sub-commands\n\nThese are the commands you will use to set up and deploy your projects.\n\nNote that most (but not all) of **deploy**'s sub-commands require an environment to be specified before the actual command name, for example:\n\n```sh\ndeploy setup             # error! no environment\ndeploy production setup  # all good\n```\n\n\u003ca name=\"setup\"\u003e\u003c/a\u003e\n\n### `\u003cenv\u003e setup`\n\nPerform **first-time setup** tasks on the host before deployment.\nYou should only have to run this once before deploying the first time.\n\n```sh\ndeploy production setup\n```\n\n**deploy** will create the following structure for you in the deployment directory defined by the `path` config key (or the `$DEPLOY_PATH` variable):\n* `$DEPLOY_PATH/releases` will contain each deployment's files\n* `$DEPLOY_PATH/repo` will be a bare clone of your Git repository\n* `$DEPLOY_PATH/tmp` will be used to store temporary files during deployment\n\nThis phase has 3 hooks that are all executed in the deployment directory.\nNote that this directory **must already exist** on the host and be writable by the user you connect as.\n\nThis is what **deploy** will do during setup:\n\n* Run user-defined `pre-setup` hooks (if any).\n\n* Create the `releases` and a `tmp` directories if they don't exist already.\n\n* Clone the repository into the `repo` directory if it isn't already there.\n\n* Run user-defined `post-setup` hooks (if any).\n\n\u003ca name=\"deploy\"\u003e\u003c/a\u003e\n\n### `\u003cenv\u003e rev [rev]`\n\n**Deploy a new release** from the latest changes in the Git repository.\n\nYou must provide a Git revision, i.e. a **commit, branch or tag** to deploy,\neither as the `[rev]` argument, with the `rev` config key or the `$DEPLOY_REV` variable.\n\nIf your Git repository is **private**, make sure that the deployment user has access to it.\n\nFor each deployment, a new release directory will be created in `releases` in the deployment directory.\nThe name of a release directory is the current date and time in the `YYYY-MM-DD-HH-MM-SS` format.\n(You can list deployed releases with the [list command](#list).)\n\nNote that **deploy** will refuse to deploy unless all your local changes are committed and pushed.\nYou can override this behavior with the `-f|--force` option (or the `$DEPLOY_FORCE` variable).\n\nThis is what **deploy** will do during deployment:\n\n* If a [`keep` option](#keep) is configured, all previously deployed releases are listed,\n  with those to be deleted in red, and those to be kept and the current release in green, and\n  confirmation is asked that they may be deleted if the deployment is successful.\n\n* User-defined pre-deploy hooks (if any) are run **in the directory of the previous release**.\n  You may define **pre-deploy hooks** to perform any task you might want to do before the actual deployment\n  (e.g. you might want to stop the currently running version or put it into maintenance mode).\n\n* The latest changes are fetched from the repository.\n\n* The new release directory is created and the source is extracted at the specified revision into it.\n\n* User-defined deploy hooks (if any) are run in the new release directory.\n  You should define **deploy hooks** to build your application or install its dependencies at this stage.\n\n* A symlink of the new release directory is created as `current` in the deployment directory.\n\n* User-defined post-deploy hooks (if any) are run in the current release directory\n  (which is now the same as the new release directory that was just created).\n\n  You should define **post-deploy hooks** to execute or start your application at this stage.\n\n* Old releases are deleted according to the `keep` option (if configured and any were found).\n\n### `[env] config [key]`\n\nPrint values from your `deploy.conf` configuration file.\n\n* If called with **no environment and no argument**, it prints the whole configuration file:\n\n  ```sh\n  $\u003e deploy config\n  []\n  user dev\n\n  [production]\n  user root\n  port 222\n  ```\n\n* If called with **the environment and a key**, it prints the last value of that key for that environment\n  (only the last value is printed even for a multiple-value key):\n\n  ```sh\n  $\u003e deploy production config user\n  root\n  ```\n\n  Exits with status 1 if no value is found for the key.\n\n### `\u003cenv\u003e config-all \u003ckey\u003e`\n\nPrint all values of a config key in the current environment and its inherited environments\n(all values are printed even for a single-value key):\n\n```sh\n$\u003e deploy production config-all user\ndev\nroot\n```\n\nExits with status 1 if no value is found for the key.\n\n### `[env] config-section`\n\nPrint all values of a config section \"as is\" (with no inheritance).\nIf no environment is specified, the default config section is printed.\n\nExits with status 1 if the config section is not found (including the default one).\n\n### `\u003cenv\u003e console [path]`\n\nLaunch an interactive **ssh session** on the host.\n\n* If an **absolute path** is specified, the session starts there.\n\n  ```sh\n  deploy production console /var/www\n  ```\n\n* If **no path** is specified, the session starts in the deployment directory.\n\n  ```sh\n  deploy production console\n  ```\n\n* If a **relative path** is specified, it starts there relative to the deployment directory.\n\n  ```sh\n  deploy production console current\n  ```\n\n\u003ca name=\"cleanup\"\u003e\u003c/a\u003e\n\n### `\u003cenv\u003e cleanup`\n\nDeletes old releases based on the [`keep` option](#keep).\n\nThe number of releases to keep is determined from the `keep` configuration file option,\nthe `$DEPLOY_KEEP` variable or the `-k|--keep` command line option.\n\nThe releases to delete will be listed and confirmation will be asked before they are actually deleted.\n\n### `\u003cenv\u003e exec \u003ccmd\u003e`\n\n**Execute** the specified command on the host.\n\n```sh\ndeploy production exec ps -ef\n```\n\n\u003ca name=\"list\"\u003e\u003c/a\u003e\n\n### `\u003cenv\u003e list`\n\nList the **releases** that have been deployed on the host.\n\n```sh\n$\u003e deploy production list\n2016-12-24-17-45-23\n2017-01-01-02-03-43\n2017-04-01-00-00-00\n```\n\n### `update [rev]`\n\nUpdates **deploy** to the latest version by downloading it from the Git repository and installing it at `/usr/local/bin/deploy` (by default).\n\nIn addition to the basic requirements, this sub-command also requires `chmod`, `cp` and `mktemp` to be available in the shell.\n\nThe installation path must be a writable file or not exist.\nIf the installation path does not already exist, its parent must be a writable directory.\n\nTo perform the update, **deploy** will download its Git repository into a temporary directory that will be cleaned up when the update is done (or fails).\n\nThe correct revision of the script is then copied to the installation path and made executable.\n\n## Cleaning up old releases\n\n**deploy** creates a new release directory for each deployment.\nBy default, it keeps these directories forever, leaving you responsible for cleaning them up.\n\nIf given a [`keep` option](#keep), it can do it for you automatically after each deployment.\n\n**deploy** will list the contents of the `releases` directory on the host.\n\nIf no old release is found, deployment will proceed normally.\n\nIf the number of old releases is equal to or greater than the `keep` number,\n**deploy** will print the list of releases that will be deleted in red.\n\nOld releases that will be kept will be shown in green.\n\nDuring deployment, the current release being deployed is also indicated in green\n(as it counts towards the `keep` number).\n\nIf there are any releases to delete, **deploy** will ask for confirmation\n(unless the `-y, --yes` command line option or the `$DEPLOY_YES` variable is specified).\n\nResponding \"no\" interrupts the deployment and prints a help message explaining\nhow to configure the `keep` number.\n\nThe actual cleanup of old releases is always performed **after successful deployment**.\n\nA single `rm` command is executed on the host through SSH,\ndeleting all appropriate old release directories in one go.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falphahydrae%2Fdeploy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falphahydrae%2Fdeploy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falphahydrae%2Fdeploy/lists"}