Openshift Online 1 User Guide: Managing Applications in The Cloud With Openshift Online Edition 1.0
Openshift Online 1 User Guide: Managing Applications in The Cloud With Openshift Online Edition 1.0
Openshift Online 1 User Guide: Managing Applications in The Cloud With Openshift Online Edition 1.0
User Guide
This document is licensed by Red Hat under the Creative Commons Attribution-ShareAlike 3.0 Unported
License. If you distribute this document, or a modified version of it, you must provide attribution to Red
Hat, Inc. and provide a link to the original. If the document is modified, all Red Hat trademarks must be
removed.
Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert, Section
4d of CC-BY-SA to the fullest extent permitted by applicable law.
Red Hat, Red Hat Enterprise Linux, the Shadowman logo, JBoss, MetaMatrix, Fedora, OpenShift, 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.
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.
Table of Contents
.Preface
...............................................................................6
.........
1. Document Conventions 6
1.1. Typographic Conventions 6
1.2. Pull-quote Conventions 7
1.3. Notes and Warnings 8
2. Getting Help 8
2.1. Do You Need Help? 8
2.2. We Need Feedback! 9
.Chapter
. . . . . . .1.. .Introduction
. . . . . . . . . . .to
. . OpenShift
. . . . . . . . . Online
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
..........
1.1. Basic Architecture 10
1.2. Subscription Plans 10
1.3. User Interfaces 11
1.3.1. Management Console 11
1.3.2. Client Tools 12
1.4. What's New in Current Release 13
.Chapter
. . . . . . .2.. .Getting
. . . . . . .Started
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
..........
2.1. OpenShift Account 14
2.2. Client Tools 14
2.3. Basic Administration 14
2.3.1. Viewing Account Information 14
2.3.2. Ending Current Session 14
.Chapter
. . . . . . .3.. .Authentication
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
..........
3.1. Authorization Tokens 16
3.1.1. Introduction to Authorization Tokens 16
3.1.2. Creating Authorization Tokens 16
3.1.3. Viewing Authorization Tokens 17
3.1.4. Deleting Authorization Tokens 17
3.2. SSH Keys 18
3.2.1. Introduction to SSH Keys 18
3.2.2. Generating Keys Manually 18
3.2.3. Adding a Key 19
3.2.3.1. Adding a Specific SSH Key Type 19
3.2.4. Viewing All Public Keys 19
3.2.5. Viewing a Specific Public Key 20
3.2.6. Deleting a Key 20
3.2.7. Resolving Authentication Issues 20
3.2.7.1. Resolving Issues with Interactive Setup Wizard 20
.Chapter
. . . . . . .4.. .Domains
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
..........
4.1. Introduction to Domains 22
4.2. Domain Management 22
4.2.1. Creating a Domain 22
4.2.2. Listing Available Domains 22
4.2.3. Viewing a Domain 23
4.2.4. Renaming a Domain 24
4.2.5. Deleting a Domain 24
.Chapter
. . . . . . .5.. .Teams
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
..........
5.1. Introduction to Teams 26
1
OpenShift Online 1 User Guide
.Chapter
. . . . . . .6.. .Domain
. . . . . . .Membership
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
..........
6.1. Introduction to Domain Membership 27
6.2. Managing Domain Membership 27
6.2.1. Adding a Member 27
6.2.2. Changing Member Role 27
6.2.3. Listing Members of a Domain 28
6.2.4. Listing Members of an Application 29
6.2.5. Removing a Member 29
.Chapter
. . . . . . .7.. .Custom
. . . . . . .Domains
. . . . . . . .and
. . . .SSL
. . . Certificates
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
..........
7.1. Introduction to Custom Domains and SSL Certificates 30
7.2. Managing Custom Domain Names 30
7.3. Managing Custom SSL Certificates 31
.Chapter
. . . . . . .8.. .Cartridges
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
..........
8.1. Introduction to Cartridges 32
8.1.1. Web Framework Cartridges 32
8.1.2. Add-on Cartridges 32
8.1.3. Downloadable Cartridges 33
.Chapter
. . . . . . .9.. .Applications
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
..........
9.1. Introduction to Applications 35
9.1.1. Application Life Cycle 35
9.1.2. Scalable and Non-Scalable Applications 36
.Chapter
. . . . . . .10.
. . .Application
. . . . . . . . . . Management
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
..........
10.1. General Information 38
10.2. Creating an Application 38
10.3. Cloning an Existing Application 42
10.4. Cloning the Remote Application Repository 43
10.5. Viewing Applications for a User 43
10.6. Scaling an Application Manually 44
10.7. Application Management Commands 45
10.8. Managing Applications in a Secure Shell Environment 46
10.8.1. Introduction to Secure Shell Environment 46
10.8.2. Accessing an Application 47
10.8.3. Accessing a Specific Gear 48
10.8.4. Accessing a Database Cartridge 49
10.9. Monitoring Gear and Cartridge Status with Watchman 50
10.10. Embedding 10gen MMS Agent 51
10.11. Scheduling Cron Jobs 51
10.12. Binding Applications to Ports 52
10.12.1. Configuring WebSocket Ports 54
10.12.2. Configuring Email Ports 54
10.13. Port Forwarding 54
10.13.1. Introduction to Port Forwarding 54
10.13.2. Application Port Forwarding 55
10.13.3. Gear Port Forwarding 56
10.13.4. Port Forwarding on Mac OS X 56
10.14. Deleting an Application 57
.Chapter
. . . . . . .11.
. . .Cartridge
. . . . . . . . Management
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
..........
11.1. Viewing Available Cartridges 59
11.2. Adding a Cartridge to an Application 59
11.3. Viewing Cartridges for an Application 60
11.4. Cartridge Management Commands 60
2
Table of Contents
.Chapter
. . . . . . .12.
. . .Build
. . . . .and
. . . Deployment
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
..........
12.1. Introduction to Deployment 62
12.2. Preparing an Application for Deployment 62
12.3. Deployment Mechanisms 63
12.3.1. Automatic Deployment 63
12.3.1.1. Configuring Automatic Deployment 63
12.3.2. Manual Deployment 63
12.3.2.1. Configuring Manual Deployment 63
12.3.2.2. Preserving Deployments 63
12.3.2.3. Deploying from a Git Branch 64
12.3.2.4. Deploying from a Snapshot 64
12.3.2.5. Viewing Previous Deployments 64
12.3.2.6. Activating a Previous Deployment 65
12.4. Action Hooks 65
12.4.1. Introduction to Action Hooks 65
12.4.2. Cartridge Action Hooks 65
12.4.3. Build and Deployment Action Hooks 66
12.4.4. Scaling Action Hooks 66
12.5. Environment Variables 67
12.5.1. Introduction to Environment Variables 67
12.5.2. Informational Environment Variables 67
12.5.3. Directory Environment Variables 67
12.5.4. Logging Environment Variables 68
12.5.5. Database Environment Variables 68
12.5.6. Library Environment Variables 69
12.5.7. Jenkins Environment Variables 69
12.5.8. Gear Environment Variables 70
12.5.9. JBoss Environment Variables 70
12.5.10. Ruby Environment Variables 71
12.5.11. Python Environment Variables 72
12.5.12. Custom Environment Variables 72
12.6. Hot Deployment 72
12.6.1. Introduction to Hot Deployment 72
12.6.2. Hot Deployment Build Details 73
12.6.3. Enabling and Disabling Hot Deployment 74
12.7. Jenkins Continuous Integration 74
12.7.1. Introduction to Jenkins 74
12.7.2. Configuring Jenkins 75
12.7.2.1. Configuring Jenkins with New Applications 75
12.7.2.2. Configuring Jenkins with Existing Applications 75
12.7.3. Building Applications with Jenkins 76
12.7.3.1. Building Custom Applications 77
.Chapter
. . . . . . .13.
. . .Gear
. . . . Storage
. . . . . . . and
. . . . Disk
. . . . Space
. . . . . . Management
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
..........
13.1. Introduction to Gear Storage and Disk Space 78
13.2. Viewing Gear Storage 78
13.3. Adding Gear Storage 79
13.4. Setting Gear Storage 79
13.5. Removing Gear Storage 80
13.6. Tidying an Application 80
.Chapter
. . . . . . .14.
. . .Application
. . . . . . . . . . Backup
. . . . . . . and
. . . .Restoration
. . . . . . . . . . with
. . . . Snapshots
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
..........
14.1. Introduction to Snapshots 82
14.2. Creating an Application Snapshot 82
14.3. Restoring from an Application Snapshot 82
14.4. Migrating an Application to Another Gear 83
3
OpenShift Online 1 User Guide
. . . . . . . . History
Revision . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
..........
4
Table of Contents
5
OpenShift Online 1 User Guide
Preface
1. Document Conventions
This manual uses several conventions to highlight certain words and phrases and draw attention to
specific pieces of information.
In PDF and paper editions, this manual uses typefaces drawn from the Liberation Fonts set. The
Liberation Fonts set is also used in HTML editions if the set is installed on your system. If not, alternative
but equivalent typefaces are displayed. Note: Red Hat Enterprise Linux 5 and later include the Liberation
Fonts set by default.
Mono-spaced Bold
Used to highlight system input, including shell commands, file names and paths. Also used to highlight
keys and key combinations. For example:
The above includes a file name, a shell command and a key, all presented in mono-spaced bold and all
distinguishable thanks to context.
Key combinations can be distinguished from an individual key by the plus sign that connects each part of
a key combination. For example:
The first example highlights a particular key to press. The second example highlights a key combination:
a set of three keys pressed simultaneously.
If source code is discussed, class names, methods, functions, variable names and returned values
mentioned within a paragraph will be presented as above, in m ono-spaced bold. For example:
File-related classes include filesystem for file systems, file for files, and dir for
directories. Each class has its own associated set of permissions.
Proportional Bold
This denotes words or phrases encountered on a system, including application names; dialog-box text;
labeled buttons; check-box and radio-button labels; menu titles and submenu titles. For example:
Choose System → Preferences → Mouse from the main menu bar to launch Mouse
Preferences. In the Buttons tab, select the Left-handed m ouse check box and click
Close to switch the primary mouse button from the left to the right (making the mouse
suitable for use in the left hand).
6
Preface
Character Map from the main menu bar. Next, choose Search → Find… from the
Character Map menu bar, type the name of the character in the Search field and click
Next. The character you sought will be highlighted in the Character T able. Double-click
this highlighted character to place it in the T ext to copy field and then click the Copy
button. Now switch back to your document and choose Edit → Paste from the gedit menu
bar.
The above text includes application names; system-wide menu names and items; application-specific
menu names; and buttons and text found within a GUI interface, all presented in proportional bold and all
distinguishable by context.
Whether mono-spaced bold or proportional bold, the addition of italics indicates replaceable or variable
text. Italics denotes text you do not input literally or displayed text that changes depending on
circumstance. For example:
To connect to a remote machine using ssh, type ssh username@ domain.name at a shell
prompt. If the remote machine is exam ple.com and your username on that machine is
john, type ssh john@ exam ple.com .
The m ount -o rem ount file-system command remounts the named file system. For
example, to remount the /hom e file system, the command is m ount -o rem ount /hom e.
To see the version of a currently installed package, use the rpm -q package command. It
will return a result as follows: package-version-release.
Note the words in bold italics above: username, domain.name, file-system, package, version and
release. Each word is a placeholder, either for text you enter when issuing a command or for text
displayed by the system.
Aside from standard usage for presenting the title of a work, italics denotes the first use of a new and
important term. For example:
Source-code listings are also set in m ono-spaced rom an but add syntax highlighting as follows:
7
OpenShift Online 1 User Guide
package org.jboss.book.jca.ex1;
import javax.naming.InitialContext;
System.out.println("Created Echo");
Note
Notes are tips, shortcuts or alternative approaches to the task at hand. Ignoring a note should
have no negative consequences, but you might miss out on a trick that makes your life easier.
Important
Important boxes detail things that are easily missed: configuration changes that only apply to the
current session, or services that need restarting before an update will apply. Ignoring a box
labeled “Important” will not cause data loss but may cause irritation and frustration.
Warning
Warnings should not be ignored. Ignoring warnings will most likely cause data loss.
2. Getting Help
search or browse through a knowledgebase of technical support articles about Red Hat products
submit a support case to Red Hat Global Support Services (GSS)
access other product documentation
8
Preface
You can also access the OpenShift web site at https://openshift.redhat.com/ to find blogs, FAQs, forums,
and other sources of information.
Red Hat also hosts a large number of electronic mailing lists for discussion of Red Hat software and
technology. You can find a list of publicly available mailing lists at
https://www.redhat.com/mailman/listinfo. Click the name of any mailing list to subscribe to that list or to
access the list archives.
When submitting a bug report, be sure to mention the manual's identifier: Docs User Guide
If you have a suggestion for improving the documentation, try to be as specific as possible when
describing it. If you have found an error, please include the section number and some of the surrounding
text so we can find it easily.
9
OpenShift Online 1 User Guide
Built on Red Hat Enterprise Linux, OpenShift Online provides a secure and scalable multi-tenant
operating system for todays enterprise-class applications while providing integrated application runtimes
and libraries.
Report a bug
The following table describes the basic system components of OpenShift Online.
Table 1.1. Basic Components
Small gears provide 512MB of RAM, 100MB of swap space, and 1GB of disk space
Medium gears provide 1GB of RAM, 100MB of swap space, and 1GB of disk space
Large gears provide 2GB of RAM, 100MB of swap space, and 1GB of disk space
By default, there are three small gears available with a total of 1.5GB of RAM and 3GB of disk space.
OpenShift Online can assign these three gears to a single application and its cartridges (Cron, MySQL,
etc.), use each gear for a separate application, or use the gears for scaling an application.
Report a bug
10
Chapter 1. Introduction to OpenShift Online
Report a bug
Report a bug
The following screenshot shows the home page of the Management Console when you first log into your
account. Each tab across the top navigation bar provides further functionality to help you manage your
account, applications, and more.
11
OpenShift Online 1 User Guide
The following table provides a brief description of the different pages and settings available in the
Management Console.
Page Description
Applications View and manage applications and cartridges. If there are no applications,
you can create new applications from this page.
Settings View and manage SSH keys, domains, and account authorizations.
Help 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.
My Account View and manage account information, including account upgrades. This
page shows account details, subscription plan, and account usage. Red Hat
technical support is available from here depending on the plan subscription.
Note that the Management Console currently provides limited functionality. Therefore, most of the
instructions in this guide are for the client tools. However, tasks that can be performed in the
Management Console are highlighted accordingly in their respective sections.
An OpenShift Online user account is required for creating and managing applications within a unique
namespace. This guide assumes a user account is already set up and configured.
Report a bug
Coding
Debugging
12
Chapter 1. Introduction to OpenShift Online
For example, although you can create an application using the Management Console, the application
must be cloned to your workstation to make any code changes, and then redeployed to the remote
server using the client tools.
Note
The rhc package found in the OpenShift Online 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 the OpenShift Online Client Tools Installation Guide at
https://access.redhat.com/site/documentation to install the latest Ruby gem version of the client
tools and get all available features.
Report a bug
Report a bug
13
OpenShift Online 1 User Guide
Note
Some features described in this guide are only available with a paid subscription plan.
Report a bug
Report a bug
$ rhc account
$ rhc account
Login [email protected]
-----------------------------------------------------
ID: 52424geb2587c836b106001b
Gears Used: 10
Gears Allowed: 16
Domains Allowed: 3
Allowed Gear Sizes: small
SSL Certificates: yes
Report a bug
14
Chapter 2. Getting Started
End the current session with the remote server and remove all local session files with the following
command:
$ rhc logout
Report a bug
15
OpenShift Online 1 User Guide
Chapter 3. Authentication
When the client tools are installed and the 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 Client Tools Installation Guide
at https://access.redhat.com/site/documentation for more information on installing and configuring the
client tools.
If an authorization token was not created when the client tools were installed, run the setup wizard again
with the rhc setup command to create one.
If an existing authorization token is no longer required and you do not wish to be prompted for token
renewal, run the rhc logout command to delete the token.
Report a bug
Specify the scope for the token with the --scopes option, and a name for the token with the --note
option.
16
Chapter 3. Authentication
My_token
--------
Token: 787a57211d42f251204136b05d490038830d9b7057f54f816c2a9fcd0c8333b8
Scopes: session
Created: 4:40 PM
Expires In: about 1 day
After creating a new authorization token, use the --token token_string global option to run rhc
commands as the user associated with the authorization token that was provided.
Report a bug
Report a bug
Delete one or more tokens with the following command, separating multiple tokens with commas:
17
OpenShift Online 1 User Guide
Delete all tokens associated with your account with the following command:
Report a bug
Successful authentication occurs when the public SSH key on your computer matches the public key that
has been uploaded to the OpenShift Online server. When the client tools are initially configured, the
interactive setup wizard generates a new pair of SSH keys in the default .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 Online server. See the OpenShift Online Client Tools Installation Guide at
https://access.redhat.com/site/documentation for more information on how to configure the client tools.
The following table shows the types of SSH keys supported with OpenShift Online.
Table 3.2. Supported SSH Keys
ssh-rsa
ssh-dss
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
ecdsa-sha2-nistp256
ecdsa-sha2-nistp384
ecdsa-sha2-nistp521
Report a bug
1. Run the following command to generate a pair of keys, replacing KeyType with the type of key to
generate:
18
Chapter 3. Authentication
$ ssh-keygen -t KeyType
2. 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
Note
Red Hat recommends to save all SSH keys in the default location. If an id_rsa file already
exists, rename the new SSH key file to avoid overwriting the existing one.
Report a bug
Report a bug
Report a bug
19
OpenShift Online 1 User Guide
Report a bug
Report a bug
Report a bug
Report a bug
20
Chapter 3. Authentication
Report a bug
21
OpenShift Online 1 User Guide
Chapter 4. Domains
An OpenShift Online blacklist restricts the domain names that are available. A warning message informs
you if a blacklisted domain name has been selected when you attempt to create a domain.
Domain names consist of a maximum of 16 alphanumeric characters and cannot contain spaces or
symbols.
Report a bug
You may now create an application using the 'rhc app create' command
Note
The number of domains you can create depends on the type of account and its limitations. A
warning message alerts you when the account limitations are exceeded.
See Also:
Report a bug
22
Chapter 4. Domains
List all available domains for an account with the following command:
Domain automobile2
-----------------
Created: Oct 01 7:46 PM
Allowed Gear Sizes: small, medium
Alternatively, run the rhc dom ains command to list all available domains.
Report a bug
If multiple domains exist, specify the name of the domain with the -n option:
23
OpenShift Online 1 User Guide
Report a bug
1. Ensure the domain does not contain any applications with the following command:
$ rhc apps
Delete any applications that exist in that domain with the following command:
Warning
Deleting an application deletes all remote data associated with that application, which
cannot be recovered.
2. Rename a domain with the following command, specifying the current domain name and the new
domain name:
Report a bug
1. Ensure the domain does not contain any applications with the following command:
Delete any applications that exist in that domain with the following command:
24
Chapter 4. Domains
Warning
Deleting an application deletes all remote data associated with that application, which
cannot be recovered.
Note
See Also:
Report a bug
25
OpenShift Online 1 User Guide
Chapter 5. Teams
Domain members with an administrator role can change the role of a team that is a member of that
domain.
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 adm in. 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 the view 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 the edit 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.
Currently, you can only create, populate, and configure teams with the REST API. See the OpenShift
Online REST API Guide at https://access.redhat.com/site/documentation for more information. The
capability to create and manage teams with the client tools will be available in the next release of
OpenShift Online.
Report a bug
26
Chapter 6. Domain Membership
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.
The default role for each member is the edit role, but it can be changed.
Report a bug
When adding a team to a domain, add the --type option with team specified:
When adding a member or a team to a domain, they receive the default role of edit if not otherwise
specified. Use the --role option when adding a member or a team to specify a different role:
Report a bug
27
OpenShift Online 1 User Guide
Change an existing member's role with the following command. Member_Role can be specified as view,
edit, or adm in:
$ rhc member update Team_ID -n Domain_Name --role Member_Role --type team --ids
Report a bug
Report a bug
28
Chapter 6. Domain Membership
Report a bug
Alternatively, remove all existing members from a domain by including the --all option:
Remove a team from a domain by specifying the team name and adding the --type option:
Report a bug
29
OpenShift Online 1 User Guide
Custom SSL certificates with domain aliases are available for added security to users with upgraded
OpenShift Online accounts.
Management Console
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.
Report a bug
Add a custom domain name to an application with the following command, specifying the application
name and custom domain name:
View domain name aliases and SSL certificate status with the following command, specifying the
application name:
30
Chapter 7. Custom Domains and SSL Certificates
Remove a domain name alias from an application with the following command, specifying the application
name and the custom domain name to be removed:
Report a bug
If the private key is encrypted, specify the passphrase with the --passphrase option.
View domain name aliases and SSL Certificate status with the following command, specifying the
application name:
Remove a custom SSL certificate from an alias with the following command, specifying the application
name and alias name:
Report a bug
31
OpenShift Online 1 User Guide
Chapter 8. Cartridges
Report a bug
The following web framework cartridges are currently available with OpenShift Online:
Table 8.1. Available Web Framework Cartridges
Scalable Non-Scalable
JBoss AS Zend Server
JBoss EAP Jenkins Server
Node.js Do-It-Yourself (DIY)
Perl
PHP
Python
Ruby
Tomcat (JBoss EWS)
Report a bug
32
Chapter 8. Cartridges
Function Description
Database Provide the application with one of several database back ends. Examples
include MySQL and PostgreSQL.
Database management Provide functionality for managing the application's database using third-
party software. Examples include HAProxy.
Monitoring and Provide a range of options for managing and monitoring the application.
Management Examples include the Cron task scheduler, and the Jenkins Client.
The following add-on cartridges are currently available for OpenShift Online.
Database Cartridges
The following table describes all available database cartridges, and shows whether they are scalable or
not.
Table 8.3. Database Cartridges
Management Cartridges
The following table describes all available management cartridges, and shows whether they are scalable
or not.
Table 8.4. Management Cartridges
Report a bug
33
OpenShift Online 1 User Guide
the OpenShift community. These cartridges are downloaded and installed using the URL to the manifest
of the hosted downloadable cartridge.
See Also:
Report a bug
34
Chapter 9. Applications
Chapter 9. Applications
With each new application that is created with the client tools, a remote Git repository is populated with
the selected cartridge, which is then cloned to the current directory on the local machine. The host name
and IP address of the application are also added to the list of known hosts in the ~/.ssh/known_hosts
directory.
The following table describes each component that makes up an OpenShift Online application.
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 Online and pointing the DNS entry to the OpenShift Online
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.
OpenShift Online provides dedicated /var/tm p and /tm p directories for each user application. The
/var/tm p directory is a symbolic link to /tm p. Each /tm p directory is completely isolated from the
/tm p directories of all other applications. Files that are untouched for any period of ten days are
automatically deleted from these directories.
Report a bug
35
OpenShift Online 1 User Guide
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 Online 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 Online supports various technologies to provision the
required services automatically.
Manage OpenShift Online allows real-time monitoring, debugging, and tuning of
applications. Applications are scaled automatically depending on web traffic.
Report a bug
A scalable application can be scaled automatically or manually. New applications by default are
automatically scaled based on the number of requests. However, you can adjust the minimum and
maximum number of gears used by an application within the allowable limits to manually scale it.
Each application created on OpenShift Online must have at least one web framework cartridge; for
example, a PHP cartridge. When an application is scaled, a second cartridge, called HAProxy, is added
to the application. The HAProxy cartridge listens to all incoming web page requests for an application
and passes them on to the web cartridge, following defined guidelines for load monitoring.
As the number of web page requests to an application increase, the HAProxy informs OpenShift Online
when an overload of requests is detected. A copy of the existing web cartridge is then created on a
separate gear. In such a case, the web cartridge now has been scaled up two times. This process is
repeated as more web page requests are detected by the HAProxy cartridge, and each time a copy of
the web cartridge is created on a separate gear, the application scale factor increases by one.
If an application's ratio of total number of gears to HAProxy gears is ever greater than two, the routing
function of the HAProxy cartridge is disabled to the web cartridges collocated on their gear. This allows
full gear resource usage for the HAProxy cartridges, which continue routing requests to the web
cartridges of other gears. If the ratio returns to two or below, routing to the web cartridges of the
HAProxy gear is enabled again.
36
Chapter 9. Applications
Report a bug
37
OpenShift Online 1 User Guide
The --tim eout option on the command line is used to override the default values when there are
constant timeout issues. OpenShift Online 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.
The --tim eout 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 --tim eout 50 is
used, it sets the connection timeout value to 50 seconds, but does not affect the read timeout value.
Similarly, if --tim eout 150 is used, it sets both the connection and read timeout values to 150
seconds.
Report a bug
There are some factors that must be considered before you create an application. There are certain
aspects of the application that cannot be changed after it is created. For example, whether an application
is scalable or not must be specified when it is created. An application that is not scalable cannot be
changed to scalable after it is created, and vice versa. The web framework of a cartridge also cannot be
changed after an application is created. An application can be created with either the Management
Console or the client tools.
New applications are created with the 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.
The following table describes some of the common options available when creating a new application
with the client tools.
38
Chapter 10. Application Management
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.
-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.
Create a non-scaleable application in the default domain with the following command:
URL: http://racer-mydomain.rhcloud.com/
SSH to: [email protected]
Git remote: ssh://52ae91b8dbd93c8c43000001@racer-
mydomain.rhcloud.com/~/git/racer.git/
Cloned to: /home/blank/racer
Run 'rhc show-app racer' for more details about your app.
39
OpenShift Online 1 User Guide
With a scalable application the automatic scaling feature is enabled by default. However, an application
can be scaled manually to control the number of gears that are used.
Note
At the time of this writing, if a scalable application is created, the scaling function of that
application cannot be disabled. However, it is possible to clone a non-scaling application and all its
associated data and create a new scaling application using the application clone command. See
Section 10.3, “Cloning an Existing Application” for more information.
Replace the web framework type with the URL of the manifest for the hosted cartridge to create an
application from a downloadable cartridge:
As described in Section 4.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:
When multiple applications are created in a domain, the application URLs are as follows:
http://app1-domain.example.com
http://app2-domain.example.com
This command creates a Jenkins application, and then adds the Jenkins client cartridge to the specified
application.
40
Chapter 10. Application Management
User: admin
Password: wEXesNXyEe1M
URL: http://mynewapp-mydomain.rhcloud.com/
SSH to: [email protected]
Git remote: ssh://52b10d7d2587c8415000012c@mynewapp-
mydomain.rhcloud.com/~/git/mynewapp.git/
Cloned to: /home/blank/mynewapp
Run 'rhc show-app mynewapp' for more details about your app.
Important
Take note of the login credentials for the newly created Jenkins application. These credentials are
required to log in to the Jenkins home page.
For build or other testing purposes, create an application of no specific type with the DIY cartridge:
41
OpenShift Online 1 User Guide
The DIY cartridge creates an application that is not publicly available nor does it have anything running.
Start the application with git push and a .openshift/action_hooks/.
Note
When an application is created, automatic deployment is configured by default. This means that
each time you execute the git push command the application is automatically deployed and
visible to customers.
See Also:
Report a bug
This creates a new application using the same cartridges, gear sizes, and scaling and deployment
configurations as an already existing application. Note that aliases are not copied, because they are
unique to an application.
Use dom ain/ to clone an application from another domain you have access to:
The following table outlines different options you can use to configure the new application and give it
different attributes than the original application:
42
Chapter 10. Application Management
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.
Report a bug
Clone the remote repository of an application into a local working directory with the following command:
This command copies the template application files from the remote repository into the working directory
so that the application code and files can be modified to suit your requirements.
Report a bug
43
OpenShift Online 1 User Guide
$ rhc apps
$ rhc apps
racer @ http://racer-automobile.example.com/ (uuid:
926056f8845b4e388b37f6735c89d0eb)
-----------------------------------------------------------------------------
--------
Domain: automobile
Created: Dec 19 10:20 PM
Gears: 1 (defaults to small)
Git URL: ssh://926056f8845b4e388b37f6735c89d0eb@racer-
automobile.example.com/~/git/racer.git/
SSH: [email protected]
Deployment: auto (on git push)
Use the --m ine option to only list the applications that are within domains that you have created:
Applications that you have access to, but did not create, will not be listed.
Report a bug
1. View the cartridges associated with a scalable application with the following command:
44
Chapter 10. Application Management
Locate the scaling cartridges as required. The example shows that the php-5.4 cartridge is scaling.
2. 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:
Example 10.7. Setting the Maximum and Minimum Amount of Gears for a Cartridge
Set the minimum and maximum gears back to 1 to stop a cartridge from scaling.
Report a bug
The following table describes the available application management command actions:
45
OpenShift Online 1 User Guide
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 tm p 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.
The following table describes the available options with application management commands:
Table 10.4. Application Management Command Options
Option Description
-n, --namespace [NAME] Name of a domain.
-a, --app [NAME] Name of an application.
-l, --rhlogin [LOGIN] OpenShift Online user account.
-p, --password [PASSWORD] OpenShift Online account password.
Report a bug
46
Chapter 10. Application Management
Important
Although accessing applications with the shell environment provides advanced operations,
accidental damage to an application can occur. Therefore, Red Hat recommends to use shell
access only when necessary.
The following table describes the available options when accessing applications in a secure shell
environment:
Table 10.5. Options for Accessing Applications in Secure Shell Environment
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 Online user account.
-p, --password [PASSWORD] OpenShift Online account password.
Report a bug
47
OpenShift Online 1 User Guide
*********************************************************************
You are accessing a service that is for use only by authorized users.
If you do not have authorization, discontinue use at once.
Any use of the services is subject to the applicable terms of the
agreement which can be found at:
https://www.openshift.com/legal
*********************************************************************
[racer-automobile.example.com 517623ecdbd93cdffa000001]\>
From the shell environment, run the help command to see the available shell commands. General
Linux commands are available for routine operations in the shell environment.
Specific SSH commands can be run by passing one or more arguments. A different SSH executable can
be used, or further options can be passed to SSH with the --ssh option.
Report a bug
1. Determine the gear's ID and SSH URL with the following command:
48
Chapter 10. Application Management
In the example output the ID of the first scaling gear is 519b0fd02587c84 b860002d8 and its
SSH URL is 519b0fd02587c84 b860002d8@ 519b0fd02587c84 b860002d8-
autom obile.exam ple.com .
2. Open a secure shell environment to the desired gear with the gear's SSH URL:
$ ssh 519b0fd02587c84b860002d8@519b0fd02587c84b860002d8-
automobile.example.com
Report a bug
The shell for each database also offers a selection of management commands. See the appropriate
database documentation for more information on the available database shell commands.
Important
Although accessing applications with the shell environment provides advanced operations,
accidental damage to your application can occur. Therefore, Red Hat recommends to use shell
access only when necessary.
1. Access the desired application in a shell environment with the following command:
2. From the application's shell environment prompt, run the appropriate command for the database
to access the interactive database shell:
Run the m ysql command to access the MySQL shell
Run the psql command to access the PostgreSQL shell
Run the m ongo command to access the MongoDB shell
49
OpenShift Online 1 User Guide
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights
reserved.
Type 'help;' or '\h' for help. Type '\c' to clear the current input
statement.
mysql>
Note
Since OpenShift Online does not allow editing MySQL server configuration, it may be necessary to
specify certain settings in the client connection string. For example, the default character set is
Latin-1. If you would like to use UTF-8 instead, set the character set and collation as parameters
on the connection string. For example, in a Java EE application, the URL would be specified in
persistence.xm l like:
<connection-url>jdbc:mysql://xxx.x.xxx.xxx:xxxx/databaseName?
useUnicode=yes&characterEncoding=UTF-8</connection-url>
See Also:
Report a bug
Consult your system administrator for configuring Watchman or see the OpenShift Enterprise
Administrators Guide at https://access.redhat.com/site/documentation for more information.
Report a bug
50
Chapter 10. Application Management
8. On the https://mms.mongodb.com website, click Hosts → + Add Host to add your MongoDB host.
Fill out the MongoDB host name, port number, and login credentials.
Report a bug
The following instructions describe how to enable cron support for an application. It is assumed the
application has already been created.
$ mkdir -p .openshift/cron/minutely
$ echo 'date >> $OPENSHIFT_REPO_DIR/php/date.txt' >
.openshift/cron/minutely/date.sh
The example cron job appends a new line of date information to the
$OPENSHIFT _REPO_DIR/php/date.txt file every minute.
3. Commit the changes and push them to the remote repository:
51
OpenShift Online 1 User Guide
Verify that the cron job script you create works correctly. For the script used in the example, verify that it
works correctly with the following command:
$ curl http://holy-roller.example.com/date.txt
The scripts placed in the /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.
Note
The cron commands affect all cron jobs. You cannot disable or enable individual cron jobs.
Report a bug
Important
While the following ports are suggestions for available applications or gears, ports 2303 - 2308
are reserved for OpenShift SNI Implementation, and port 10050 is reserved for the OpenShift
Online Zabbix agent. You cannot bind to these ports.
52
Chapter 10. Application Management
Ports 15000 - 35530 are available for binding internal IP, but these ports are not externally addressable.
53
OpenShift Online 1 User Guide
You can also bind to $ OPENSHIFT _Cart_Name_PORT (8080) for HTTP connectivity, which reroutes
externally through port 80.
Report a bug
For plain WebSocket connections (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
Report a bug
The following ports are the suggested options for email support:
Communication occurs at a limited rate. Port 587 (submission) is restricted to a maximum rate of 256
Kbps. Ports 25 (SMTP) and 465 (SMTPS) are restricted to a maximum rate of 24 Kbps. Both consume
an extremely small share of the available bandwidth if there is congestion.
Important
Note that access to email servers from cloud providers may be blocked by Realtime Blackhole
Lists (RBLs), affecting connections to some email servers. If you are unable to connect to one of
these services, ensure the email provider allows authenticated connections from Amazon AWS
EC2 hosts.
Report a bug
54
Chapter 10. Application Management
configure complicated firewall rules or SSH tunnels. The command used to forward ports to a local
machine includes a wrapper that configures SSH port forwarding. After the ports are forwarded, the list of
remote services and associated IP addresses that are being forwarded becomes available.
Report a bug
With port forwarding configured, access the remote application with a browser using the local ports.
The current implementation of the 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.
Specific ports are forwarded with the following command. Specify the local port and remote port as
required, as well as the gear ID, and application and domain name of the remote port:
55
OpenShift Online 1 User Guide
This example allocates a socket to listen to the local port host 8080. When a connection to this port is
made, a secure channel forwards the connection to the remote host port 8080.
Report a bug
After you have determined the gear's ID, port forward that gear with the following command:
See Also:
Report a bug
localhost
127.0.0.1
Therefore, port forwarding on Mac OS X may not work correctly. The following example shows error
messages that can occur when attempting to configure port forwarding using the IP address of an
application.
The current workaround to enable port forwarding on Mac OS X is to manually configure an alias for
56
Chapter 10. Application Management
Note
Root or administrative privileges are required to run the ifconfig command on Mac OS X.
If the application uses multiple IP addresses, you must configure an alias for each IP address. For
example, suppose a PHP application has both MySQL and phpMyAdmin cartridges added, and it uses
the IP addresses 127.11.25.1 and 127.11.25.2. For port forwarding to work correctly, configure an alias
for each IP address as shown in the following example:
Important
The IP address alias configured for an application is not persistent through system reboots. If the
system is rebooted, you must repeat these steps to correctly enable port forwarding on Mac OS
X.
Report a bug
Deleting an application deletes all remote data associated with that application, which cannot be
recovered.
Run the following command to delete an application and all associated remote data, answering yes
when prompted:
Note that this process only deletes remote application data. Data stored on your local machine must be
57
OpenShift Online 1 User Guide
manually deleted.
Warning
The following process deletes the selected directory and all its files, which cannot be recovered.
Ensure the correct directory is specified for deletion.
$ rm -rf ~/path/to/app_directory/
Report a bug
58
Chapter 11. Cartridge Management
This command displays all available web framework and add-on cartridges.
Report a bug
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.
Add a cartridge to an application with the following command, specifying the desired cartridge and the
name of the application:
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. Currently the gear
sizes available are small, medium, and large.
Note
The medium and large gears are only available with the bronze and silver plans. Customers on
the free plan are limited to small gears. Log on to the Management Console at
https://www.openshift.com/ to view plan upgrade options.
Report a bug
59
OpenShift Online 1 User Guide
Report a bug
60
Chapter 11. Cartridge Management
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.
The following table describes the available options with cartridge management commands:
Table 11.3. Cartridge Management Command Options
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 Online user account.
-p, --password [PASSWORD] OpenShift Online account password.
Report a bug
61
OpenShift Online 1 User Guide
The deployment process uses the application's storage space as part of the build and test process. This
means that the running application must be shut down so that its memory can be utilized. Therefore, the
application is not available for the duration of the build.
The following table outlines and describes the associated tasks of the deployment process.
Report a bug
Report a bug
62
Chapter 12. Build and Deployment
$ git commit
$ git push
The 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.
Report a bug
Report a bug
Report a bug
This command enables manual deployment of an application so that when the git push command is
run, the application data is only pushed to the remote repository; the application is not deployed.
See Also:
Report a bug
63
OpenShift Online 1 User Guide
where No_of_Deps is the number of deployments to keep in the application's history. Older deployments
are deleted when this number is exceeded.
Report a bug
The Git references supported with this command are SHA, branch, and tag.
Report a bug
Note that this command changes the application's deployment process and disables the git
push command.
3. Deploy the application using the binary artifact that was created:
See Also:
Report a bug
64
Chapter 12. Build and Deployment
This command displays the individual ID of each deployment, which is used to activate that deployment.
Report a bug
Report a bug
During a process that supports an action hook, the application action hook directory is checked for an
executable file matching the specified name. If it is found, the file is executed before control is returned to
the normal process. There are no specific implementation requirements on action hooks other than that
they be executable files. The action hook scripts are directly executed by OpenShift Online.
Report a bug
Use the following list for a reference to all possible action hooks associated with a cartridge control
action.
Cart_Name is a replaceable term used to represent the cartridge short-name. For example, for a
65
OpenShift Online 1 User Guide
JBossAS cartridge to be implemented during the pre-start process, create the file
App_Name/.openshift/action_hooks/pre_start_jbossas, edit it and add the desired
information.
Report a bug
pre-build
build
deploy
post-deploy
Create a new file in the 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:
Report a bug
# chmod +x App_Name/.openshift/action_hooks/haproxy_ctld.rb
Report a bug
66
Chapter 12. Build and Deployment
A number of standardized environment variables are available for applications hosted on OpenShift
Online. These variables serve as placeholders for application names, commonly accessed directory
names, user names, passwords, host names, IP addresses, and more. The specific environment
variables that are available to a given application is determined by the cartridges that have been added
to that application. For example, an application with PHP and MySQL has access to environment
variables that expose the PHP path information, including the host, port, user name, and password
necessary for connecting to the MySQL database.
There are two ways to view the environment variables for an application:
Report a bug
Report a bug
67
OpenShift Online 1 User Guide
Note
Many of these directories are emptied and rebuilt whenever new code is pushed to an application.
The only persistent directory is OPENSHIFT _DAT A_DIR. Therefore, Red Hat recommends that
you store persistent files in the OPENSHIFT _DAT A_DIR directory.
Report a bug
LOGSHIFTER_PHP_MAX_FILESIZE=500K
LOGSHIFTER_PHP_MAX_FILESIZE=10M
LOGSHIFTER_PHP_MAX_FILESIZE=2G
LOGSHIFTER_PHP_MAX_FILESIZE=1T
Report a bug
68
Chapter 12. Build and Deployment
Database environment variables pertain to a database, if one exists, and are used to connect an
application to a database. The exact variable names depend on the type of database; the value of
<database> is MONGODB, MYSQL, or POSTGRESQL as appropriate. Note that these connections are
only available to an application internally; you cannot connect from an external source.
OpenShift Online does not currently support user changes to environment variables. This includes
changing the default MySQL admin password (even outside of phpMyAdmin). If the password is
changed, ensure the change takes effect correctly. Note that this restriction only applies to the default
administrative user. You can add more users as required, and specify a custom password for these
users.
Report a bug
Note
The global directory for a cartridge is set with LD_LIBRARY_PAT H. 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_PAT H_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_PAT H environment variable.
Report a bug
69
OpenShift Online 1 User Guide
Report a bug
Report a bug
70
Chapter 12. Build and Deployment
<connection-
url>jdbc:mysql://${env.OPENSHIFT_MYSQL_DB_HOST}:${env.OPENSHIFT_MYSQL_DB_PORT}/${e
nv.OPENSHIFT_APP_NAME}</connection-url>
The environment variables can be saved on the server so that sensitive information is not repeatedly
passed to the command line. The following instructions describe how to set environment variables on the
server.
Important
Sensitive information stored in environment variables is visible if you use the rhc snapshot
commands.
Note
If you use the jboss-cli.sh tool or the JBoss Management Console to edit the standalone.xm l
file, it only edits the local gear's standalone.xm l file and not the repository one provided by
your OpenShift cartridge template: App_Nam e/.openshift/config/standalone.xm l.
Manual changes will be lost upon an application restart, and the last version of the repository
standalone.xm l file will be used even if you remove the repository standalone.xm l file.
To make your jboss-cli.sh tool or JBoss Management Console changes persistent or to stop the
application from using the repository standalone.xm l file, set the
DISABLE_OPENSHIFT_MANAGED_SERVER_CONFIG environment variable to true by running:
Report a bug
71
OpenShift Online 1 User Guide
Report a bug
Report a bug
Set one of more environment variables for an application with the following command:
View the custom environment variables set for an application with the following command:
Display the value of one or more custom environment variables with the following command:
Report a bug
72
Chapter 12. Build and Deployment
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.
OpenShift Online provides support for hot deployment through a hot_deploy marker file. If the marker
is present, supported application cartridges automatically hot deploy when the git push command is
executed.
Report a bug
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, Zend Server, 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.
Ruby
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.
Report a bug
73
OpenShift Online 1 User Guide
Windows
Enable hot deployment by creating the hot_deploy marker file in the application's root directory with
the following command:
Disable hot deployment by deleting the hot_deploy marker file from the application's root directory:
Enable hot deployment by creating the hot_deploy marker file in the application's root directory:
Disable hot deployment by deleting the hot_deploy marker file from the application's root directory:
Report a bug
The Jenkins client cartridge must be added to a new or existing application for it to build with Jenkins.
After the Jenkins client cartridge is added to an application, the 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.
There are a number of benefits that come with using Jenkins to build applications:
Jenkins can be used to build any number of applications, and is only limited by the number of available
gears. For example, if a PHP application is created and MySQL database is on the first gear, then
Jenkins is added to a separate gear. A third gear is used for the Jenkins builder. In other words,
whenever the Jenkins builder is active, it occupies one of the available gears.
74
Chapter 12. Build and Deployment
Report a bug
See Also:
Report a bug
User: admin
Password: Zek_Mdtr86uq
75
OpenShift Online 1 User Guide
Report a bug
The actual build and deployment process that Jenkins executes involves the following steps:
1. The git push command is executed, and Jenkins is notified that a new push is ready.
2. 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.
76
Chapter 12. Build and Deployment
The build job can be monitored using the Jenkins interface. The interface provides an extensive range of
information about the current build, build history, artifacts, as well as plug-ins to graph, track, run tests,
and perform other operations.
Log all errors related to Jenkins, such as DNS timeout and builder configuration, with the following
command, specifying the name of the Jenkins application if it was changed:
Error logs for applications, such as compilation or test failures, are available from the Jenkins web
interface under the corresponding build history. Deployment related errors are logged in the application's
log files, and can be viewed with the following command:
Report a bug
Click on the icon of the application from the Jenkins web interface, located on the right side, to build
it.
View the status of the build process in the web interface under the Build Executor Status section.
Report a bug
77
OpenShift Online 1 User Guide
Gear storage and disk space can be managed with the client tools to optimize application performance.
Note
Additional gear storage is not available with all subscription plans. Therefore, ensure your account
allows additional gear storage before attempting to increase it. Log on to the Management
Console at https://www.openshift.com/ to view plan upgrade options.
Report a bug
PHP 5.4
-------
Base Gear Storage: 1GB
Additional Gear Storage: None
View gear storage for a specific cartridge by using the -c option to specify the cartridge:
78
Chapter 13. Gear Storage and Disk Space Management
Report a bug
Storage Info
------------
Base Gear Storage: 1GB
Additional Gear Storage: 3GB
If the same command is used to add another 1GB of storage, there will be a total of 4GB of additional
gear storage.
Report a bug
79
OpenShift Online 1 User Guide
Storage Info
------------
Base Gear Storage: 1GB
Additional Gear Storage: 5GB
Note that this is different from the --add option because the exact amount of gear storage is specified,
rather than adding more storage to the existing amount.
Report a bug
Storage Info
------------
Base Gear Storage: 1GB
Additional Gear Storage: 2GB
Report a bug
Run the git gc command on the application's Git repository on the server.
Clear the application's /tm p and log file directories that are specified by the application's
OPENSHIFT _LOG_DIR and OPENSHIFT _T MP_DIR environment variables.
Clear unused application libraries and remove any library files previously installed by a git push
command.
80
Chapter 13. Gear Storage and Disk Space Management
Important
Log files are not automatically backed up or rotated. Tidying an application runs the 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.
Report a bug
81
OpenShift Online 1 User Guide
Important
Application backups and user data are not stored on OpenShift Online servers. These files are
only stored on the local system.
Report a bug
RESULT:
Success
The command prompts for any required information. The default filename for the snapshot is
$App_Nam e.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.
Report a bug
82
Chapter 14. Application Backup and Restoration with Snapshots
Warning
The 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.
Restore an application from an application snapshot with the following command, specifying the name of
the application:
RESULT:
Success
If the override process was used to save an application under a different filename, as described in
Section 14.2, “Creating an Application Snapshot”, you can restore this snapshot version of an application
with the following command:
where App_Name is the name of the application, and Renamed_App is the file path where it was saved.
Report a bug
2. 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:
83
OpenShift Online 1 User Guide
3. Create a new application using the same cartridges, but with the correct gear size:
4. Finally, restore the previously saved application snapshot to the newly created application. Be sure
to specify the correct path to the saved application snapshot:
Report a bug
84
Revision History
Revision History
Revision 1.0.43-1 Fri Apr 25 2014 Bilhar Aulakh
Updated Section 6.2.1, “Adding a Member” to include adding teams as domain members.
Added Teams chapter and Section 5.1, “Introduction to Teams”.
Added Section 12.5.4, “Logging Environment Variables”.
Updated Section 10.5, “Viewing Applications for a User” to view a list of only those applications that exist
under a domain created by current user.
Added Section 10.10, “Embedding 10gen MMS Agent”.
BZ 1077965: Fixed Section 8.1.2, “Add-on Cartridges” to show which cartridges are scalable.
85
OpenShift Online 1 User Guide
86