Note: The stack referred to in this article is no longer maintained and this article is kept purely for reference.
The engineyard gem provides a command-line interface (CLI) to perform tasks such as deploying your application, rebuilding your application's environment, opening an ssh session to any of your instances, uploading and applying custom chef recipes, and more.
Getting started
You need to install and run the engineyard gem in your local environment on your development machine.
Even if you already have the engineyard gem installed, it is good practice to run "install engineyard" to make sure that you have the latest version of the gem.
Switching Engine Yard accounts
If you want to log out of one Engine Yard account and log in to another, use the logout command to delete the API token from ~/.eyrc
or env $EYRC
. This token is created when credentials are entered.
To switch accounts within the CLI
-
Type:
ey logout
-
Run any engineyard gem command, for example,
ey login
-
At the prompt, enter the credentials for the account you want to use.
Shortened name matching
A shortened substring name may be used to save typing with any command that accepts --environment/-e
, --account/-c
, or --app/-a
as options.
For example, if the app has 2 environments, myapp_staging
and myapp_production
, then any one of the following will correctly select myapp_production
:
--environment myapp_production
--environment production
-e prod
The interface will do its best to find the indicated application, environment, and account and exit without doing anything if it cannot find a definitive match.
Command reference
ey help
-
Print a short help message.
-
ey help COMMAND
prints out the help for that command. For example,ey help deploy
prints out the help for theey deploy
command, whileey help recipes apply
shows the help forey recipes apply
.
ey version
-
Print the version of the engineyard gem.
-
Arguments: none
ey deploy
-
Deploy your application.
-
This command must be run from a checked-out copy of your application.
- Arguments:
-
-e
--environment NAME
(optional): the environment to which you want this application to deploy. If this application is only deployed in one environment, this argument may be omitted. -
-r
--ref GIT-REF
(optional): the git ref to deploy- You can specify a branch, a tag, or a SHA.
- This argument defaults to the current branch.
- Note: the deployment process pulls the code from the git remote that was previously entered into the Engine Yard Cloud web application. Thus, the named branch must exist in that git remote for your deployment to succeed.
-
-a
--app NAME
(optional): the application to deploy. If the current working directory is inside the application’s git repository and--app
is omitted,ey
infers the application from the configured git remotes. -
-c
--account ACCOUNT
(optional): name of the account in which the application and environment can be found -
-m
--migrate COMMAND
: the command to use for database migrations. Default israke db:migrate
. -
--no-migrate
: Skip migrations. -
--ignore-default-branch
(optional): Override the default branch specified iney.yml
. -
--extra-deploy-hook-options
(optional): Additional options to be made available in deploy hooks (in the 'config' hash). Add key value pairs as follows:--extra-deploy-hook-options key1:val1 key2:val2
-
-
Deployment takes place in several stages. For more information, see our documentation on Steps of Deployment.
ey status
-
Shows deployment status of an app and environment.
-
Arguments:
-
-c
--account ACCOUNT
(optional): name of the account in which the environment can be found -
-a
--app APP
(optional): name of the deployed application. -
-e
--environment ENV
(optional): the environment to show the deploy status
-
ey environments
-
List your applications and environments. By default, lists only the environments for the current application.
- Arguments:
-
-A
--all
(optional): list all applications and environments -
-s
--simple
(optional): prints each environment name on its own on a new line -
-c
--account ACCOUNT
(optional): name of the account in which the environment can be found -
-a
--app APP
(optional): name of the application containing the environments -
-e
--environment ENV
(optional): shows only environments matching named environment
-
ey rebuild
-
Ensure the configuration of your environment is up-to-date.
- Arguments:
-
-c
--account ACCOUNT
(optional): name of the account in which the environment can be found -
-e
--environment NAME
(optional): the environment to rebuild.
-
ey ssh
-
SSH into a session or run a command on the application master. A command can also be run on
--all
servers. - Arguments:
-
-c
--account ACCOUNT
(optional): name of the account in which the environment can be found -
-e
--environment/-e NAME
(optional): the environment to SSH into. -
-A
--all
(optional): run command on all servers. -
--utilities UTILITY NAMES HERE
(optional): Run command on the utility servers with the given names. If no names are given, run on all utility servers. -
--app-servers
(optional): Run command on all application servers -
--db-servers
(optional): Run command on the database servers -
--db-master
(optional): Run command on the master database server -
--db-slaves
(optional): Run command on the slave database servers
-
ey logs
-
Show the most recent configuration logs.
- Arguments:
-
-c
--account ACCOUNT
(optional): name of the account in which the environment can be found -
-e
--environment NAME
(optional): the environment in whose logs you are interested.
-
ey recipes apply
-
Run already uploaded custom chef recipes.
- Arguments:
-
-c
--account ACCOUNT
(optional): name of the account in which the environment can be found -
-e
--environment NAME
(optional): the environment in which to run the recipes. - This argument may be specified by unambiguous substring.
-
ey recipes upload
-
Upload custom chef recipes.
- Arguments:
-
-c
--account ACCOUNT
(optional): name of the account in which the environment can be found -
-e
--environment/-e NAME
(optional): the environment in which to place the recipes. -
--apply
(optional): immediately run the uploaded recipes. This is the same as runningey recipes upload && ey recipes apply
.
-
ey recipes download
-
Download custom chef recipes from an instance.
- Arguments:
-
-c
--account ACCOUNT
(optional): the account that the environment belongs to. -
-e
--environment NAME
(optional): the environment to download the recipes from.
-
-
Use download on instances where you have previously uploaded recipes. For example, you might want to download custom chef recipes when troubleshooting–to review the recipes that you are running on your instance.
-
The recipes are unpacked into a directory called “cookbooks” in the current directory. If the cookbooks directory already exists, you get an error.
ey web disable
-
Display a maintenance page. (Disables the web app and then displays the maintenance page.)
- Arguments:
-
-c
--account ACCOUNT
(optional): name of the account in which the environment can be found -
-a
--app APP
(optional): name of the application whose maintenance page will be displayed. -
-e
--environment NAME
(optional): the environment in which to display the maintenance page.
-
-
This command has to be invoked from the application’s git repository so it can figure out which application gets the maintenance page.
ey web enable
-
Remove the maintenance page. (Removes the maintenance page and enables the web app.)
- Arguments:
-
-c
--account ACCOUNT
(optional): name of the account in which the environment can be found -
-a
--app APP
(optional): name of the application whose maintenance page will be removed. -
-e
--environment NAME
(optional): the environment in which to remove the maintenance page.
-
-
This command has to be invoked from the application’s git repository so it can figure out which application gets its maintenance page removed.
- For more information, see Use Application Maintenance Pages.
ey web restart
- Restarts the application servers for the given application.
- Enables maintenance pages if they would be enabled during a normal deploy. Respects the
maintenance_on_restart
option iney.yml
. - Arguments:
-
-c
--account ACCOUNT
(optional): name of the account in which the environment can be found -
-a
--app APP
(optional): name of the application whose maintenance page will be removed. -
-e
--environment NAME
(optional): the environment in which to remove the maintenance page.
-
ey logout
-
Logs out the currently signed in user by removing the
api_token
from~/.eyrc
.
Environment variables
-
ENGINEYARD_API_TOKEN
Specify an API token to use instead of the token found in
~/.eyrc
. Useful for automation scripts. The API token may also be specified on any command with--api-token
. -
CLOUD_URL
Location of Engine Yard Cloud. Mainly used in development. Default is https://cloud.engineyard.com/
-
DEBUG
Debug the engineyard gem (print a lot of stuff). Default is off.
-
EYRC
Specifies the location of the
.eyrc
file to use. The.eyrc
file is where the API token is stored. Default is~/.eyrc
. -
NO_SSH
If set, all commands (e.g.
ey deploy
,ey rollback
) that require an SSH connection will short-circuit. Mainly used in the engineyard gem’s integration tests. -
GIT_DIR or GIT_WORK_TREE
The engineyard gem will respect the standard git environment variables to indicate the application working directory.
ey.yml Customizations
Extra customization can be accomplished with an ey.yml
file. More about the ey.yml file.
Disable migrations
To prevent the rake db:migrate
for certain environments, add migrate: false
to the environment section ey.yml:
environments:
YOUR-ENVIRONMENT-NAME-GOES-HERE:
migrate: false
Exclude the .git directory
If you have a large .git directory and you do not want it copied over on every deploy, add a config/ey.yml
to your application’s repository with the following contents:
environments:
YOUR-ENVIRONMENT-NAME-GOES-HERE:
copy_exclude:
- .git
If you have feedback or questions about this page, add a comment below. If you need help, submit a ticket with Engine Yard Support.
Comments
Article is closed for comments.