The RHC Command-line Reference - Learning OpenShift (2014)

Learning OpenShift (2014)

Appendix A. The RHC Command-line Reference

This appendix will serve as a reference for all of the available commands that a user can execute by utilizing the RHC command-line tools. I often find that browsing through an appendix such as this often exposes me to commands that I may not have known about just by using a system. Therefore, I decided to include it as part of this book so that you may stumble upon a feature that can save you time in your development efforts.

Top-level commands

The top-level commands are the first items that you would enter in after issuing the RHC command. These commands will allow you to control your OpenShift account as well as perform actions on applications.

Getting started

The commands listed in the following table will allow you to perform tasks such as setting up your account, creating applications, listing your applications, managing cartridges, and managing environment variables for your OpenShift gear:

Top-level commands

Description

setup

This will set up your local system in order to connect to the OpenShift servers. This includes creating and uploading an SSH key as well as creating authorization tokens.

create-app

This allows you to create an application that will be deployed to the OpenShift service

apps

Running this command will list all of the applications that you currently have deployed.

cartridges

This will list all the available cartridges that you can use for applications.

add-cartridge

This adds a cartridge to an existing application that you have deployed.

set-env

This allows you to create environment variables for a specific application.

logout

This will expire any authorization tokens that are active for your current session.

Working with applications

The commands in the following table provide a mechanism for managing applications that are actively deployed on the OpenShift platform:

Commands

Description

tail

This command opens up an SSH session and displays all the logfiles of your running application.

port-forward

This command forwards ports using SSH so that you can connect to remote services as if they were running locally on your machine.

threaddump

This command will allow you to view a thread dump of an application process.

snapshot

This command will allow you to create a backup of your application code and database that you can later use if you need to restore.

git-clone

This command will clone the remote Git repository to your local machine and create metadata that will allow you to perform context-aware RHC commands.

Management commands

The following table lists all the management commands along with their descriptions:

Command

Description

account

This command allows you to view information about your OpenShift account.

alias

This command allows you to create a custom domain name (vhost) for your application.

app

This command allows you to perform actions related to an application on the platform, such as creating, deleting, and modifying.

authorization

This command allows the management of authorization tokens for your account.

cartridge

This command allows you to manage cartridges that have been added to your application including the ability to stop, start, and delete add-on cartridges.

deployment

This command allows you to manage deployments for an application. This is typically used to roll back from the current deployment to a previous one.

domain

This command allows the management of domains for your OpenShift account including the ability to create new ones and delete the existing ones.

env

This command allows you to manage and view environment variables that have been set for your application.

member

This command allows you to manage membership items for a specific domain. This is commonly used in team environments where more than one developer needs access to deploy the application code.

scp

This command allows you to securely copy a file from your local machine to your remote OpenShift gear.

server

This command displays information about the remote OpenShift service, including any maintenance information.

ssh

This is a convenience command that will allow you to SSH to your remote OpenShift gear.

ssh-key

This command allows you to manage SSH keys that have been added to your account. This includes the ability to create new ones and delete old ones.

team

This command allows you manage teams that are associated with your account including the ability to create new ones and delete the existing teams.