|
1 | 1 | # |
2 | 2 | # Example of valid statements for an alias file. |
| 3 | + |
| 4 | +# Basic Alias File Usage |
3 | 5 | # |
4 | | -# To convert legacy alias (*.aliases.drushrc.php) to yml, run the |
5 | | -# site:alias-convert command. |
| 6 | +# In its most basic form, the Drush site alias feature provides a way |
| 7 | +# for teams to share short names that refer to the live and staging sites |
| 8 | +# (usually remote) for a given Drupal site. |
6 | 9 | # |
7 | | -# Aliases are commonly used to define short names for |
8 | | -# local or remote Drupal installations; however, an alias |
9 | | -# is really nothing more than a collection of options. |
| 10 | +# 1. Make a local working clone of your Drupal site and then |
| 11 | +# `cd` to the project work to select it. |
| 12 | +# 2. Add an alias file called $PROJECT/drush/sites/self.site.yml, |
| 13 | +# where $PROJECT is the project root (location of composer.json file). |
| 14 | +# 3. Run remote commands against the shared live or stage sites |
10 | 15 | # |
11 | | -# Drush site aliases always contain one or more environments; |
12 | | -# for example, a site may have "dev", "test" and "live" |
13 | | -# environments. The default environment is "dev"; the dev |
14 | | -# environment of a site named "example" may therefore be |
15 | | -# referred to as either "@example.dev" or "@example". |
| 16 | +# Following these steps, a cache:rebuild on the live environment would be: |
16 | 17 | # |
17 | | -# A canonical alias named "example" that points to a local |
18 | | -# Drupal site named "http://example.com" looks like this: |
| 18 | +# $ drush @live cache:rebuild |
| 19 | +# |
| 20 | +# The site alias file should be named `self.site.yml` because this name is |
| 21 | +# special, and is used to define the different environments (usually remote) |
| 22 | +# of the current Drupal site. |
| 23 | +# |
| 24 | +# The contents of the alias file should look something like the example below: |
19 | 25 | # |
20 | 26 | # @code |
21 | | -# File: example.site.yml |
22 | | -# dev: |
23 | | -# root: /path/to/drupal |
| 27 | +# # File: self.site.yml |
| 28 | +# live: |
| 29 | +# host: server.domain.com |
| 30 | +# user: www-admin |
| 31 | +# root: /other/path/to/live/drupal |
24 | 32 | # uri: http://example.com |
| 33 | +# stage: |
| 34 | +# host: server.domain.com |
| 35 | +# user: www-admin |
| 36 | +# root: /other/path/to/stage/drupal |
| 37 | +# uri: http://stage.example.com |
25 | 38 | # @endcode |
26 | 39 | # |
27 | | -# Note that the first part of the filename (in this case "example") |
28 | | -# defines the name of the site alias, and the top-level key ("dev") |
29 | | -# defines the name of the environment. |
| 40 | +# The top-level element names (`live` and `stage` in the example above) are |
| 41 | +# used to identify the different environments available for this site. These |
| 42 | +# may be used on the command line to select a different target environment |
| 43 | +# to operate on by prepending an `@` character, e.g. `@live` or `@stage`. |
30 | 44 | # |
31 | | -# With this alias definition, then the following commands |
32 | | -# are equivalent: |
| 45 | +# All of the available aliases for a site's environments may be listed via: |
33 | 46 | # |
34 | | -# $ drush @example.dev status |
35 | | -# $ drush --root=/path/to/drupal --uri=http://example.com status |
36 | | -# |
37 | | -# See the --uri option documentation below for hints on setting its value. |
38 | | -# |
39 | | -# Any option that can be placed on the Drush commandline |
40 | | -# can also appear in an alias definition inside an 'options' section. |
41 | | -# |
42 | | -# Drush will search for aliases in any of these files using |
43 | | -# the alias search path. The following locations are examined |
44 | | -# for alias files: |
45 | | -# |
46 | | -# 1. In any path set in drush.alias-path in drush.yml |
47 | | -# or (equivalently) any path passed in via --alias-path=... |
48 | | -# on the command line. |
49 | | -# 2. In one of the site-specific locations: |
50 | | -# a. The /drush/sites folder for the current Drupal site |
51 | | -# b. The /drush/sites folder in the directory above the current Drupal site |
52 | | -# |
53 | | -# These locations are no longer searched recursively; alias files must |
54 | | -# appear directly inside one of the search locations, or it will not be found. |
| 47 | +# $ drush site:alias @self |
55 | 48 | # |
56 | | -# The preferred locations for alias files, then, are: |
| 49 | +# The elements of a site alias environment are: |
57 | 50 | # |
58 | | -# $ROOT/drush/sites |
59 | | -# $ROOT/../drush/sites |
| 51 | +# - 'host': The fully-qualified domain name of the remote system |
| 52 | +# hosting the Drupal instance. **Important Note: The remote-host option |
| 53 | +# must be omitted for local sites, as this option controls various |
| 54 | +# operations, such as whether or not rsync parameters are for local or |
| 55 | +# remote machines, and so on. |
| 56 | +# - 'user': The username to log in as when using ssh or rsync. |
| 57 | +# - 'root': The Drupal root; must not be specified as a relative path. |
| 58 | +# - 'uri': The value of --uri should always be the same as |
| 59 | +# when the site is being accessed from a web browser (e.g. http://example.com) |
60 | 60 | # |
61 | | -# If you would like to add additional locations, you can do so by |
62 | | -# listing additional locations in your configuration files. For example, |
63 | | -# to re-add the default user alias path from Drush 8, put the following |
| 61 | +# Drush uses ssh to run commands on remote systems; all team members should |
| 62 | +# install ssh keys on the target servers (e.g. via ssh-add). |
| 63 | + |
| 64 | +# Advanced Site Alias File Usage |
| 65 | +# |
| 66 | +# It is also possible to create site alias files that reference other |
| 67 | +# sites on the same local system. Site alias files for other local sites |
| 68 | +# are usually stored in the directory `~/.drush/sites`; however, Drush does |
| 69 | +# not search this location for alias files by default. To use this location, |
| 70 | +# you must add the path in your Drush configuration file. For example, |
| 71 | +# to re-add both of the default user alias path from Drush 8, put the following |
64 | 72 | # in your ~/.drush/drush.yml configuration file: |
65 | 73 | # |
66 | 74 | # @code |
|
71 | 79 | # - /etc/drush/sites |
72 | 80 | # @endcode |
73 | 81 | # |
74 | | -# It is also possible to create a named location that contains a group |
75 | | -# of related site aliases. For example, if you had a number of sites |
76 | | -# for local schools, you could define a location named "schools": |
77 | | -# |
78 | | -# @code |
79 | | -# drush: |
80 | | -# paths: |
81 | | -# alias-path: |
82 | | -# - '${env.home}/.drush/sites/schools' |
83 | | -# @endcode |
84 | | -# |
85 | | -# Site aliases stored in this directory may then be referenced by its |
86 | | -# full alias name, including its location, e.g.: |
87 | | -# |
88 | | -# $ drush @schools.example.dev |
89 | | -# |
90 | | -# Such alias files may still be referenced by their shorter name, e.g. |
91 | | -# `@example.dev`. Note that it is necessary to individually list every |
92 | | -# location where site alias files may be stored; Drush never does recursive |
93 | | -# (deep) directory searches for alias files. |
94 | | -# |
95 | 82 | # The command `drush core:init` will automatically configure your |
96 | 83 | # ~/.drush/drush.yml configuration file to add `~/.drush/sites` and |
97 | 84 | # `/etc/drush/sites` as locations where alias files may be placed. |
98 | 85 | # |
99 | | -# Files stored in one of the search path locations can be used to create |
100 | | -# aliases to local and remote Drupal installations. These aliases can be |
101 | | -# used in place of a site specification on the command line, and may also |
102 | | -# be used in arguments to certain commands such as "drush rsync" and |
103 | | -# "drush sql:sync". |
104 | | -# |
105 | | -# To see an example alias definition for the current bootstrapped |
106 | | -# site, use the "site:alias" command with the built-in alias "@self": |
107 | | -# |
108 | | -# $ drush site:alias @self |
109 | | -# |
110 | | -# The `site:alias` command may also be used to list all of the sites and |
111 | | -# environments in a given location, e.g.: |
| 86 | +# A canonical alias named "example" that points to a local |
| 87 | +# Drupal site named "http://example.com" looks like this: |
112 | 88 | # |
113 | | -# $ drush site:alias @schools |
| 89 | +# @code |
| 90 | +# File: example.site.yml |
| 91 | +# dev: |
| 92 | +# root: /path/to/drupal |
| 93 | +# uri: http://example.com |
| 94 | +# @endcode |
114 | 95 | # |
115 | | -# Or it may be used to list all of the environments in a given site: |
| 96 | +# Note that the first part of the filename (in this case "example") |
| 97 | +# defines the name of the site alias, and the top-level key ("dev") |
| 98 | +# defines the name of the environment. |
116 | 99 | # |
117 | | -# $ drush site:alias @example |
| 100 | +# With these definitions in place, it is possible to run commands targeting |
| 101 | +# the dev environment of the target site via: |
118 | 102 | # |
119 | | -# If called without any parameters, it will list all of the sites and |
120 | | -# environments in all locations. |
| 103 | +# $ drush @example.dev status |
121 | 104 | # |
122 | | -# Drush also supports *remote* site aliases. When a site alias is |
123 | | -# defined for a remote site, Drush will use the ssh command to run |
124 | | -# the requested command on the remote machine. The simplest remote |
125 | | -# alias looks like this: |
| 105 | +# This command is equivalent to the longer form: |
126 | 106 | # |
127 | | -# @code |
128 | | -# # File: remote.site.yml |
129 | | -# live: |
130 | | -# host: server.domain.com |
131 | | -# user: www-admin |
132 | | -# root: /other/path/to/drupal |
133 | | -# uri: http://example.com |
134 | | -# @endcode |
| 107 | +# $ drush --root=/path/to/drupal --uri=http://example.com status |
135 | 108 | # |
136 | | -# Drush also treats the site alias file /drush/sites/self.site.yml |
137 | | -# (in the Drupal root or project root) specially. If your current |
138 | | -# working directory is inside a Drupal project, then aliases such |
139 | | -# as `@self.live` may be referenced simply as `@live`. Commit the |
140 | | -# file self.site.yml to your site's repository to share remote aliases |
141 | | -# for a site with team members. |
| 109 | +# See "Additional Site Alias Options" below for more information. |
| 110 | + |
| 111 | +# Converting Legacy Alias Files |
142 | 112 | # |
143 | | -# The built-in alias "@none" represents the state of no Drupal site; |
144 | | -# to ignore the site at the cwd and just see default drush status: |
| 113 | +# To convert legacy alias (*.aliases.drushrc.php) to yml, run the |
| 114 | +# site:alias-convert command. |
| 115 | + |
| 116 | +# Altering aliases: |
145 | 117 | # |
146 | | -# $ drush @none status |
| 118 | +# See examples/Commands/SiteAliasAlterCommands.php for an example. |
| 119 | + |
| 120 | +# Environment variables: |
147 | 121 | # |
148 | | -# See `drush help site:alias` for more options for displaying site |
149 | | -# aliases. |
| 122 | +# It is no longer possible to set environment variables from within an alias. |
| 123 | +# This is a planned feature. |
| 124 | + |
| 125 | +# Additional Site Alias Options |
150 | 126 | # |
151 | | -# Although most aliases will contain only a few options, a number |
152 | | -# of settings that are commonly used appear below: |
| 127 | +# Aliases are commonly used to define short names for |
| 128 | +# local or remote Drupal installations; however, an alias |
| 129 | +# is really nothing more than a collection of options. |
153 | 130 | # |
154 | | -# - 'uri': The value of --uri should always be the same as |
155 | | -# when the site is being accessed from a web browser (e.g. http://example.com) |
156 | | -# - 'root': The Drupal root; must not be specified as a relative path. |
157 | | -# - 'host': The fully-qualified domain name of the remote system |
158 | | -# hosting the Drupal instance. **Important Note: The remote-host option |
159 | | -# must be omitted for local sites, as this option controls various |
160 | | -# operations, such as whether or not rsync parameters are for local or |
161 | | -# remote machines, and so on. |
162 | | -# - 'user': The username to log in as when using ssh or rsync. |
163 | 131 | # - 'os': The operating system of the remote server. Valid values |
164 | 132 | # are 'Windows' and 'Linux'. Be sure to set this value for all remote |
165 | 133 | # aliases because the default value is PHP_OS if 'remote-host' |
|
206 | 174 | # options: |
207 | 175 | # admin-password: 'secret-secret' |
208 | 176 | # @endcode |
| 177 | + |
| 178 | +# Site Alias Files for Service Providers |
209 | 179 | # |
210 | | -# Altering aliases: |
| 180 | +# There are a number of service providers that manage Drupal sites as a |
| 181 | +# service. Drush allows service providers to create collections of site alias |
| 182 | +# files to reference all of the sites available to a single user. In order |
| 183 | +# to so this, a new location must be defined in your Drush configuration |
| 184 | +# file: |
211 | 185 | # |
212 | | -# See examples/Commands/SiteAliasAlterCommands.php for an example. |
| 186 | +# @code |
| 187 | +# drush: |
| 188 | +# paths: |
| 189 | +# alias-path: |
| 190 | +# - '${env.home}/.drush/sites/provider-name' |
| 191 | +# @endcode |
213 | 192 | # |
214 | | -# Environment variables: |
| 193 | +# Site aliases stored in this directory may then be referenced by its |
| 194 | +# full alias name, including its location, e.g.: |
215 | 195 | # |
216 | | -# It is no longer possible to set environment variables from within an alias. |
217 | | -# This is a planned feature. |
| 196 | +# $ drush @provider-name.example.dev |
218 | 197 | # |
219 | | -# See https://github.com/consolidation/site-alias for more developer information about Site Aliases. |
| 198 | +# Such alias files may still be referenced by their shorter name, e.g. |
| 199 | +# `@example.dev`. Note that it is necessary to individually list every |
| 200 | +# location where site alias files may be stored; Drush never does recursive |
| 201 | +# (deep) directory searches for alias files. |
| 202 | +# |
| 203 | +# The `site:alias` command may also be used to list all of the sites and |
| 204 | +# environments in a given location, e.g.: |
| 205 | +# |
| 206 | +# $ drush site:alias @provider-name |
| 207 | +# |
| 208 | +# Add the option `--format=list` to show only the names of each site and |
| 209 | +# environment without also showing the values in each alias record. |
| 210 | + |
| 211 | +# Developer Information |
| 212 | +# |
| 213 | +# See https://github.com/consolidation/site-alias for more developer |
| 214 | +# information about Site Aliases. |
220 | 215 | # |
221 | 216 | # An example appears below. Edit to suit and remove the @code / @endcode and |
222 | 217 | # leading hashes to enable. |
|
241 | 236 | # root: /path/to/docroot |
242 | 237 | # uri: https://dev.example.com |
243 | 238 | # @endcode |
244 | | -# |
| 239 | + |
0 commit comments