|
1 | 1 | # Installation |
2 | 2 |
|
3 | | -## Global installation |
| 3 | +There are two ways to install Deployer: globally or locally. Global installation is recommended for most users, as it |
| 4 | +allows you to use Deployer from any directory. |
| 5 | +Local (or project) installation is preferred for CI/CD pipelines, as it allows you to use the same version of Deployer |
| 6 | +across all environments. |
4 | 7 |
|
5 | | -To install Deployer, run next command in your project dir: |
| 8 | +## Global Installation |
6 | 9 |
|
7 | | -``` |
| 10 | +To install Deployer globally, use one of the following commands in your project directory: |
| 11 | + |
| 12 | +```sh |
8 | 13 | composer global require deployer/deployer |
9 | 14 | ``` |
10 | 15 |
|
11 | | -``` |
| 16 | +Or: |
| 17 | + |
| 18 | +```sh |
12 | 19 | phive install deployer |
13 | 20 | ``` |
14 | 21 |
|
15 | | -Run in your project to create `deploy.php` file: |
| 22 | +:::tip Path to Executable |
| 23 | + |
| 24 | +Make sure that Composer's global bin directory is in your `PATH`. Typically, you can add the following line to your |
| 25 | +shell configuration file (e.g., `.bashrc`, `.zshrc`): |
| 26 | + |
| 27 | +```sh |
| 28 | +export PATH="$HOME/.composer/vendor/bin:$PATH" |
16 | 29 |
|
17 | | -``` |
18 | | -dep init |
19 | 30 | ``` |
20 | 31 |
|
21 | | -:::tip Autocomplete |
| 32 | +After adding this line, reload your shell configuration: |
22 | 33 |
|
23 | | -Deployer comes with autocomplete support for task names, options, and hosts. |
| 34 | +```sh |
| 35 | +source ~/.bashrc |
| 36 | +``` |
24 | 37 |
|
25 | | -Run the next command to add bash completion support: |
| 38 | +or, for Zsh: |
26 | 39 |
|
| 40 | +```sh |
| 41 | +source ~/.zshrc |
27 | 42 | ``` |
28 | | -dep completion bash > /etc/bash_completion.d/deployer |
| 43 | + |
| 44 | +::: |
| 45 | + |
| 46 | +To set up Deployer in your project and create the `deploy.php` configuration file, run: |
| 47 | + |
| 48 | +```sh |
| 49 | +dep init |
29 | 50 | ``` |
30 | 51 |
|
31 | | -Make sure what your _.bashrc_ file includes generated file in some way. |
| 52 | +### Autocomplete Support |
32 | 53 |
|
33 | | -::: |
| 54 | +Deployer includes support for autocompletion, helping you quickly find task names, options, and hosts. To enable |
| 55 | +autocomplete for various shells, use the following commands: |
34 | 56 |
|
35 | | -## Project installation |
36 | 57 |
|
37 | | -To install Deployer in your project, run next command in your project dir: |
| 58 | +- **Bash**: |
38 | 59 |
|
39 | | -``` |
| 60 | + ```sh |
| 61 | + dep completion bash > /etc/bash_completion.d/deployer |
| 62 | + ``` |
| 63 | + |
| 64 | + Make sure your `.bashrc` file sources the generated file so that bash completion works. |
| 65 | + |
| 66 | +- **Zsh**: |
| 67 | + |
| 68 | + ```sh |
| 69 | + dep completion zsh > ~/.zsh/completion/_deployer |
| 70 | + ``` |
| 71 | + |
| 72 | + Ensure that your `.zshrc` file includes the directory where `_deployer` is located in the `fpath`. |
| 73 | + |
| 74 | +- **Fish**: |
| 75 | + |
| 76 | + ```sh |
| 77 | + dep completion fish > ~/.config/fish/completions/deployer.fish |
| 78 | + ``` |
| 79 | + |
| 80 | + The generated file will be automatically loaded by Fish. |
| 81 | + |
| 82 | +## Project Installation |
| 83 | + |
| 84 | +The project installation method is recommended for CI/CD pipelines, as it allows you to use the same version of Deployer |
| 85 | +across all environments. |
| 86 | + |
| 87 | +To install Deployer in your project, run the following command: |
| 88 | + |
| 89 | +```sh |
40 | 90 | composer require --dev deployer/deployer |
41 | 91 | ``` |
42 | 92 |
|
43 | | -To initialize deployer in your project run: |
| 93 | +:::tip Configuring Shell Alias |
| 94 | +To make using Deployer more convenient, you can set up a shell alias. This will allow you to run Deployer commands more |
| 95 | +easily. Add the following line to your shell configuration file (e.g., `.bashrc`, `.zshrc`): |
44 | 96 |
|
| 97 | +```sh |
| 98 | +alias dep='vendor/bin/dep' |
45 | 99 | ``` |
| 100 | + |
| 101 | +This alias lets you use `dep` instead of typing the full path each time. |
| 102 | +::: |
| 103 | + |
| 104 | +Then, to initialize Deployer in your project, use: |
| 105 | + |
| 106 | +```sh |
46 | 107 | vendor/bin/dep init |
47 | 108 | ``` |
48 | 109 |
|
49 | | -## Phar download |
| 110 | +## Downloading the Phar File |
50 | 111 |
|
51 | | -You can download deployer phar file from [releases](https://github.com/deployphp/deployer/releases) page. |
| 112 | +Another option for installing Deployer is to download the Phar file. You can find the latest version on |
| 113 | +the [download page](/download). |
52 | 114 |
|
53 | | -After downloading, you can run it in your project dir: |
| 115 | +Adding `deployer.phar` to your project repository is recommended to ensure everyone, including your CI pipeline, uses |
| 116 | +the same version of Deployer. This helps maintain consistency across all environments. |
54 | 117 |
|
55 | | -``` |
| 118 | +Once downloaded, run it in your project directory: |
| 119 | + |
| 120 | +```sh |
56 | 121 | php deployer.phar init |
57 | 122 | ``` |
| 123 | + |
| 124 | +This method provides a simple way to use Deployer without needing Composer. |
| 125 | + |
0 commit comments