User Guide
Managing Applications in the Cloud with OpenShift Enterprise
Abstract
- Create and manage domains and SSL certificates
- Create, build, and deploy applications
- Manage applications and cartridges
- Monitor and manage application storage and resources
Chapter 1. Introduction to OpenShift Enterprise Copy linkLink copied to clipboard!
1.1. Basic Architecture Copy linkLink copied to clipboard!
System Component | Description |
---|---|
Broker | Responsible for managing user logins, DNS, and application state. It manages the nodes and coordinates provisioning and application management. User interaction with the broker is performed using the management console, CLI, or a REST-based API. |
Nodes | Hold the gears that run the applications, and enable resource sharing so that multiple gears can run on a single physical or virtual machine. This machine is referred to as a node host. |
Message Bus | Link between the broker and the nodes. |
Gears | Resource-constrained containers for application code where cartridges run. Gears determine the amount of RAM and disk space available to a cartridge. |
Cartridges | Cartridges provide the functionality to run applications. Numerous cartridges are currently available to support languages such as Perl, PHP, and Ruby, as well as many database cartridges, such as PostgreSQL and MySQL. |
1.2. User Interfaces Copy linkLink copied to clipboard!
1.2.1. Management Console Copy linkLink copied to clipboard!
broker.example.com
.
- Setting up, administering and managing accounts
- Launching new applications
- Managing and monitoring applications
Figure 1.1. Management Console
Page | Description | |
---|---|---|
![]() | View and manage applications and cartridges. If there are no applications, you can create new applications from this page. | |
![]() | View and manage SSH keys, domains, and account authorizations. | |
![]() | Access to KBase articles, community forums, tutorials, and other community resources. A wide variety of resources are available for diagnosing and resolving issues with your account or your applications. | |
![]() |
View and manage account information. This page shows account details and account usage.
|
1.2.2. Client Tools Copy linkLink copied to clipboard!
- Coding
- Debugging
- Advanced application management
Note
rhc
package found in the OpenShift Enterprise 2.0 Client Tools channel is based on the Red Hat Enterprise Linux 6 RPM version of the client tools, and not the Ruby gem version, which is updated more frequently. Therefore, some updated features may be temporarily only available for the Ruby gem version. See Client Tools Installation Guide to install the latest Ruby gem version of the client tools and get all available features.
1.3. What's New in OpenShift Enterprise 2.0 Copy linkLink copied to clipboard!
Chapter 2. Getting Started Copy linkLink copied to clipboard!
2.1. OpenShift User Account Copy linkLink copied to clipboard!
2.2. Client Tools Copy linkLink copied to clipboard!
2.3. Basic Administration Copy linkLink copied to clipboard!
2.3.1. Viewing Account Information Copy linkLink copied to clipboard!
rhc account
$ rhc account
Example 2.1. Viewing Account Information
2.3.2. Ending Current Session Copy linkLink copied to clipboard!
rhc logout
$ rhc logout
Chapter 3. Authentication Copy linkLink copied to clipboard!
3.1. Authorization Tokens Copy linkLink copied to clipboard!
3.1.1. Introduction to Authorization Tokens Copy linkLink copied to clipboard!
Scope | Description | Validity |
---|---|---|
session | Access to all API functions against an account. | 1 day |
read | Read-only access to account resources, but cannot view authorization tokens. | 1 month |
userinfo | Access to login name, unique id, and user capabilities. | 1 month |
rhc setup
command is initially run to configure the client tools, the setup wizard prompts you to create an authorization token. If you answer YES
, the wizard creates a session token in the ~/.openshift
directory. With this token, all client tool commands can be run without entering your login credentials each time. When the token expires you are automatically prompted to reenter login information to renew the existing token. See the OpenShift Enterprise Client Tools Installation Guide for more information on installing and configuring the client tools.
rhc setup
command to create one.
rhc logout
command to delete the token.
3.1.2. Creating Authorization Tokens Copy linkLink copied to clipboard!
rhc authorization add --scopes Scope --note Name
$ rhc authorization add --scopes Scope --note Namerhc authorization add --scopes Scope --note Namerhc authorization add --scopes Scope --note Namerhc authorization add --scopes Scope --note Name
--scopes
option, and a name for the token with the --note
option.
Example 3.1. Creating an Authorization Token
--token token_string
global option to run rhc
commands as the user associated with the authorization token that was provided.
3.1.3. Viewing Authorization Tokens Copy linkLink copied to clipboard!
rhc authorization list
$ rhc authorization list
Example 3.2. Viewing Authorization Tokens
3.1.4. Deleting Authorization Tokens Copy linkLink copied to clipboard!
Delete one or more tokens with the following command, separating multiple tokens with commas:
rhc authorization delete token_1, token_2
$ rhc authorization delete token_1, token_2 rhc authorization delete token_1, token_2
Delete all tokens associated with your account with the following command:
rhc authorization delete-all
$ rhc authorization delete-all
3.2. SSH Keys Copy linkLink copied to clipboard!
3.2.1. Introduction to SSH Keys Copy linkLink copied to clipboard!
.ssh
folder of your home directory. The SSH key pair consists of the public key, id_rsa.pub
, and the private key, id_rsa
. As part of the initial configuration, you have the option of automatically uploading the public key, id_rsa.pub
, to the OpenShift Enterprise server. See the Client Tools Installation Guide for more information on how to configure the client tools.
ssh-rsa |
ssh-dss |
ecdsa-sha2-nistp256-cert-v01@openssh.com |
ecdsa-sha2-nistp384-cert-v01@openssh.com |
ecdsa-sha2-nistp521-cert-v01@openssh.com |
ssh-rsa-cert-v01@openssh.com |
ssh-dss-cert-v01@openssh.com |
ssh-rsa-cert-v00@openssh.com |
ssh-dss-cert-v00@openssh.com |
ecdsa-sha2-nistp256 |
ecdsa-sha2-nistp384 |
ecdsa-sha2-nistp521 |
krb5-principal |
3.2.2. Generating Keys Manually Copy linkLink copied to clipboard!
- Run the following command to generate a pair of keys, replacing KeyType with the type of key to generate:
ssh-keygen -t KeyType
$ ssh-keygen -t KeyTypessh-keygen -t KeyType
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Press Enter when prompted to save the key file in the default location:
... Generating public/private rsa key pair. Enter file in which to save the key (/home/username/.ssh/id_rsa): /home/username/.ssh/id_rsa
... Generating public/private rsa key pair. Enter file in which to save the key (/home/username/.ssh/id_rsa): /home/username/.ssh/id_rsa
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Note
Red Hat recommends to save all SSH keys in the default location. If anid_rsa
file already exists, rename the new SSH key file to avoid overwriting the existing one. - Enter a passphrase or leave blank when prompted, then press Enter:
Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/username/.ssh/id_rsa Your public key has been saved in /home/username/.ssh/id_rsa.pub. ...
Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/username/.ssh/id_rsa Your public key has been saved in /home/username/.ssh/id_rsa.pub. ...
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
3.2.3. Adding a Key Copy linkLink copied to clipboard!
rhc sshkey add KeyName KeyPath
$ rhc sshkey add KeyName KeyPathrhc sshkey add KeyName KeyPathrhc sshkey add KeyName KeyPathrhc sshkey add KeyName KeyPath
3.2.3.1. Adding a Specific SSH Key Type Copy linkLink copied to clipboard!
rhc sshkey add KeyName --type KeyType --content KeyContent
$ rhc sshkey add KeyName --type KeyType --content KeyContentrhc sshkey add KeyName --type KeyType --content KeyContentrhc sshkey add KeyName --type KeyType --content KeyContentrhc sshkey add KeyName --type KeyType --content KeyContentrhc sshkey add KeyName --type KeyType --content KeyContentrhc sshkey add KeyName --type KeyType --content KeyContent
Add a Kerberos principal SSH key with the following command:
rhc sshkey add KeyName --type krb5-principal --content Principal
$ rhc sshkey add KeyName --type krb5-principal --content Principalrhc sshkey add KeyName --type krb5-principal --content Principalrhc sshkey add KeyName --type krb5-principal --content Principalrhc sshkey add KeyName --type krb5-principal --content Principal
3.2.4. Viewing All Public Keys Copy linkLink copied to clipboard!
rhc sshkey list
$ rhc sshkey list
Example 3.3. Viewing All Public Keys
3.2.5. Viewing a Specific Public Key Copy linkLink copied to clipboard!
rhc sshkey show KeyName
$ rhc sshkey show KeyNamerhc sshkey show KeyName
3.2.6. Deleting a Key Copy linkLink copied to clipboard!
rhc sshkey remove KeyName
$ rhc sshkey remove KeyNamerhc sshkey remove KeyName
3.2.7. Resolving Authentication Issues Copy linkLink copied to clipboard!
- Use the interactive setup wizard (recommended)
- Manually generate and add SSH keys
3.2.7.1. Resolving Issues with Interactive Setup Wizard Copy linkLink copied to clipboard!
rhc setup
command and follow the onscreen instructions.
3.3. Mutual SSL Copy linkLink copied to clipboard!
Procedure 3.1. To Configure the Client Tools for Mutual SSL Authentication:
- Mutual SSL authentication requires the current version of the OpenShift client tools. Ensure your client tools are up to date using the method you used to install them. See the OpenShift Enterprise Client Tools Installation Guide for details.
- If you are only connecting to one OpenShift Enterprise server, you can add the following to the
~/.openshift/express.conf
file on the workstation where the client tools are installed:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Alternatively, you can perform the same configuration from the command line using therhc setup
command:rhc setup --ssl-client-cert-file path/to/SSL/certificate/file --ssl-client-key-file path/to/certificate/keyfile --ssl-ca-file path/to/SSLCA/certificate/file
# rhc setup --ssl-client-cert-file path/to/SSL/certificate/file --ssl-client-key-file path/to/certificate/keyfile --ssl-ca-file path/to/SSLCA/certificate/filerhc setup --ssl-client-cert-file path/to/SSL/certificate/file --ssl-client-key-file path/to/certificate/keyfile --ssl-ca-file path/to/SSLCA/certificate/filerhc setup --ssl-client-cert-file path/to/SSL/certificate/file --ssl-client-key-file path/to/certificate/keyfile --ssl-ca-file path/to/SSLCA/certificate/filerhc setup --ssl-client-cert-file path/to/SSL/certificate/file --ssl-client-key-file path/to/certificate/keyfile --ssl-ca-file path/to/SSLCA/certificate/filerhc setup --ssl-client-cert-file path/to/SSL/certificate/file --ssl-client-key-file path/to/certificate/keyfile --ssl-ca-file path/to/SSLCA/certificate/filerhc setup --ssl-client-cert-file path/to/SSL/certificate/file --ssl-client-key-file path/to/certificate/keyfile --ssl-ca-file path/to/SSLCA/certificate/file
Copy to Clipboard Copied! Toggle word wrap Toggle overflow If you are using your client tools to manage accounts for multiple OpenShift servers, you can use therhc server
command instead:rhc server add broker.example.com --nickname Server_Nickname --ssl-client-cert-file path/to/SSL/certificate/file --ssl-client-key-file path/to/certificate/keyfile --ssl-ca-file path/to/SSLCA/certificate/file
# rhc server add broker.example.com --nickname Server_Nickname --ssl-client-cert-file path/to/SSL/certificate/file --ssl-client-key-file path/to/certificate/keyfile --ssl-ca-file path/to/SSLCA/certificate/filerhc server add broker.example.com --nickname Server_Nickname --ssl-client-cert-file path/to/SSL/certificate/file --ssl-client-key-file path/to/certificate/keyfile --ssl-ca-file path/to/SSLCA/certificate/filerhc server add broker.example.com --nickname Server_Nickname --ssl-client-cert-file path/to/SSL/certificate/file --ssl-client-key-file path/to/certificate/keyfile --ssl-ca-file path/to/SSLCA/certificate/filerhc server add broker.example.com --nickname Server_Nickname --ssl-client-cert-file path/to/SSL/certificate/file --ssl-client-key-file path/to/certificate/keyfile --ssl-ca-file path/to/SSLCA/certificate/filerhc server add broker.example.com --nickname Server_Nickname --ssl-client-cert-file path/to/SSL/certificate/file --ssl-client-key-file path/to/certificate/keyfile --ssl-ca-file path/to/SSLCA/certificate/filerhc server add broker.example.com --nickname Server_Nickname --ssl-client-cert-file path/to/SSL/certificate/file --ssl-client-key-file path/to/certificate/keyfile --ssl-ca-file path/to/SSLCA/certificate/filerhc server add broker.example.com --nickname Server_Nickname --ssl-client-cert-file path/to/SSL/certificate/file --ssl-client-key-file path/to/certificate/keyfile --ssl-ca-file path/to/SSLCA/certificate/filerhc server add broker.example.com --nickname Server_Nickname --ssl-client-cert-file path/to/SSL/certificate/file --ssl-client-key-file path/to/certificate/keyfile --ssl-ca-file path/to/SSLCA/certificate/filerhc server add broker.example.com --nickname Server_Nickname --ssl-client-cert-file path/to/SSL/certificate/file --ssl-client-key-file path/to/certificate/keyfile --ssl-ca-file path/to/SSLCA/certificate/filerhc server add broker.example.com --nickname Server_Nickname --ssl-client-cert-file path/to/SSL/certificate/file --ssl-client-key-file path/to/certificate/keyfile --ssl-ca-file path/to/SSLCA/certificate/file
Copy to Clipboard Copied! Toggle word wrap Toggle overflow See Chapter 4, Multiple OpenShift Servers for general information on managing and switching between accounts for multiple OpenShift servers.
Chapter 4. Multiple OpenShift Servers Copy linkLink copied to clipboard!
~/.openshift/express.conf
file would be overwritten each time the client tools were configured for use with a new server. Starting with OpenShift Enterprise 2.1.5, you can configure the client tools shipped with OpenShift Enterprise for use with multiple servers.
4.1. Server Management Copy linkLink copied to clipboard!
4.1.1. Adding a Server Copy linkLink copied to clipboard!
rhc server add server.name.example.com
$ rhc server add server.name.example.comrhc server add server.name.example.com
rhc server add server.name.example.com --nickname Server_Nickname
$ rhc server add server.name.example.com --nickname Server_Nicknamerhc server add server.name.example.com --nickname Server_Nicknamerhc server add server.name.example.com --nickname Server_Nicknamerhc server add server.name.example.com --nickname Server_Nickname
openshift.redhat.com
, the nickname defaults to online
.
rhc server add server.name.example.com --nickname Server_Nickname --rhlogin user@company.com
$ rhc server add server.name.example.com --nickname Server_Nickname --rhlogin user@company.comrhc server add server.name.example.com --nickname Server_Nickname --rhlogin user@company.comrhc server add server.name.example.com --nickname Server_Nickname --rhlogin user@company.comrhc server add server.name.example.com --nickname Server_Nickname --rhlogin user@company.comrhc server add server.name.example.com --nickname Server_Nickname --rhlogin user@company.comrhc server add server.name.example.com --nickname Server_Nickname --rhlogin user@company.com
4.1.2. Switching Between Servers Copy linkLink copied to clipboard!
rhc server use server.name.example.com
$ rhc server use server.name.example.comrhc server use server.name.example.com
rhc server use Server_Nickname
$ rhc server use Server_Nicknamerhc server use Server_Nickname
4.1.3. Configuring Server Settings Copy linkLink copied to clipboard!
rhc setup
command for the first time, the ~/.openshift/express.conf
file is created, containing the settings for your initial server configuration. When you add another server, or run the rhc setup
command again with the --server
option, the ~/.openshift/servers.yml
file is created, containing the settings for each server. You can edit this file to make any changes to the server configuration, and this takes precedence over the initial ~/.openshift/express.conf
file.
Example 4.1. Contents of the ~/.openshift/servers.yml
File
rhc server configure server.name.example.com Server_Setting
$ rhc server configure server.name.example.com Server_Settingrhc server configure server.name.example.com Server_Settingrhc server configure server.name.example.com Server_Settingrhc server configure server.name.example.com Server_Setting
rhc server configure Server_Nickname Server_Setting
$ rhc server configure Server_Nickname Server_Settingrhc server configure Server_Nickname Server_Settingrhc server configure Server_Nickname Server_Settingrhc server configure Server_Nickname Server_Setting
~/.openshift/servers.yml
file, such as the server nickname, the user name associated with the server, or any authorization tokens associated with the account.
Example 4.2. Changing the Nickname of a Server
rhc server configure dev.openshift.company.com --nickname dev
$ rhc server configure dev.openshift.company.com --nickname dev
Example 4.3. Changing the Default User
rhc server configure dev --rhlogin username@example.com
$ rhc server configure dev --rhlogin username@example.com
4.1.4. Listing Servers Copy linkLink copied to clipboard!
rhc server list
$ rhc server list
rhc servers
command.
4.1.5. Viewing a Server Copy linkLink copied to clipboard!
rhc server show server.name.example.com
$ rhc server show server.name.example.comrhc server show server.name.example.com
rhc server show Server_Nickname
$ rhc server show Server_Nicknamerhc server show Server_Nickname
4.1.6. Removing a Server Copy linkLink copied to clipboard!
rhc server remove server.name.example.com
$ rhc server remove server.name.example.comrhc server remove server.name.example.com
rhc server remove Server_Nickname
$ rhc server remove Server_Nicknamerhc server remove Server_Nickname
Note
Chapter 5. Domains Copy linkLink copied to clipboard!
5.1. Introduction to Domains Copy linkLink copied to clipboard!
5.2. Domain Management Copy linkLink copied to clipboard!
5.2.1. Creating a Domain Copy linkLink copied to clipboard!
rhc domain create Domain_Name
$ rhc domain create Domain_Namerhc domain create Domain_Name
automobile
.
Example 5.1. Creating a Domain
rhc domain create automobile
$ rhc domain create automobile
Creating domain 'automobile'
You may now create an application using the 'rhc app create' command
Note
Domains Allowed
setting determines the number of domains you can create. Use the rhc account
command to view account settings. Contact your system administrator to request any changes to your account, or see the OpenShift Enterprise Administration Guide at https://access.redhat.com/site/documentation for more information.
5.2.2. Listing Available Domains Copy linkLink copied to clipboard!
rhc domain list
$ rhc domain list
Example 5.2. Listing Available Domains
rhc domains
command to list all available domains.
5.2.3. Viewing a Domain Copy linkLink copied to clipboard!
rhc domain show
$ rhc domain show
Example 5.3. Viewing a Domain
-n
option:
rhc domain show -n Domain_Name
$ rhc domain show -n Domain_Namerhc domain show -n Domain_Name
5.2.4. Renaming a Domain Copy linkLink copied to clipboard!
- Ensure the domain does not contain any applications with the following command:
rhc apps
$ rhc apps
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Delete any applications that exist in that domain with the following command:rhc app delete App_Name
$ rhc app delete App_Namerhc app delete App_Name
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Warning
Deleting an application deletes all remote data associated with that application, which cannot be recovered. - Rename a domain with the following command, specifying the current domain name and the new domain name:
rhc domain rename Old_Domain_Name New_Domain_Name
$ rhc domain rename Old_Domain_Name New_Domain_Namerhc domain rename Old_Domain_Name New_Domain_Namerhc domain rename Old_Domain_Name New_Domain_Namerhc domain rename Old_Domain_Name New_Domain_Name
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example 5.4. Renaming a Domain
rhc domain rename olddomain newdomain
$ rhc domain rename olddomain newdomain Renaming domain 'olddomain' to 'newdomain'... done Applications in this domain will use the new name in their URL.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
5.2.5. Deleting a Domain Copy linkLink copied to clipboard!
Procedure 5.1. To Delete a Domain:
- Ensure the domain does not contain any applications with the following command:
rhc domain show Domain_Name
$ rhc domain show Domain_Namerhc domain show Domain_Name
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Delete any applications that exist in that domain with the following command:rhc app delete App_Name
$ rhc app delete App_Namerhc app delete App_Name
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Warning
Deleting an application deletes all remote data associated with that application, which cannot be recovered. - Delete the domain with the following command:
rhc domain delete Domain_Name
$ rhc domain delete Domain_Namerhc domain delete Domain_Name
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Note
See Also:
5.2.6. Configuring Domain Gear Size Copy linkLink copied to clipboard!
Option | Description |
---|---|
--no-allowed-gear-sizes | Does not allow any gear sizes in this domain. |
--allowed-gear-sizes [SIZES] | Gear sizes to be allowed in this domain. To specify multiple sizes, use a comma-delimited list. To see available sizes, run the rhc account command. |
-n, --namespace [NAME] | Name of a domain. |
rhc domain-configure domain --allowed-gear-sizes gearsizes
$ rhc domain-configure domain --allowed-gear-sizes gearsizesrhc domain-configure domain --allowed-gear-sizes gearsizesrhc domain-configure domain --allowed-gear-sizes gearsizesrhc domain-configure domain --allowed-gear-sizes gearsizes
Example 5.5. Configuring the Gear Size of a Domain
rhc domain-configure mydomain --allowed-gear-sizes small.highcpu
$ rhc domain-configure mydomain --allowed-gear-sizes small.highcpu
Chapter 6. Teams Copy linkLink copied to clipboard!
6.1. Introduction to Teams Copy linkLink copied to clipboard!
You can have explicit roles within a domain, and belong to a team which has a role within the domain. The following team roles are available: view
, edit
, and admin
. If you have a specific role, and you are on a team that has a different role, the effective role is the higher of the two roles. Therefore, the following guidelines apply:
- If you have the
view
role in a domain, and you are not on a team, you can view the domain. - If you are on a team that has the
view
role in a domain, you can view applications within that domain. - If you have the
edit
role within a domain, and you are on a team that has theview
role, you can edit applications within the domain. - If you have the
view
role in a domain, and you are on a team that has theedit
role, you can edit applications within the domain. - If you do not have an explicit role in a domain, and you are on a team that has the
edit
role, you are not listed in the domain membership, except within the team.
6.2. Team Management Copy linkLink copied to clipboard!
6.2.1. Creating a Team Copy linkLink copied to clipboard!
rhc team create Team_Name
$ rhc team create Team_Namerhc team create Team_Name
Note
6.2.2. Adding Members to a Team Copy linkLink copied to clipboard!
rhc member add user@myemail.com -t Team_Name
$ rhc member add user@myemail.com -t Team_Namerhc member add user@myemail.com -t Team_Namerhc member add user@myemail.com -t Team_Namerhc member add user@myemail.com -t Team_Name
Note
6.2.3. Listing Your Teams Copy linkLink copied to clipboard!
rhc teams
$ rhc teams
--mine
command:
rhc teams --mine
$ rhc teams --mine
6.2.4. Viewing Team Information Copy linkLink copied to clipboard!
rhc team show Team_Name
$ rhc team show Team_Namerhc team show Team_Name
rhc team show --team-id Team_ID
$ rhc team show --team-id Team_IDrhc team show --team-id Team_ID
6.2.5. Leaving a Team Copy linkLink copied to clipboard!
rhc team leave Team_Name
$ rhc team leave Team_Namerhc team leave Team_Name
rhc team leave --team-id Team_ID
$ rhc team leave --team-id Team_IDrhc team leave --team-id Team_ID
Note
6.2.6. Deleting a Team Copy linkLink copied to clipboard!
rhc team delete Team_Name
$ rhc team delete Team_Namerhc team delete Team_Name
rhc team delete --team-id Team_ID
$ rhc team delete --team-id Team_IDrhc team delete --team-id Team_ID
Note
Chapter 7. Domain Membership Copy linkLink copied to clipboard!
7.1. Introduction to Domain Membership Copy linkLink copied to clipboard!
Role | Description |
---|---|
View | Member has read-only access to view information about the domain and its applications and cannot make any changes. |
Edit | Member can create, update, and delete all applications in the domain, and has Git and SSH access. |
Administer | Member has access to all features, but cannot change allowed gear sizes or edit the domain name. |
edit
role, but it can be changed.
7.2. Managing Domain Membership Copy linkLink copied to clipboard!
7.2.1. Adding a Member Copy linkLink copied to clipboard!
rhc member add user@myemail.com -n Domain_Name
$ rhc member add user@myemail.com -n Domain_Namerhc member add user@myemail.com -n Domain_Namerhc member add user@myemail.com -n Domain_Namerhc member add user@myemail.com -n Domain_Name
edit
. Use the --role
option when adding a member to specify a different role:
rhc member add user@myemail.com -n Domain_Name --role Member_Role
$ rhc member add user@myemail.com -n Domain_Name --role Member_Rolerhc member add user@myemail.com -n Domain_Name --role Member_Rolerhc member add user@myemail.com -n Domain_Name --role Member_Rolerhc member add user@myemail.com -n Domain_Name --role Member_Rolerhc member add user@myemail.com -n Domain_Name --role Member_Rolerhc member add user@myemail.com -n Domain_Name --role Member_Role
When adding a team to a domain, use the --type
option with team
specified:
rhc member add Team_Name -n Domain_Name --type team
$ rhc member add Team_Name -n Domain_Name --type teamrhc member add Team_Name -n Domain_Name --type teamrhc member add Team_Name -n Domain_Name --type teamrhc member add Team_Name -n Domain_Name --type teamrhc member add Team_Name -n Domain_Name --type team
--global
option:
rhc member add Global_Team_Name -n Domain_Name --type team --global
$ rhc member add Global_Team_Name -n Domain_Name --type team --globalrhc member add Global_Team_Name -n Domain_Name --type team --globalrhc member add Global_Team_Name -n Domain_Name --type team --globalrhc member add Global_Team_Name -n Domain_Name --type team --globalrhc member add Global_Team_Name -n Domain_Name --type team --global
rhc member add Team_ID -n Domain_Name --type team --ids
$ rhc member add Team_ID -n Domain_Name --type team --idsrhc member add Team_ID -n Domain_Name --type team --idsrhc member add Team_ID -n Domain_Name --type team --idsrhc member add Team_ID -n Domain_Name --type team --idsrhc member add Team_ID -n Domain_Name --type team --ids
Note
--role
option.
7.2.2. Changing Member Role Copy linkLink copied to clipboard!
view
, edit
, or admin
:
rhc member update user@myadmin.com -n Domain_Name --role Member_Role
$ rhc member update user@myadmin.com -n Domain_Name --role Member_Rolerhc member update user@myadmin.com -n Domain_Name --role Member_Rolerhc member update user@myadmin.com -n Domain_Name --role Member_Rolerhc member update user@myadmin.com -n Domain_Name --role Member_Rolerhc member update user@myadmin.com -n Domain_Name --role Member_Rolerhc member update user@myadmin.com -n Domain_Name --role Member_Role
Change an existing team's role by using the --type
option and specifying team
:
rhc member update Team_Name -n Domain_Name --role Member_Role --type team
$ rhc member update Team_Name -n Domain_Name --role Member_Role --type teamrhc member update Team_Name -n Domain_Name --role Member_Role --type teamrhc member update Team_Name -n Domain_Name --role Member_Role --type teamrhc member update Team_Name -n Domain_Name --role Member_Role --type teamrhc member update Team_Name -n Domain_Name --role Member_Role --type teamrhc member update Team_Name -n Domain_Name --role Member_Role --type teamrhc member update Team_Name -n Domain_Name --role Member_Role --type team
rhc member update Team_ID -n Domain_Name --role Member_Role --type team --ids
$ rhc member update Team_ID -n Domain_Name --role Member_Role --type team --idsrhc member update Team_ID -n Domain_Name --role Member_Role --type team --idsrhc member update Team_ID -n Domain_Name --role Member_Role --type team --idsrhc member update Team_ID -n Domain_Name --role Member_Role --type team --idsrhc member update Team_ID -n Domain_Name --role Member_Role --type team --idsrhc member update Team_ID -n Domain_Name --role Member_Role --type team --idsrhc member update Team_ID -n Domain_Name --role Member_Role --type team --ids
7.2.3. Listing Members of a Domain Copy linkLink copied to clipboard!
rhc member list Domain_Name
$ rhc member list Domain_Namerhc member list Domain_Name
Example 7.1. Listing Domain Members
--all
option to display all members, including team-members:
rhc member list Domain_Name --all
$ rhc member list Domain_Name --allrhc member list Domain_Name --allrhc member list Domain_Name --all
Example 7.2. Listing Domain Members
7.2.4. Listing Members of an Application Copy linkLink copied to clipboard!
-a
option:
rhc member list -a App_Name
$ rhc member list -a App_Namerhc member list -a App_Name
Example 7.3. Listing Application Members
rhc member list -a myapp
$ rhc member list -a myapp
Login Role
----------------------- -------------
user1@myemail.com admin (owner)
user2@myemail.com view
7.2.5. Removing a Member Copy linkLink copied to clipboard!
-n
option and the user name to be removed:
rhc member remove -n Domain_Name user@myemail.com
$ rhc member remove -n Domain_Name user@myemail.comrhc member remove -n Domain_Name user@myemail.comrhc member remove -n Domain_Name user@myemail.comrhc member remove -n Domain_Name user@myemail.com
--all
option:
rhc member remove -n Domain_Name --all
$ rhc member remove -n Domain_Name --allrhc member remove -n Domain_Name --allrhc member remove -n Domain_Name --all
Remove a team from a domain by specifying the team name and adding the --type
option:
rhc member remove Team_Name -n Domain_Name --type team
$ rhc member remove Team_Name -n Domain_Name --type teamrhc member remove Team_Name -n Domain_Name --type teamrhc member remove Team_Name -n Domain_Name --type teamrhc member remove Team_Name -n Domain_Name --type teamrhc member remove Team_Name -n Domain_Name --type team
Chapter 8. Regions and Zones Copy linkLink copied to clipboard!
8.1. Introduction to Regions and Zones Copy linkLink copied to clipboard!
8.2. Region and Zone Management Copy linkLink copied to clipboard!
8.2.1. Listing Available Regions Copy linkLink copied to clipboard!
rhc region list
$ rhc region list
rhc regions
command.
See Also:
Chapter 9. Cartridges Copy linkLink copied to clipboard!
9.1. Introduction to Cartridges Copy linkLink copied to clipboard!
9.1.1. Web Framework Cartridges Copy linkLink copied to clipboard!
Cartridge | Scalable | Version |
---|---|---|
Do-It-Yourself (DIY) | No | - |
JBoss A-MQ | No | 6.1 [a] |
JBoss EAP | Yes | 6.2 |
JBoss Fuse | No | 6.1 [a] |
JBoss Fuse Builder | Yes | 6.1 [a] |
Jenkins Server | No | 1.5 |
Node.js | Yes | 0.10 |
Perl | Yes | 5.10 |
PHP | Yes | 5.3, 5.4 [b] [c] |
Python | Yes | 2.6, 2.7, 3.3 [d] |
Ruby | Yes | 1.8, 1.9, 2.0 [e] |
Tomcat (JBoss EWS) | Yes | 6, 7 [f] |
[a]
JBoss A-MQ 6.1, JBoss Fuse 6.1, and JBoss Fuse Builder 6.1 are available starting in OpenShift Enterprise 2.1.7
[b]
PHP 5.4 is available starting in OpenShift Enterprise 2.1.
[c]
PHP 5.3 has APC opcode cache enabled by default. PHP 5.4 has Zend OPCache enabled by default, with APC enabled only for user cache.
[d]
Python 3.3 is available starting in OpenShift Enterprise 2.1.1.
[e]
Ruby 2.0 is available starting in OpenShift Enterprise 2.2.
[f]
EWS 3 is only certified to run with Java 1.7.
|
9.1.2. Add-on Cartridges Copy linkLink copied to clipboard!
Function | Description |
---|---|
Database | Provide the application with one of several database back ends. Examples include MySQL and PostgreSQL. |
Monitoring and Management | Provide a range of options for managing and monitoring the application. Examples include the Cron task scheduler, and the Jenkins Client. |
The following table describes all available database cartridges.
Cartridge | Scalable | Version | Description |
---|---|---|---|
MySQL | No | 5.1, 5.5 [a] | Multi-user, multi-threaded SQL database server. |
MongoDB | No | 2.4 [b] | High-performance, open source NoSQL database. |
PostgreSQL | No | 8.4, 9.2 | Advanced object-relational database management system |
[a]
MySQL 5.5 is available starting in OpenShift Enterprise 2.1.
[b]
MongoDB 2.4 is available starting in OpenShift Enterprise 2.1.1.
|
Important
The following table describes all available management cartridges, and shows whether they are scalable or not.
Cartridge | Scalable | Version | Description |
---|---|---|---|
HAProxy | Yes | 1.4 | High performance TCP/HTTP load balancer. |
Cron | Yes | 1.4 | A daemon that runs specified programs at scheduled times. |
Jenkins Client | No | 1.5 | A client for managing Jenkins-enabled applications. |
9.1.3. Downloadable Cartridges Copy linkLink copied to clipboard!
See Also:
Chapter 10. Applications Copy linkLink copied to clipboard!
10.1. Introduction to Applications Copy linkLink copied to clipboard!
~/.ssh/known_hosts
directory.
Component | Description |
---|---|
Domain | The domain provides a unique group identifier for all the applications of a specific user. The domain is not directly related to DNS; instead, it is appended to the application name to form a final application URL of the form http://App_Name-domain.example.com |
Application Name | The name of the application is selected by a user. The final URL to access the application is of the form http://App_Name-domain.example.com |
Alias | DNS names can be provided for the application by registering an alias with OpenShift Enterprise and pointing the DNS entry to the OpenShift Enterprise servers. |
Git repository | A Git repository is used to modify application code locally. After the code is applied, the git push command is required to deploy the revised code. |
/var/tmp
and /tmp
directories for each user application. The /var/tmp
directory is a symbolic link to /tmp
. Each /tmp
directory is completely isolated from the /tmp
directories of all other applications. Files that are untouched for any period of ten days are automatically deleted from these directories.
10.1.1. Application Life Cycle Copy linkLink copied to clipboard!
Process | Description |
---|---|
Code | Develop the application code with the desired language and tools. Continuously push the application code to the applications remote Git source code repository. |
Build | OpenShift Enterprise supports various build mechanisms, whether it is a simple script, a personal Jenkins continuous integration server, or an external build system. |
Deploy | Every application is composed of cartridges that simplify server maintenance and configuration. OpenShift Enterprise supports various technologies to provision the required services automatically. |
Manage | OpenShift Enterprise allows real-time monitoring, debugging, and tuning of applications. Applications are scaled automatically depending on web traffic. |
10.1.2. Scalable Applications Copy linkLink copied to clipboard!
Each application created on OpenShift Enterprise must have one web framework cartridge defined upon creation. For example, a PHP cartridge. When an application is defined as scalable, a second cartridge, the HAProxy cartridge, is added to the application. The HAProxy cartridge listens to all incoming web-page requests to an application and passes them to the web cartridge, following the defined guidelines for load monitoring.
Figure 10.1. Cartridges on Gears in a Scaling Application
10.1.3. Highly-Available Applications Copy linkLink copied to clipboard!
At this time of writing, the only way to enable high availability in applications is through the REST API. See Section 11.7, “Making Applications Highly Available” for the curl command to make your applications highly available, or the relevant section in the OpenShift Enterprise REST API Guide for more information:
Chapter 11. Application Management Copy linkLink copied to clipboard!
11.1. General Information Copy linkLink copied to clipboard!
--timeout
option on the command line is used to override the default values when there are constant timeout issues. OpenShift Enterprise uses two timeout parameters: a connection timeout, which determines how long the client tries to connect to the server before timing out; and a read timeout, which determines how long the client waits for a response from the server. The default connection timeout value is 20 seconds. The default read timeout value is 120 seconds.
--timeout
option affects both timeout parameters, but it can only be used to increase the default values. The timeout value cannot be set to be less than the default. For example, if --timeout 50
is used, it sets the connection timeout value to 50 seconds, but does not affect the read timeout value. Similarly, if --timeout 150
is used, it sets both the connection and read timeout values to 150 seconds.
11.2. Creating an Application Copy linkLink copied to clipboard!
Prerequisites:
rhc app create
command and using the command options to supply the required information, such as the type of web framework to be used with the new application. Note that if multiple versions are available for the specified web framework cartridge, you are prompted to specify the version number to use for the new application.
Option | Description |
---|---|
-n, --namespace [NAME] | Domain where you wish to create the application. |
-g, --gear-size [SIZE] | Gear size determines how much memory and CPU a cartridge consumes. |
-s, --scaling | Creates a scalable application. |
--from-code [URL] | URL to a Git repository that becomes the initial contents of the application. |
-a, --app [NAME] | Name for the application to be created. |
--enable-jenkins [NAME] | Enables Jenkins continuous integration, and creates a Jenkins application if one does not already exist. The default name is 'jenkins' if a name is not specified. |
--region [NAME] | Specifies the region in which the application will be created. |
Create a non-scalable application in the default domain with the following command:
rhc app create App_Name Cart_Name
$ rhc app create App_Name Cart_Namerhc app create App_Name Cart_Namerhc app create App_Name Cart_Namerhc app create App_Name Cart_Name
Example 11.1. Creating a Non-Scalable Application
Create a scalable application by adding the -s
parameter to the command:
rhc app create App_Name Cart_Name -s
$ rhc app create App_Name Cart_Name -srhc app create App_Name Cart_Name -srhc app create App_Name Cart_Name -srhc app create App_Name Cart_Name -srhc app create App_Name Cart_Name -s
Example 11.2. Creating a Scalable Application
rhc app create racer php-5.4 -s
$ rhc app create racer php-5.4 -s
Note
Replace the web framework type with the URL of the manifest for the hosted cartridge to create an application from a downloadable cartridge:
rhc app create App_Name https://www.example.com/manifest.yml
$ rhc app create App_Name https://www.example.com/manifest.yml rhc app create App_Name https://www.example.com/manifest.yml rhc app create App_Name https://www.example.com/manifest.yml
As described in Section 5.2.1, “Creating a Domain”, each domain supports multiple applications. Therefore, if there are multiple domains associated with an account, you must specify in which domain to create the new application with the -n
option:
rhc app create App_Name Cart_Name -n Domain_Name
$ rhc app create App_Name Cart_Name -n Domain_Namerhc app create App_Name Cart_Name -n Domain_Namerhc app create App_Name Cart_Name -n Domain_Namerhc app create App_Name Cart_Name -n Domain_Namerhc app create App_Name Cart_Name -n Domain_Namerhc app create App_Name Cart_Name -n Domain_Name
- http://app1-domain.example.com
- http://app2-domain.example.com
Create an application and enable Jenkins continuous integration:
rhc app create App_Name Cart_Name --enable-jenkins Jenkins_App_Name
$ rhc app create App_Name Cart_Name --enable-jenkins Jenkins_App_Namerhc app create App_Name Cart_Name --enable-jenkins Jenkins_App_Namerhc app create App_Name Cart_Name --enable-jenkins Jenkins_App_Namerhc app create App_Name Cart_Name --enable-jenkins Jenkins_App_Namerhc app create App_Name Cart_Name --enable-jenkins Jenkins_App_Namerhc app create App_Name Cart_Name --enable-jenkins Jenkins_App_Name
Example 11.3. Creating an Application With Jenkins Continuous Integration
Important
OpenShift Enterprise supports grouping nodes into regions and zones. With the release of OpenShift Enterprise 2.2, you can create an application and assign it to a specific region using the --region
option:
rhc app create App_Name Cart_Name --gear-size Gear_Size --region Region_Name
$ rhc app create App_Name Cart_Name --gear-size Gear_Size --region Region_Name$ rhc app create App_Name Cart_Name --gear-size Gear_Size --region Region_Name$ rhc app create App_Name Cart_Name --gear-size Gear_Size --region Region_Name$ rhc app create App_Name Cart_Name --gear-size Gear_Size --region Region_Name$ rhc app create App_Name Cart_Name --gear-size Gear_Size --region Region_Name$ rhc app create App_Name Cart_Name --gear-size Gear_Size --region Region_Name$ rhc app create App_Name Cart_Name --gear-size Gear_Size --region Region_Name$ rhc app create App_Name Cart_Name --gear-size Gear_Size --region Region_Name
Example 11.4. Creating a Scalable Application into a Specific Region
rhc app create racer php-5.4 --gear-size medium --region eu-west-1a --scaling
$ rhc app create racer php-5.4 --gear-size medium --region eu-west-1a --scaling
To create an application using code from a Git repository, specify the URL:
rhc app create --from-code URL
$ rhc app create --from-code URLrhc app create --from-code URL
For build or other testing purposes, create an application of no specific type with the DIY cartridge:
rhc app create App_Name diy
$ rhc app create App_Name diyrhc app create App_Name diyrhc app create App_Name diy
git push
and a .openshift/action_hooks/
.
Note
git push
command the application is automatically deployed and visible to customers.
11.3. Cloning an Existing Application Copy linkLink copied to clipboard!
rhc app create New_Name --from-app App_Name
$ rhc app create New_Name --from-app App_Namerhc app create New_Name --from-app App_Namerhc app create New_Name --from-app App_Namerhc app create New_Name --from-app App_Name
Use domain/
to clone an application from another domain you have access to:
rhc app create New_Name --from-app domain/App_Name
$ rhc app create New_Name --from-app domain/App_Namerhc app create New_Name --from-app domain/App_Namerhc app create New_Name --from-app domain/App_Namerhc app create New_Name --from-app domain/App_Name
OpenShift Enterprise supports hosting applications in multiple regions and zones. With the release of OpenShift Enterprise 2.2, you can clone an application to a region other than us-east-1 using the --region option:
rhc app create New_App --from-app Existing_App --region Region_Name
$ rhc app create New_App --from-app Existing_App --region Region_Name$ rhc app create New_App --from-app Existing_App --region Region_Name$ rhc app create New_App --from-app Existing_App --region Region_Name$ rhc app create New_App --from-app Existing_App --region Region_Name$ rhc app create New_App --from-app Existing_App --region Region_Name$ rhc app create New_App --from-app Existing_App --region Region_Name
Option | Description |
---|---|
--gear-size Gear_Size | Use this option to change the gear size of the new application. For example, if the original application uses the small gear size, use this option with medium for the new application to use medium gears. |
--[no-]scaling | Use this option to configure the new application to be either scaling or non-scaling. For example, if the original application has scaling enabled, use the --no-scaling option to disable scaling for the new application and vice-versa. |
--env En_var | A cloned application will have the same environment variables as the original application. To add new environment variables to the new application, use this option with any desired environment variables. Additionally, you can override any environment variables that were set in the original application with this option and the environment variables to replace them. |
--no-git | Use this to disable Git for the new application. |
--region Region_Name | Specifies the region to which the application will be cloned. |
11.4. Cloning the Remote Application Repository Copy linkLink copied to clipboard!
rhc git-clone App_Name
$ rhc git-clone App_Namerhc git-clone App_Name
Example 11.5. Cloning the Remote Application Repository
rhc git-clone racer
$ rhc git-clone racer
Cloning into 'racer'...
Your application Git repository has been cloned to '/home/apps/racer'
11.5. Viewing Applications for a User Copy linkLink copied to clipboard!
rhc apps
$ rhc apps
Example 11.6. Viewing Applications for User
--mine
option to only list the applications that are within domains that you have created:
rhc apps --mine
$ rhc apps --mine
11.6. Scaling an Application Manually Copy linkLink copied to clipboard!
- If a certain load is anticipated on an application and it must be scaled accordingly.
- There are a fixed set of resources for an application.
- The cost must be controlled manually.
Procedure 11.1. To Scale an Application Manually:
- View the cartridges associated with a scalable application with the following command:
rhc app show App_Name
$ rhc app show App_Namerhc app show App_Name
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Locate the scaling cartridges as required. The example shows that the php-5.4 cartridge is scaling.Example 11.7. Showing a Cartridge's Information
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Set the minimum and maximum amount of gears the cartridge can use for scaling with the following command, specifying the application name and minimum and maximum number of gears:
rhc cartridge scale Cart_Name -a App_Name --min Min_Gears --max Max_Gears
$ rhc cartridge scale Cart_Name -a App_Name --min Min_Gears --max Max_Gearsrhc cartridge scale Cart_Name -a App_Name --min Min_Gears --max Max_Gearsrhc cartridge scale Cart_Name -a App_Name --min Min_Gears --max Max_Gearsrhc cartridge scale Cart_Name -a App_Name --min Min_Gears --max Max_Gearsrhc cartridge scale Cart_Name -a App_Name --min Min_Gears --max Max_Gearsrhc cartridge scale Cart_Name -a App_Name --min Min_Gears --max Max_Gearsrhc cartridge scale Cart_Name -a App_Name --min Min_Gears --max Max_Gearsrhc cartridge scale Cart_Name -a App_Name --min Min_Gears --max Max_Gears
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example 11.8. Setting the Maximum and Minimum Amount of Gears for a Cartridge
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
1
to stop a cartridge from scaling.
11.7. Making Applications Highly Available Copy linkLink copied to clipboard!
rhc app enable-ha App_Name
# rhc app enable-ha App_Namerhc app enable-ha App_Name
curl -X POST https://Hostname/broker/rest/domains/Domain_Name/applications/App_Name/events --user Username:Password --data-urlencode event=make-ha
$ curl -X POST https://Hostname/broker/rest/domains/Domain_Name/applications/App_Name/events --user Username:Password --data-urlencode event=make-hacurl -X POST https://Hostname/broker/rest/domains/Domain_Name/applications/App_Name/events --user Username:Password --data-urlencode event=make-hacurl -X POST https://Hostname/broker/rest/domains/Domain_Name/applications/App_Name/events --user Username:Password --data-urlencode event=make-hacurl -X POST https://Hostname/broker/rest/domains/Domain_Name/applications/App_Name/events --user Username:Password --data-urlencode event=make-hacurl -X POST https://Hostname/broker/rest/domains/Domain_Name/applications/App_Name/events --user Username:Password --data-urlencode event=make-hacurl -X POST https://Hostname/broker/rest/domains/Domain_Name/applications/App_Name/events --user Username:Password --data-urlencode event=make-hacurl -X POST https://Hostname/broker/rest/domains/Domain_Name/applications/App_Name/events --user Username:Password --data-urlencode event=make-hacurl -X POST https://Hostname/broker/rest/domains/Domain_Name/applications/App_Name/events --user Username:Password --data-urlencode event=make-hacurl -X POST https://Hostname/broker/rest/domains/Domain_Name/applications/App_Name/events --user Username:Password --data-urlencode event=make-hacurl -X POST https://Hostname/broker/rest/domains/Domain_Name/applications/App_Name/events --user Username:Password --data-urlencode event=make-hacurl -X POST https://Hostname/broker/rest/domains/Domain_Name/applications/App_Name/events --user Username:Password --data-urlencode event=make-ha
enable-ha
does not add a second HAProxy cartridge to the application. To resolve this, a scale-up event needs to happen for the second HAProxy cartridge to be added:
rhc app-scale-up test2
# rhc app-scale-up test2
rhc cartridge-scale cartridge -a test2 --min min_value
# rhc cartridge-scale cartridge -a test2 --min min_valuerhc cartridge-scale cartridge -a test2 --min min_valuerhc cartridge-scale cartridge -a test2 --min min_valuerhc cartridge-scale cartridge -a test2 --min min_value
11.8. Application Management Commands Copy linkLink copied to clipboard!
rhc app
command and the available options. The following example shows the command syntax.
rhc app action App_Name [Options]
$ rhc app action App_Name [Options]rhc app action App_Name [Options]rhc app action App_Name [Options]rhc app action App_Name [Options]rhc app action App_Name [Options]rhc app action App_Name [Options]
Action | Details |
---|---|
start | Start an application. |
stop | Stop an application. |
force-stop | Stop all application processes. |
restart | Restart an application. |
reload | Reload an application. |
show | Show information about an application. |
tidy | Clean out the application's log files and tmp directories, and tidy up the Git repository on the server. |
create | Create an application and add it to a domain. |
delete | Remove an application. |
configure | Configure an application's properties. |
deploy | Deploy a Git reference or binary file of an application. |
Option | Description |
---|---|
-n, --namespace [NAME] | Name of a domain. |
-a, --app [NAME] | Name of an application. |
-l, --rhlogin [LOGIN] | OpenShift Enterprise user account. |
-p, --password [PASSWORD] | OpenShift Enterprise account password. |
Example 11.9. Starting an Application
rhc app start myapp -n mydomain
$ rhc app start myapp -n mydomain
RESULT:
myapp started
11.9. Managing Applications in a Secure Shell Environment Copy linkLink copied to clipboard!
11.9.1. Introduction to Secure Shell Environment Copy linkLink copied to clipboard!
Important
Option | Description |
---|---|
-n, --namespace [NAME] | Domain where you wish to create the application. |
--ssh [PATH] | Path to SSH executable or additional options. |
--gears | Execute the command on all application gears; requires a command. |
--limit [INTEGAR] | Limit the number of simultaneous SSH connections that can be opened with the --gears option; default is 5. |
--command [COMMAND] | Command to run in the application's secure shell environment. |
-a, --app [NAME] | Name for the application to be created. |
-l, --rhlogin [LOGIN] | OpenShift Enterprise user account. |
-p, --password [PASSWORD] | OpenShift Enterprise account password. |
11.9.2. Accessing an Application Copy linkLink copied to clipboard!
rhc ssh App_Name [Options]
$ rhc ssh App_Name [Options]rhc ssh App_Name [Options]rhc ssh App_Name [Options]rhc ssh App_Name [Options]
Example 11.10. Accessing an Application in Secure Shell Environment
help
command to see the available shell commands. General Linux commands are available for routine operations in the shell environment.
--ssh
option.
11.9.3. Accessing a Specific Gear Copy linkLink copied to clipboard!
Procedure 11.2. To Access a Specific Gear:
- Determine the gear's ID and SSH URL with the following command:
rhc app show App_Name --gears
$ rhc app show App_Name --gearsrhc app show App_Name --gearsrhc app show App_Name --gears
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example 11.11. Viewing Application Gears
Copy to Clipboard Copied! Toggle word wrap Toggle overflow In the example output the ID of the first scaling gear is519b0fd02587c84b860002d8
and its SSH URL is519b0fd02587c84b860002d8@519b0fd02587c84b860002d8-automobile.example.com
. - Open a secure shell environment to the desired gear with the gear's SSH URL:
ssh 519b0fd02587c84b860002d8@519b0fd02587c84b860002d8-automobile.example.com
$ ssh 519b0fd02587c84b860002d8@519b0fd02587c84b860002d8-automobile.example.com
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
11.9.4. Accessing a Database Cartridge Copy linkLink copied to clipboard!
Important
Procedure 11.3. To Manage a Database in a Shell Environment:
- Access the desired application in a shell environment with the following command:
rhc ssh App_Name
$ rhc ssh App_Namerhc ssh App_Name
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - From the application's shell environment prompt, run the appropriate command for the database to access the interactive database shell:
- Run the
mysql
command to access the MySQL shell. - Run the
psql
command to access the PostgreSQL shell. - Run the
mongo
command to access the MongoDB shell.
Example 11.12. Accessing a MySQL Shell
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Note
persistence.xml
like:
<connection-url>jdbc:mysql://xxx.x.xxx.xxx:xxxx/databaseName?useUnicode=yes&characterEncoding=UTF-8</connection-url>
<connection-url>jdbc:mysql://xxx.x.xxx.xxx:xxxx/databaseName?useUnicode=yes&characterEncoding=UTF-8</connection-url>
11.10. Custom Domains and SSL Certificates Copy linkLink copied to clipboard!
Click on an application name in the My Applications tab in the Management Console to view custom domain name and SSL certificate management options for the selected application.
11.10.1. Managing Custom Domain Names Copy linkLink copied to clipboard!
Add a custom domain name to an application with the following command, specifying the application name and custom domain name:
rhc alias add App_Name Custom_Domain_Name
$ rhc alias add App_Name Custom_Domain_Namerhc alias add App_Name Custom_Domain_Namerhc alias add App_Name Custom_Domain_Namerhc alias add App_Name Custom_Domain_Name
Example 11.13. Adding a Custom Domain Name
rhc alias add racer fast.cars.com
$ rhc alias add racer fast.cars.com
RESULT:
Alias 'fast.cars.com' has been added.
View domain name aliases and SSL certificate status with the following command, specifying the application name:
rhc alias list App_Name
$ rhc alias list App_Namerhc alias list App_Name
Example 11.14. Viewing Custom Domain Names
Remove a domain name alias from an application with the following command, specifying the application name and the custom domain name to be removed:
rhc alias remove App_Name Custom_Domain_Name
$ rhc alias remove App_Name Custom_Domain_Namerhc alias remove App_Name Custom_Domain_Namerhc alias remove App_Name Custom_Domain_Namerhc alias remove App_Name Custom_Domain_Name
11.10.2. Managing Custom SSL Certificates Copy linkLink copied to clipboard!
Add a custom SSL certificate to an alias with the following command.
rhc alias update-cert App_Name Domain_Name --certificate Cert_File --private-key Key_File
$ rhc alias update-cert App_Name Domain_Name --certificate Cert_File --private-key Key_File rhc alias update-cert App_Name Domain_Name --certificate Cert_File --private-key Key_File rhc alias update-cert App_Name Domain_Name --certificate Cert_File --private-key Key_File rhc alias update-cert App_Name Domain_Name --certificate Cert_File --private-key Key_File rhc alias update-cert App_Name Domain_Name --certificate Cert_File --private-key Key_File rhc alias update-cert App_Name Domain_Name --certificate Cert_File --private-key Key_File rhc alias update-cert App_Name Domain_Name --certificate Cert_File --private-key Key_File
--passphrase
option.
View domain name aliases and SSL Certificate status with the following command, specifying the application name:
rhc alias list App_Name
$ rhc alias list App_Namerhc alias list App_Name
Example 11.15. Checking SSL Certificate Status
Remove a custom SSL certificate from an alias with the following command, specifying the application name and alias name:
rhc alias delete-cert App_Name Alias
$ rhc alias delete-cert App_Name Aliasrhc alias delete-cert App_Name Alias
11.11. Enabling the JBoss Metrics Plug-in Copy linkLink copied to clipboard!
standalone.xml
file within the <extensions>
element:
<extension module="com.openshift.metrics"/>
<extension module="com.openshift.metrics"/>
<profile>
element to look similar to the following:
Example 11.16. JBoss Metrics Plug-in XML
core-service=platform-mbean/type=memory-pool/name=CMS_Old_Gen
, or a valid MBean, such as java.lang:type=Memory
can be a source. Each source has a type (jboss
or mbean
) and a path, which is the name of the resource. A source contains one or more data points that can be read and published. You can specify a source-key (the location in the source of the data point) and a publish-key (the label of the information when written to stdout). Metrics are printed to stdout similar to the following:
Example 11.17. Logged Metrics Data
Jun 10 16:25:39 vm openshift-platform[29398]: type=metric appName=php6 gear=53961099e659c55b08000102 app=53961099e659c55b08000102 ns=demo quota.blocks.used=988 quota.blocks.limit=1048576 quota.files.used=229 quota.files.limit=80000
Jun 10 16:25:39 vm openshift-platform[29398]: type=metric appName=php6 gear=53961099e659c55b08000102 app=53961099e659c55b08000102 ns=demo quota.blocks.used=988 quota.blocks.limit=1048576 quota.files.used=229 quota.files.limit=80000
metrics-group
entries in order to group together the data points you wish to emit at any interval. For example, to emit memory data every 10 seconds but database connection pool data every 30 seconds, you would need two different metrics groups, because their schedules are different.
enabled="false"
to any <metrics-group>
, <source>
, or <metric>
attribute to disable it from being logged:
<metrics-group enabled="false">
<metrics-group enabled="false">
11.12. The Watchman Tool Copy linkLink copied to clipboard!
- Watchman searches cgroup event flow through syslog to determine when a gear is destroyed. If the pattern does not match a clean gear removal, the gear will be restarted.
- Watchman monitors the application server logs for messages hinting at out of memory, then restarts the gear if needed.
- Watchman compares the user-defined status of a gear, then the actual status of the gear, and fixes any dependencies.
- Watchman searches processes to ensure they belong to the correct cgroup. It kills abandoned processes associated with a stopped gear, or restarts a gear that has zero running processes.
- Watchman monitors the usage rate of CPU cycles and restricts a gear's CPU consumption if the rate of change is too aggressive.
11.13. Scheduling Cron Jobs Copy linkLink copied to clipboard!
Procedure 11.4. To Enable Cron Support for an Application:
- Add the cron scheduler cartridge to an application:
rhc cartridge add cron -a App_Name
$ rhc cartridge add cron -a App_Namerhc cartridge add cron -a App_Name
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Add the cron jobs to the application's
.openshift/cron/{minutely,hourly,weekly,daily,monthly}/
directories.Example 11.18. Sample Cron File
mkdir -p .openshift/cron/minutely echo 'date >> $OPENSHIFT_REPO_DIR/php/date.txt' > .openshift/cron/minutely/date.sh
$ mkdir -p .openshift/cron/minutely $ echo 'date >> $OPENSHIFT_REPO_DIR/php/date.txt' > .openshift/cron/minutely/date.sh
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The example cron job appends a new line of date information to the$OPENSHIFT_REPO_DIR/php/date.txt
file every minute. - Commit the changes and push them to the remote repository:
git add .openshift/cron/ git commit -m "configuring cron jobs" git push
$ git add .openshift/cron/ $ git commit -m "configuring cron jobs" $ git push
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Example 11.19. Verifying Cron Job Script Works Correctly
curl http://holy-roller.example.com/date.txt
$ curl http://holy-roller.example.com/date.txt
Thu Feb 2 01:02:01 EST 2012
Thu Feb 2 01:03:01 EST 2012
Thu Feb 2 01:04:01 EST 2012
/cron
subdirectories are executed at the respective frequencies. For example, scripts in each subdirectory are executed in alphabetical order; scripts in the /cron/hourly
directory are executed on the first minute of every hour.
Disable all cron job scripts with the following command:
rhc cartridge stop cron -a App_Name
$ rhc cartridge stop cron -a App_Namerhc cartridge stop cron -a App_Name
Enable all cron job scripts with the following command:
rhc cartridge start cron -a App_Name
$ rhc cartridge start cron -a App_Namerhc cartridge start cron -a App_Name
Note
11.14. Binding Applications to Ports Copy linkLink copied to clipboard!
Important
Application Name | Port Number | Description |
---|---|---|
Kerberos | 4444 | Kerberos is used for user authentication identifying with a node. |
Git | 9418 | Git is used for version control. |
MySQLd | 3306, 63132-63164 | My Structured Query Language (MySQL) acts as a server providing access to databases. |
Mongod | 27017 | MongoDB acts as a server providing access to databases. |
PostgreSQL | 5432 | PostgreSQL acts as a server providing access to databases. |
MS SQL | 1433-1434 | MS SQL acts as a server providing access to databases. |
Oracle | 1521, 2483, 2484 | Oracle acts as a server providing access to databases. |
HTTP/HTTPS | 8008, 8009, 8443 | Hypertext Transfer Protocol Secure (HTTPS) is used for secure communication over a server. |
HTTP cache | 8080, 8118, 8123, 10001-10010 | HTTP cache is used for the temporary storage of documents. |
memcache | 11211 | memcache is a memory caching system. |
jacORB | 3528, 3529 | JacORB is a Java request broker. |
JBoss Debug | 8787 | A debug program for JBoss applications. |
JBoss Management | 4712, 4447, 7600, 9123, 9990, 9999, 18001 | A management program for JBoss applications. |
AMQP | 5671-5672 | Advanced Message Queuing Protocol (AMQP) is used to transfer messages between applications. |
PulseAudio | 4713 | PulseAudio is a server that manages the use of audio devices. |
Flash | 1935 | Flash is a multimedia platform. |
Munin | 4949 | Munin is a network monitoring application. |
Virt Migration | 49152-49216 | Virt migration is the copying of one machine's data and moving it to another. |
OCSP | 9080 | Online Certificate Service Protocol (OCSP) is a protocol used for obtaining the status of a certificate. |
OPENSHIFT_Cart_Name_PORT
(8080) for HTTP connectivity, which reroutes externally through port 80.
11.14.1. Configuring WebSocket Ports Copy linkLink copied to clipboard!
ws://
), requests are directed to port 8000, while WebSocket Secure connections (wss://
) use port 8443, as shown in the following example:
- http://example.example.com:8000
- https://example.example.com:8443
11.14.2. Configuring Email Ports Copy linkLink copied to clipboard!
- SMTP/submission: 25, 465, 587
- IMAP: 143, 220, 993
- POP: 109, 110, 995
Important
11.15. Port Forwarding Copy linkLink copied to clipboard!
11.15.1. Introduction to Port Forwarding Copy linkLink copied to clipboard!
11.15.2. Application Port Forwarding Copy linkLink copied to clipboard!
rhc port-forward App_Name
$ rhc port-forward App_Namerhc port-forward App_Name
Example 11.20. Configuring Port Forwarding for an Application
rhc port-forward
command forwards all open ports on a running application to your local workstation. If an application contains multiple cartridges, the command output shows which remote services are being bound to local ports.
ssh -L local_port:host:remote_port gear_ID@app-domain.example.com
$ ssh -L local_port:host:remote_port gear_ID@app-domain.example.comssh -L local_port:host:remote_port gear_ID@app-domain.example.comssh -L local_port:host:remote_port gear_ID@app-domain.example.comssh -L local_port:host:remote_port gear_ID@app-domain.example.comssh -L local_port:host:remote_port gear_ID@app-domain.example.comssh -L local_port:host:remote_port gear_ID@app-domain.example.comssh -L local_port:host:remote_port gear_ID@app-domain.example.comssh -L local_port:host:remote_port gear_ID@app-domain.example.comssh -L local_port:host:remote_port gear_ID@app-domain.example.comssh -L local_port:host:remote_port gear_ID@app-domain.example.com
Example 11.21. Forwarding Specific Ports
ssh -L 8080:localhost:8080 70277280b8534c8a9fc76d2734393dfa@racer-auto.example.com
$ ssh -L 8080:localhost:8080 70277280b8534c8a9fc76d2734393dfa@racer-auto.example.com
11.15.3. Gear Port Forwarding Copy linkLink copied to clipboard!
rhc port-forward App_Name -g gear_ID
$ rhc port-forward App_Name -g gear_IDrhc port-forward App_Name -g gear_IDrhc port-forward App_Name -g gear_IDrhc port-forward App_Name -g gear_ID
Example 11.22. Port Forwarding a Specific Gear
11.15.4. Port Forwarding on Mac OS X Copy linkLink copied to clipboard!
- localhost
- 127.0.0.1
Example 11.23. Error Messages When Port Forwarding on Mac OS X
rhc port-forward myapp
$ rhc port-forward myapp
Checking available ports...
Error trying to forward ports. You can try to forward manually by running:
ssh -N 70277280b8534c8a9fc76d2734393dfa@myapp-domain.example.com
sudo ifconfig lo0 alias application_IP_address
$ sudo ifconfig lo0 alias application_IP_address sudo ifconfig lo0 alias application_IP_address
Example 11.24. Manually Configured IP Address
sudo ifconfig lo0 alias 127.10.51.129
$ sudo ifconfig lo0 alias 127.10.51.129
Note
ifconfig
command on Mac OS X.
Example 11.25. Configuring Aliases for Multiple IP Addresses
sudo ifconfig lo0 alias 127.11.25.1 sudo ifconfig lo0 alias 127.11.25.2
$ sudo ifconfig lo0 alias 127.11.25.1
$ sudo ifconfig lo0 alias 127.11.25.2
rhc port-forward
command.
Important
11.16. Deleting an Application Copy linkLink copied to clipboard!
Warning
yes
when prompted:
rhc app delete App_Name
$ rhc app delete App_Namerhc app delete App_Name
Warning
Delete the local application data with the following command:
rm -rf ~/path/to/app_directory/
$ rm -rf ~/path/to/app_directory/rm -rf ~/path/to/app_directory/
Chapter 12. Cartridge Management Copy linkLink copied to clipboard!
12.1. Viewing Available Cartridges Copy linkLink copied to clipboard!
rhc cartridge list
$ rhc cartridge list
12.2. Adding a Cartridge to an Application Copy linkLink copied to clipboard!
Option | Description |
---|---|
-a, --app [NAME] | Name of an application. |
-n, --namespace [NAME] | Name of a domain. |
-e, --env [VARIABLE=VALUE] | Environment variable(s) to be set on this cartridge. It can also be a path to a file that contains the environment variables. |
-g, --gear-size [SIZE] | Gear size determines how much memory and CPU a cartridge consumes. |
-c, --cartridge [CART_TYPE] | Type of cartridge to add to an application. |
rhc cartridge add Cart_Name -a App_Name
$ rhc cartridge add Cart_Name -a App_Namerhc cartridge add Cart_Name -a App_Namerhc cartridge add Cart_Name -a App_Namerhc cartridge add Cart_Name -a App_Name
When adding a cartridge to an application, specify the cartridge gear size with the -g
, or --gear-size
option along with the gear size. Note that this option is not available with non-scalable applications, because the web cartridge and any add-on cartridges are placed on the same gear.
rhc cartridge add Cart_Name -a App_Name -g gear_size
$ rhc cartridge add Cart_Name -a App_Name -g gear_sizerhc cartridge add Cart_Name -a App_Name -g gear_sizerhc cartridge add Cart_Name -a App_Name -g gear_sizerhc cartridge add Cart_Name -a App_Name -g gear_sizerhc cartridge add Cart_Name -a App_Name -g gear_sizerhc cartridge add Cart_Name -a App_Name -g gear_size
12.3. Viewing Cartridges for an Application Copy linkLink copied to clipboard!
rhc app show App_Name
$ rhc app show App_Namerhc app show App_Name
Example 12.1. List of Cartridges for an Application
12.4. Cartridge Management Commands Copy linkLink copied to clipboard!
rhc cartridge
command, with the following syntax:
rhc cartridge Action Cart_Type -a App_Name
$ rhc cartridge Action Cart_Type -a App_Namerhc cartridge Action Cart_Type -a App_Namerhc cartridge Action Cart_Type -a App_Namerhc cartridge Action Cart_Type -a App_Name
Action | Details |
---|---|
list | List supported cartridges. |
add | Add a cartridge. |
remove | Remove a cartridge. |
stop | Stop a cartridge. |
start | Start a cartridge. |
restart | Restart a cartridge. |
status | Return the current status of a cartridge. |
reload | Reload the configuration of a cartridge. |
show | Show information about a cartridge. |
storage | View and manipulate storage on a cartridge. |
scale | Set the scaling range of a cartridge. |
Option | Description |
---|---|
-n, --namespace [NAME] | Name of a domain. |
-a, --app [NAME] | Name of an application. |
-c, --cartridge [CART_TYPE] | Name of cartridge. |
-l, --rhlogin [LOGIN] | OpenShift Enterprise user account. |
-p, --password [PASSWORD] | OpenShift Enterprise account password. |
Example 12.2. Stopping a Cartridge
rhc cartridge stop php -a mynewapp
$ rhc cartridge stop php -a mynewapp
Using php-5.4 (PHP 5.4) for 'php'
Stopping php-5.4 ... done
Chapter 13. Build and Deployment Copy linkLink copied to clipboard!
13.1. Introduction to Deployment Copy linkLink copied to clipboard!
Deployment Step | Description |
---|---|
Pre-build | This occurs when the git push command is run, but before the push is fully committed. |
Build | This builds an application, downloads required dependencies, executes the .openshift/action_hooks/build script and prepares everything for deployment. |
Deploy | This performs any required tasks necessary to prepare the application for starting, including running the .openshift/action_hooks/deploy script. This step occurs immediately before the application is issued a start command. |
Post-deploy | This step enables interaction with the running application, including running the .openshift/action_hooks/post_deploy script. This step occurs immediately after the application is restarted. |
13.2. Preparing an Application for Deployment Copy linkLink copied to clipboard!
App_Name/php/
directory. The following instructions describe how to prepare an application for deployment.
Procedure 13.1. To Prepare an Application for Deployment:
- Add each new file and directory to the Git index:
git add path/to/newfile
$ git add path/to/newfile
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Commit an application to the local repository:
git commit -m "commit message"
$ git commit -m "commit message"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
13.3. Deployment Mechanisms Copy linkLink copied to clipboard!
13.3.1. Automatic Deployment Copy linkLink copied to clipboard!
git commit git push
$ git commit
$ git push
git push
command sends the application data to the remote repository and automatically deploys the application. The application automatically stops, builds, and restarts when the code changes are pushed to the remote server.
13.3.1.1. Configuring Automatic Deployment Copy linkLink copied to clipboard!
rhc configure-app -a App_Name --auto-deploy
$ rhc configure-app -a App_Name --auto-deploy
13.3.2. Manual Deployment Copy linkLink copied to clipboard!
13.3.2.1. Configuring Manual Deployment Copy linkLink copied to clipboard!
rhc configure-app -a App_Name --no-auto-deploy
$ rhc configure-app -a App_Name --no-auto-deployrhc configure-app -a App_Name --no-auto-deployrhc configure-app -a App_Name --no-auto-deploy
git push
command is run, the application data is only pushed to the remote repository; the application is not deployed.
13.3.2.2. Preserving Deployments Copy linkLink copied to clipboard!
rhc configure-app -a App_Name --keep-deployments No_of_Deps
$ rhc configure-app -a App_Name --keep-deployments No_of_Deps rhc configure-app -a App_Name --keep-deployments No_of_Deps rhc configure-app -a App_Name --keep-deployments No_of_Deps rhc configure-app -a App_Name --keep-deployments No_of_Deps rhc configure-app -a App_Name --keep-deployments No_of_Deps
13.3.2.3. Deploying from a Git Branch Copy linkLink copied to clipboard!
rhc configure-app -a App_Name deployment-branch Git_Branch
$ rhc configure-app -a App_Name deployment-branch Git_Branchrhc configure-app -a App_Name deployment-branch Git_Branchrhc configure-app -a App_Name deployment-branch Git_Branchrhc configure-app -a App_Name deployment-branch Git_Branch
13.3.2.4. Deploying from a Snapshot Copy linkLink copied to clipboard!
Procedure 13.2. To Deploy From a Snapshot:
- Save an application snapshot to build a deployable .tar.gz artifact:
rhc save-snapshot App_Name --deployment
$ rhc save-snapshot App_Name --deploymentrhc save-snapshot App_Name --deploymentrhc save-snapshot App_Name --deployment
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Configure the application for binary artifact deployments:Note that this command changes the application's deployment process and disables the
rhc configure-app App_Name --deployment-type binary
$ rhc configure-app App_Name --deployment-type binaryrhc configure-app App_Name --deployment-type binaryrhc configure-app App_Name --deployment-type binaryrhc configure-app App_Name --deployment-type binary
Copy to Clipboard Copied! Toggle word wrap Toggle overflow git push
command. - Deploy the application using the binary artifact that was created:Alternatively, use the following command to deploy from a URL:
rhc deploy ./app.tar.gz -a App_Name
$ rhc deploy ./app.tar.gz -a App_Namerhc deploy ./app.tar.gz -a App_Name
Copy to Clipboard Copied! Toggle word wrap Toggle overflow rhc deploy http://foo.com/path/to/file.tar.gz -a App_Name
$ rhc deploy http://foo.com/path/to/file.tar.gz -a App_Namerhc deploy http://foo.com/path/to/file.tar.gz -a App_Name
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
13.3.2.5. Viewing Previous Deployments Copy linkLink copied to clipboard!
rhc deployments App_Name
$ rhc deployments App_Namerhc deployments App_Name
13.3.2.6. Activating a Previous Deployment Copy linkLink copied to clipboard!
rhc activate-deployment -a App_Name Dep_ID
$ rhc activate-deployment -a App_Name Dep_IDrhc activate-deployment -a App_Name Dep_IDrhc activate-deployment -a App_Name Dep_IDrhc activate-deployment -a App_Name Dep_ID
13.4. Action Hooks Copy linkLink copied to clipboard!
13.4.1. Introduction to Action Hooks Copy linkLink copied to clipboard!
App_Name/.openshift/action_hooks
directory.
13.4.2. Cartridge Action Hooks Copy linkLink copied to clipboard!
App_Name/.openshift/action_hooks
directory with the same name as the desired event.
Action | Description | Event-specific examples |
---|---|---|
Start | Start the software the cartridge controls. | pre_start_Cart_Name, post_start_Cart_Name |
Stop | Stop the software the cartridge controls. | pre_stop_Cart_Name, post_stop_Cart_Name |
Reload | The cartridge and the package software will re-read the configuration information. | pre_reload_Cart_Name, post_reload_Cart_Name |
Restart | Current cartridge process is stopped and started again. | pre_restart_Cart_Name, post_restart_Cart_Name |
Tidy | All unused resources are released. | pre_tidy_Cart_Name, post_tidy_Cart_Name |
App_Name/.openshift/action_hooks/pre_start_jbossas
, edit it and add the desired information.
13.4.3. Build and Deployment Action Hooks Copy linkLink copied to clipboard!
- pre-build
- build
- deploy
- post-deploy
App_Name/.openshift/action_hooks
directory to use the build and deployment action hooks. For example, to use an action hook during the application build phase, create the file App_Name/.openshift/action_hooks/build
, edit it and add the following to the file's contents:
Example 13.1. Adding an Action Hook to the Build Process
echo Downloading my.zip... curl -o $OPENSHIFT_DATA_DIR/my.zip http://myserver/my.zip
echo Downloading my.zip...
curl -o $OPENSHIFT_DATA_DIR/my.zip
http://myserver/my.zip
git push
process.
13.4.4. Scaling Action Hooks Copy linkLink copied to clipboard!
haproxy_ctld
daemon. The haproxy_ctld.rb
script, which changes the thresholds and algorithms used to control scale up and down behavior, can be customized for use as an action hook in scalable applications.
Procedure 13.3. To Customize Automatic Scaling for an Application:
- Use SSH to connect to a scalable application and consult the generic
~/haproxy/usr/bin/haproxy_ctld.rb
script for detailed usage information. - Copy the file to the Git repository of the application in the
App_Name/.openshift/action_hooks/
directory. - Ensure the file is executable:
chmod +x App_Name/.openshift/action_hooks/haproxy_ctld.rb
# chmod +x App_Name/.openshift/action_hooks/haproxy_ctld.rbchmod +x App_Name/.openshift/action_hooks/haproxy_ctld.rbchmod +x App_Name/.openshift/action_hooks/haproxy_ctld.rb
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Edit the file to the desired specifications.
- Deploy the changes. To ensure that the changes take effect immediately, the HAProxy cartridge restarts automatically during deployment if the
haproxy_ctld.rb
action hook is detected.
Example 13.2. Scaling Up Based on Memory Usage
~/haproxy/usr/bin/haproxy_ctld.rb
script by specifying the following parameters.
13.4.5. Metrics Action Hooks Copy linkLink copied to clipboard!
metrics
in the App_Name/.openshift/action_hooks
directory to use the metrics action hook.
A metrics message must include the following fields and be written to standard out (STDOUT):
type=metric <metric name>=<metric value>
type=metric <metric name>=<metric value>
Example 13.3. Metrics Message Example
type=metric thread.count=5
type=metric thread.count=5
13.5. Environment Variables Copy linkLink copied to clipboard!
13.5.1. Introduction to Environment Variables Copy linkLink copied to clipboard!
- Add an
export
statement to theApp_Name/.openshift/action_hooks/build
file, then rungit push
. The variables are listed in the Git output and start withremote: declare -x
. - Access the application with SSH and run the
env
command at the shell prompt.
13.5.2. Informational Environment Variables Copy linkLink copied to clipboard!
Environment Variable Name | Purpose |
---|---|
OPENSHIFT_APP_DNS | The fully-qualified domain namespace of the application. |
OPENSHIFT_APP_NAME | The name of the application. |
OPENSHIFT_APP_UUID | The UUID of the application (32 hexadecimal characters). |
OPENSHIFT_Cart_Name_IP | The IP address the application listens on. |
OPENSHIFT_Cart_Name_PORT | The port the application receives requests from. |
OPENSHIFT_SECRET_TOKEN | A 128-character string unique to an application that can be used for authentication, and can be overridden with the rhc env set command. |
13.5.3. Directory Environment Variables Copy linkLink copied to clipboard!
Environment Variable Name | Purpose |
---|---|
OPENSHIFT_HOMEDIR | The home directory of the application. |
OPENSHIFT_DATA_DIR | A persistent data directory. |
OPENSHIFT_REPO_DIR | Repository containing the currently deployed version of the application. |
OPENSHIFT_TMP_DIR | A temporary directory you can use; SELinux protects data in this directory from other users. |
OPENSHIFT_LOG_DIR | Where all cartridge logs are stored. |
Note
OPENSHIFT_DATA_DIR
. Therefore, Red Hat recommends that you store persistent files in the OPENSHIFT_DATA_DIR
directory.
13.5.4. Logging Environment Variables Copy linkLink copied to clipboard!
OPENSHIFT_LOG_DIR
directory of an application, log files are rolled if their file size exceeds a configurable threshold. A configurable number of rolled files are retained before the oldest file is removed prior to the next roll.
Environment Variable Name | Purpose |
---|---|
LOGSHIFTER_OUTPUT_TYPE | If permitted by your system administrator, overrides the default logging behavior. Set file to have logs written to the OPENSHIFT_LOG_DIR directory of the application, or set syslog to enable Syslog logging, if available. Starting in OpenShift Enterprise 2.1.7, set multi to enable both file and syslog at the same time. |
LOGSHIFTER_Cart_Name_MAX_FILESIZE | A case-insensitive string representing the maximum log file size that triggers a roll event. The default value is 10M . If a zero size is specified regardless of the unit, log rolling is effectively disabled. |
LOGSHIFTER_Cart_Name_MAX_FILES | An integer representing the maximum number of log files to retain. The default is 10 . |
Cart_Name
is a replaceable term used to represent the cartridge short-name. The LOGSHIFTER_Cart_Name_MAX_FILESIZE
variable accepts strings in kilobytes, megabytes, gigabytes, and terabytes. For example, for an application with a PHP cartridge, any of the following values would be valid:
- LOGSHIFTER_PHP_MAX_FILESIZE=500K
- LOGSHIFTER_PHP_MAX_FILESIZE=10M
- LOGSHIFTER_PHP_MAX_FILESIZE=2G
- LOGSHIFTER_PHP_MAX_FILESIZE=1T
13.5.5. Database Environment Variables Copy linkLink copied to clipboard!
Environment Variable Name | Purpose |
---|---|
OPENSHIFT_Cart_Name_DB_HOST | The host name or IP address used to connect to the database. |
OPENSHIFT_Cart_Name_DB_PORT | The port the database server is listening on. |
OPENSHIFT_Cart_Name_DB_USERNAME | The database administrative user name. |
OPENSHIFT_Cart_Name_DB_PASSWORD | The database administrative user's password. |
OPENSHIFT_Cart_Name_DB_SOCKET | An AF socket for connecting to the database (for non-scaled apps only). |
OPENSHIFT_Cart_Name_DB_URL | Database connection URL. |
13.5.6. Library Environment Variables Copy linkLink copied to clipboard!
Environment Variable Name | Purpose |
---|---|
OPENSHIFT_Cart_Name_LD_LIBRARY_PATH_ELEMENT | Configures the location of each cartridge's library file. |
Note
LD_LIBRARY_PATH
. However, cartridges may be competing for a place in the set directory. Configure the destination of each cartridge's files with OPENSHIFT_Cart_Name_LD_LIBRARY_PATH_ELEMENT
to merge each cartridge's library into the global directory. Note that the order that the files are entered into the global directory is add-on cartridges first, then web framework cartridges. Red Hat
recommends not changing the location of the LD_LIBRARY_PATH
environment variable.
13.5.7. Jenkins Environment Variables Copy linkLink copied to clipboard!
Environment Variable Name | Purpose |
---|---|
JENKINS_USERNAME | System builder account on the Jenkins server. |
JENKINS_PASSWORD | Password for the system builder account on the Jenkins server. |
JENKINS_URL | DNS name for the associated Jenkins server where builds occur. |
13.5.8. Gear Environment Variables Copy linkLink copied to clipboard!
Environment Variable Name | Purpose |
---|---|
OPENSHIFT_GEAR_DNS | The fully-qualified domain name of the gear. |
OPENSHIFT_GEAR_NAME | The name of the gear. |
OPENSHIFT_GEAR_UUID | The UUID of the gear. |
13.5.9. JBoss Environment Variables Copy linkLink copied to clipboard!
Environment Variable Name | Purpose |
---|---|
JAVA_OPTS | Controlled by the cartridge and used to specify additional arguments to the JVM where JBoss application will run. |
JAVA_OPTS_EXT | Appended to the JAVA_OPTS environment variable before the JVM is invoked, and used to provide additional options to the JVM without rewriting the JAVA_OPTS environment variable. This allows developers to better support their application users. |
DISABLE_OPENSHIFT_MANAGED_SERVER_CONFIG | Set to true and the standalone.xml file from the repository is ignored, as is the copy that was retained. |
/App_Name/.openshift/config/standalone.xml
file that is part of jbossas-7. The following example code shows the environment variables for a MySQL datasource connection URL in the form jdbc:mysql://SERVER_NAME:PORT/DATABASE_NAME:
<connection-url>jdbc:mysql://${env.OPENSHIFT_MYSQL_DB_HOST}:${env.OPENSHIFT_MYSQL_DB_PORT}/${env.OPENSHIFT_APP_NAME}</connection-url>
<connection-url>jdbc:mysql://${env.OPENSHIFT_MYSQL_DB_HOST}:${env.OPENSHIFT_MYSQL_DB_PORT}/${env.OPENSHIFT_APP_NAME}</connection-url>
Procedure 13.4. To Set Environment Variables on the Server:
- Open the
App_Name/.openshift/config/standalone.xml
file. - Specify the required values for any of your environment variables, then save and close the file.
- Commit and push the changes to the server:
git commit -a -m "COMMIT MESSAGE" git push
$ git commit -a -m "COMMIT MESSAGE"git commit -a -m "COMMIT MESSAGE"git commit -a -m "COMMIT MESSAGE" $ git push
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Important
rhc snapshot
commands.
Note
standalone.xml
file, it only edits the local gear's standalone.xml
file and not the repository one provided by your OpenShift cartridge template: App_Name/.openshift/config/standalone.xml
. Manual changes will be lost upon an application restart, and the last version of the repository standalone.xml
file will be used even if you remove the repository standalone.xml
file.
standalone.xml
file, set the DISABLE_OPENSHIFT_MANAGED_SERVER_CONFIG
environment variable to true
by running:
rhc env set DISABLE_OPENSHIFT_MANAGED_SERVER_CONFIG=true -a App_Name
# rhc env set DISABLE_OPENSHIFT_MANAGED_SERVER_CONFIG=true -a App_Name
13.5.10. Ruby Environment Variables Copy linkLink copied to clipboard!
Environment Variable Name | Purpose |
---|---|
OPENSHIFT_RUBY_LOG_DIR | Where cartridge-specific logs are stored. |
BUNDLE_WITHOUT | Prevents Bundler from installing certain groups specified in the Gemfile. |
13.5.11. Python Environment Variables Copy linkLink copied to clipboard!
Environment Variable name | Purpose |
---|---|
OPENSHIFT_PYTHON_WSGI_APPLICATION | Sets a custom path for the WSGI entry point. |
OPENSHIFT_PYTHON_REQUIREMENTS_PATH | Sets a custom path for the pip requirements file. When git push is run, any dependencies listed in the requirements.txt file will be installed by the Python cartridge. |
13.5.12. Custom Environment Variables Copy linkLink copied to clipboard!
Set one of more environment variables for an application with the following command:
rhc env set Variable=Value Variable2=Value2 -a App_Name
$ rhc env set Variable=Value Variable2=Value2 -a App_Namerhc env set Variable=Value Variable2=Value2 -a App_Namerhc env set Variable=Value Variable2=Value2 -a App_Namerhc env set Variable=Value Variable2=Value2 -a App_Namerhc env set Variable=Value Variable2=Value2 -a App_Namerhc env set Variable=Value Variable2=Value2 -a App_Name
View the custom environment variables set for an application with the following command:
rhc env list -a App_Name
$ rhc env list -a App_Namerhc env list -a App_Name
Display the value of one or more custom environment variables with the following command:
rhc env show Variable Variable2 -a App_Name
$ rhc env show Variable Variable2 -a App_Namerhc env show Variable Variable2 -a App_Namerhc env show Variable Variable2 -a App_Namerhc env show Variable Variable2 -a App_Name
Remove a custom environment variable with the following command:
rhc env unset Variable -a App_Name
$ rhc env unset Variable -a App_Namerhc env unset Variable -a App_Namerhc env unset Variable -a App_Namerhc env unset Variable -a App_Name
13.6. Hot Deployment Copy linkLink copied to clipboard!
13.6.1. Introduction to Hot Deployment Copy linkLink copied to clipboard!
git push
command is run to upload code modifications, OpenShift Enterprise stops, builds, deploys, and restarts an application. This entire process takes time to complete and is unnecessary for many types of code changes. With hot deployment the changes to application code are applied without restarting the application cartridge, resulting in increased deployment speed and minimized application downtime.
hot_deploy
marker file. If the marker is present, supported application cartridges automatically hot deploy when the git push
command is executed.
Type of Application | Hot Deploy |
---|---|
JBoss Application Server | Yes |
JBoss Enterprise Application Platform | Yes |
Tomcat 6 (JBoss Enterprise Web Server 1.0) | Yes |
Tomcat 7 (JBoss Enterprise Web Server 2.0) | Yes |
PHP | Yes |
Perl | Yes |
Ruby | Yes |
Python | Yes |
Node.js | Yes |
Zend Server | Yes |
Jenkins | No |
HAProxy | No |
DIY | No |
13.6.2. Hot Deployment Build Details Copy linkLink copied to clipboard!
When JBoss AS, JBoss EAP, Tomcat 6, and Tomcat 7 applications are hot deployed, the Maven build is executed (either with Jenkins or without), but the server does not restart. Following the build, the JBoss HDScanner notices any modifications and redeploys them. If previously deployed artifacts are removed as part of the update, they are undeployed automatically.
When PHP, Perl, Python, and Node.js applications are hot deployed, the application code is built (dependencies are processed and user build action_hooks are run) and deployed to the application server. The server does not restart. This is true regardless of whether an application has Jenkins enabled or not. For applications that have Jenkins enabled, the build is performed on a Jenkins slave instance and then synced to the gear(s) where the application server is running.
When a Ruby application is hot deployed, the Passenger restart.txt
file is touched, and the application server serves the new code without requiring a full server restart. See the Passenger Documentation for more information.
13.6.3. Enabling and Disabling Hot Deployment Copy linkLink copied to clipboard!
Enable hot deployment by creating the hot_deploy
marker file in the application's root directory with the following command:
copy NUL > .openshift\markers\hot_deploy
C:\app_directory> copy NUL > .openshift\markers\hot_deploy
hot_deploy
marker file from the application's root directory:
del .openshift\markers\hot_deploy
C:\app_directory> del .openshift\markers\hot_deploy
hot_deploy
marker file in the application's root directory:
touch .openshift/markers/hot_deploy
[user@user app_directory]$ touch .openshift/markers/hot_deploy
hot_deploy
marker file from the application's root directory:
rm .openshift/markers/hot_deploy
[user@user app_directory]$ rm .openshift/markers/hot_deploy
13.7. Jenkins Continuous Integration Copy linkLink copied to clipboard!
13.7.1. Introduction to Jenkins Copy linkLink copied to clipboard!
git push
command initiates a build process inside Jenkins. For custom applications, or applications that have no upstream repositories, the build process is initiated directly from the Jenkins web interface rather than with the git push
command.
- Archived build information
- No application downtime during the build process
- Failed builds are not deployed; instead, a previous working version is left in place
- Additional memory and storage resources are available
- A large community of Jenkins plug-ins
13.7.2. Configuring Jenkins Copy linkLink copied to clipboard!
13.7.2.1. Configuring Jenkins with New Applications Copy linkLink copied to clipboard!
--jenkins-enable
option:
rhc app create App_Name App_Type --enable-jenkins Jenkins_App_Name
$ rhc app create App_Name App_Type --enable-jenkins Jenkins_App_Namerhc app create App_Name App_Type --enable-jenkins Jenkins_App_Namerhc app create App_Name App_Type --enable-jenkins Jenkins_App_Namerhc app create App_Name App_Type --enable-jenkins Jenkins_App_Namerhc app create App_Name App_Type --enable-jenkins Jenkins_App_Namerhc app create App_Name App_Type --enable-jenkins Jenkins_App_Name
-s
to create a scalable application.
See Also:
13.7.2.2. Configuring Jenkins with Existing Applications Copy linkLink copied to clipboard!
Procedure 13.5. To Configure Jenkins with an Existing Application:
- Create the Jenkins application:
rhc app create App_Name jenkins-1
$ rhc app create App_Name jenkins-1rhc app create App_Name jenkins-1rhc app create App_Name jenkins-1
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example 13.4. Creating Jenkins Applications
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Add the Jenkins client cartridge to the specified application:
rhc cartridge add jenkins-client-1 -a App_Name
$ rhc cartridge add jenkins-client-1 -a App_Namerhc cartridge add jenkins-client-1 -a App_Name
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example 13.5. Adding Jenkins Client to Application
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
13.7.3. Building Applications with Jenkins Copy linkLink copied to clipboard!
- The
git push
command is executed, and Jenkins is notified that a new push is ready. - A dedicated Jenkins slave (a builder) is created. The
rhc apps
command shows slave information. The application name is the same as that of the originating application, but with a.bldr
suffix.Important
The first 28 characters of the application name must be unique to avoid build issues that are caused when builders are shared across applications. - Jenkins runs the build.
- Content from the originating application is downloaded to the builder application using
git
(for source code) andrsync
(for existing libraries). ci_build.sh
is called from the Jenkins shell. This sets up the builder application for the Jenkins environment and performs some built-in bundling steps (PHP pear processing, Python virtual environment, etc)..openshift/action_hooks/build
is executed on the Jenkins builder.- Any additional desired steps are executed from the Jenkins shell (Maven build, Gem install, test cases, etc).
- Jenkins stops the currently running application, and runs
rsync
to synchronize all new content over to the originating application. .openshift/action_hooks/deploy
is executed on the originating application.- Jenkins starts the originating application, and
.openshift/action_hooks/post_deploy
is executed on this application. - Jenkins archives all build artifacts for later reference.
- After 15 minutes of idle time, the "build app" will be destroyed and will no longer appear in the output of the
rhc apps
command. The build artifacts, however, will still exist in Jenkins and can be viewed there.
rhc tail jenkins
$ rhc tail jenkinsrhc tail jenkins
rhc tail App_Name
$ rhc tail App_Namerhc tail App_Name
13.7.3.1. Building Custom Applications Copy linkLink copied to clipboard!
git push
command.

Chapter 14. Gear Storage and Disk Space Management Copy linkLink copied to clipboard!
14.1. Introduction to Gear Storage and Disk Space Copy linkLink copied to clipboard!
Note
14.2. Viewing Gear Storage Copy linkLink copied to clipboard!
rhc cartridge storage --show -a App_Name
$ rhc cartridge storage --show -a App_Namerhc cartridge storage --show -a App_Name
Example 14.1. Viewing Gear Storage
-c
option to specify the cartridge:
rhc cartridge storage --show -a App_Name -c Cart_Name
$ rhc cartridge storage --show -a App_Name -c Cart_Namerhc cartridge storage --show -a App_Name -c Cart_Namerhc cartridge storage --show -a App_Name -c Cart_Namerhc cartridge storage --show -a App_Name -c Cart_Name
Example 14.2. Viewing Gear Storage for a Specific Cartridge
14.3. Adding Gear Storage Copy linkLink copied to clipboard!
rhc cartridge storage Cart_Name -a App_Name --add Storage_Amount(GB)
$ rhc cartridge storage Cart_Name -a App_Name --add Storage_Amount(GB)rhc cartridge storage Cart_Name -a App_Name --add Storage_Amount(GB)rhc cartridge storage Cart_Name -a App_Name --add Storage_Amount(GB)rhc cartridge storage Cart_Name -a App_Name --add Storage_Amount(GB)rhc cartridge storage Cart_Name -a App_Name --add Storage_Amount(GB)rhc cartridge storage Cart_Name -a App_Name --add Storage_Amount(GB)
Example 14.3. Adding Gear Storage
14.4. Setting Gear Storage Copy linkLink copied to clipboard!
--set
option.
rhc cartridge storage php-5 -a App_Name --set Storage_Amount(GB)
$ rhc cartridge storage php-5 -a App_Name --set Storage_Amount(GB)rhc cartridge storage php-5 -a App_Name --set Storage_Amount(GB)rhc cartridge storage php-5 -a App_Name --set Storage_Amount(GB)rhc cartridge storage php-5 -a App_Name --set Storage_Amount(GB)rhc cartridge storage php-5 -a App_Name --set Storage_Amount(GB)rhc cartridge storage php-5 -a App_Name --set Storage_Amount(GB)
Example 14.4. Setting Gear Storage
--add
option because the exact amount of gear storage is specified, rather than adding more storage to the existing amount.
14.5. Removing Gear Storage Copy linkLink copied to clipboard!
rhc cartridge storage Cart_Name -a App_Name --remove Storage_Amount(GB)
$ rhc cartridge storage Cart_Name -a App_Name --remove Storage_Amount(GB)rhc cartridge storage Cart_Name -a App_Name --remove Storage_Amount(GB)rhc cartridge storage Cart_Name -a App_Name --remove Storage_Amount(GB)rhc cartridge storage Cart_Name -a App_Name --remove Storage_Amount(GB)rhc cartridge storage Cart_Name -a App_Name --remove Storage_Amount(GB)rhc cartridge storage Cart_Name -a App_Name --remove Storage_Amount(GB)
Example 14.5. Removing Gear Storage
14.6. Tidying an Application Copy linkLink copied to clipboard!
- Run the
git gc
command on the application's Git repository on the server. - Clear the application's
/tmp
and log file directories that are specified by the application'sOPENSHIFT_LOG_DIR
andOPENSHIFT_TMP_DIR
environment variables. - Clear unused application libraries and remove any library files previously installed by a
git push
command.
Important
rm -rf
command to clear the contents of these directories. Before performing this step, save the log files by creating a snapshot of the system with the rhc snapshot save
command.
rhc app tidy App_Name
$ rhc app tidy App_Namerhc app tidy App_Name
Chapter 15. Application Backup and Restoration with Snapshots Copy linkLink copied to clipboard!
15.1. Introduction to Snapshots Copy linkLink copied to clipboard!
tar.gz
files, which contain the application and all local files, including log files.
Important
A binary deployment file is a snapshot of an application used for deployment without using Git. Each snapshot has the same top-level structure:
build-dependencies/ dependencies/ repo/
build-dependencies/
dependencies/
repo/
repo
directory are the files that make up the application source code. The contents of the build-dependencies
and dependencies
directories are cartridge-specific, and are determined by the contents of the managed_files.yml
file.
managed_files.yml
file dictates the construction of the snapshot:
- If an entry under dependency_dirs starts with ~/, then a new folder will be created in the
dependencies
directory. - If an entry under dependency_dirs does not start with ~/, then a directory will be created in the
dependencies/Cartridge_Name
directory. - If an entry under dependency_dirs has the format
key: Value
, thenValue
will be the directory name for the previous rules.
Example 15.1. A Sample Node.js managed_files.yml
File
managed_files.yml
file on a Node.js cartridge:
dependency_dirs: - ~/.npm - node_modules - ~/.node_modules: node_modules
dependency_dirs:
- ~/.npm
- node_modules
- ~/.node_modules: node_modules
.npm
file will be in the dependencies
directory, and the node_modules
file will be in the cartridge dependencies directory dependencies/nodejs
directory:
.npm nodejs/node_modules
.npm
nodejs/node_modules
build_dependencies
in the managed_files.yml
file, though the build_dependencies
file is mainly used in JBoss cartridges.
managed_files.yml
file for deployment. See Section 13.1, “Introduction to Deployment” for information on deployment, and Section 13.3.2.4, “Deploying from a Snapshot” for information on deploying from a binary snapshot file.
15.2. Creating an Application Snapshot Copy linkLink copied to clipboard!
rhc snapshot save App_Name
$ rhc snapshot save App_Namerhc snapshot save App_Name
Example 15.2. Creating an Application Snapshot
$App_Name.tar.gz
and is created in your current directory. Choose a different filename or file path by using the --filepath
option to override the defaults.
15.3. Restoring from an Application Snapshot Copy linkLink copied to clipboard!
git push
was run.
Warning
rhc snapshot restore
command overwrites the remote Git repository. Therefore, any changes made since taking the snapshot are lost. Importing snapshot data into a local environment can delete local content, for example a user table in a database. If you are unsure of the effect a snapshot import could have on local data, use SSH to access an application and create the backup directly.
rhc snapshot restore App_Name
$ rhc snapshot restore App_Namerhc snapshot restore App_Name
Example 15.3. Restoring from an Application Snapshot
rhc snapshot restore App_Name --filepath Renamed_App
$ rhc snapshot restore App_Name --filepath Renamed_Apprhc snapshot restore App_Name --filepath Renamed_Apprhc snapshot restore App_Name --filepath Renamed_Apprhc snapshot restore App_Name --filepath Renamed_App
15.4. Migrating an Application to Another Gear Copy linkLink copied to clipboard!
Procedure 15.1. To Migrate an Application to Another Gear:
- Create a snapshot of an existing application:
rhc snapshot save App_Name
$ rhc snapshot save App_Namerhc snapshot save App_Name
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Verify that the
App_Name.tar.gz
file has been created in the working directory. After confirming the application snapshot is saved, delete the existing application:rhc app delete App_Name
$ rhc app delete App_Namerhc app delete App_Name
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Create a new application using the same cartridges, but with the correct gear size:
rhc app create App_Name Cart_Name -g gear_size
$ rhc app create App_Name Cart_Name -g gear_sizerhc app create App_Name Cart_Name -g gear_sizerhc app create App_Name Cart_Name -g gear_sizerhc app create App_Name Cart_Name -g gear_sizerhc app create App_Name Cart_Name -g gear_sizerhc app create App_Name Cart_Name -g gear_size
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Finally, restore the previously saved application snapshot to the newly created application. Be sure to specify the correct path to the saved application snapshot:
rhc snapshot restore App_Name -f App_Name.tar.gz
$ rhc snapshot restore App_Name -f App_Name.tar.gzrhc snapshot restore App_Name -f App_Name.tar.gzrhc snapshot restore App_Name -f App_Name.tar.gzrhc snapshot restore App_Name -f App_Name.tar.gzrhc snapshot restore App_Name -f App_Name.tar.gz
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Appendix A. Revision History Copy linkLink copied to clipboard!
Revision History | |||||||
---|---|---|---|---|---|---|---|
Revision 2.2-6 | Thu Jun 15 2017 | ||||||
| |||||||
Revision 2.2-5 | Thu Sep 08 2016 | ||||||
| |||||||
Revision 2.2-4 | Thu Aug 20 2015 | ||||||
| |||||||
Revision 2.2-3 | Tue Jun 09 2015 | ||||||
| |||||||
Revision 2.2-2 | Wed Dec 03 2014 | ||||||
| |||||||
Revision 2.2-0 | Tue Nov 4 2014 | ||||||
| |||||||
Revision 2.1-7 | Thu Oct 23 2014 | ||||||
| |||||||
Revision 2.1-6 | Thu Oct 2 2014 | ||||||
| |||||||
Revision 2.1-5 | Tue Aug 26 2014 | ||||||
| |||||||
Revision 2.1-3 | Mon Aug 11 2014 | ||||||
| |||||||
Revision 2.1-2 | Thu Jun 26 2014 | ||||||
| |||||||
Revision 2.1-1 | Thu Jun 5 2014 | ||||||
| |||||||
Revision 2.1-0 | Fri May 16 2014 | ||||||
Revision 2.0-1 | Thu Feb 27 2014 | ||||||
| |||||||
Revision 2.0-0 | Mon Dec 9 2013 | ||||||
|
Legal Notice
Copyright © 2025 Red Hat
OpenShift documentation is licensed under the Apache License 2.0 (https://www.apache.org/licenses/LICENSE-2.0).
Modified versions must remove all Red Hat trademarks.
Portions adapted from https://github.com/kubernetes-incubator/service-catalog/ with modifications by Red Hat.
Red Hat, Red Hat Enterprise Linux, the Red Hat logo, the Shadowman logo, JBoss, OpenShift, Fedora, the Infinity logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States and other countries.
Linux® is the registered trademark of Linus Torvalds in the United States and other countries.
Java® is a registered trademark of Oracle and/or its affiliates.
XFS® is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United States and/or other countries.
MySQL® is a registered trademark of MySQL AB in the United States, the European Union and other countries.
Node.js® is an official trademark of Joyent. Red Hat Software Collections is not formally related to or endorsed by the official Joyent Node.js open source or commercial project.
The OpenStack® Word Mark and OpenStack logo are either registered trademarks/service marks or trademarks/service marks of the OpenStack Foundation, in the United States and other countries and are used with the OpenStack Foundation’s permission. We are not affiliated with, endorsed or sponsored by the OpenStack Foundation, or the OpenStack community.
All other trademarks are the property of their respective owners.