Find answers to some common technical questions about OpenShift.

Looking for login, billing or other account-related information? See the Account FAQs.

In This Guide

How can I stop my application?

You can stop your application by running:

$ rhc app-stop <app_name>

Sometimes an application can become stuck due to an issue with application code or the gear itself. You can force the application to stop in these cases by running:

$ rhc app-force-stop <app_name>

If your application will not stop after using the force-stop command, please submit a help request.

Are there problems with the web console on iPad and iPhone browsers?

When using an iPad or iPhone to access the OpenShift Web Console, the add alias page is not functional as per this bug.

I’ve exceeded my disk quota - what can I do?

Please see this page to learn how to measure and manage disk quota for OpenShift applications.

Why can’t I create applications hosted in the EU Region?

Only Premium Plan accounts can create applications using gears hosted in an EU Region. In addition, only production gears (small.highcpu, medium, and large) can be created in an EU region. Small gears, regardless of plan type, can only be hosted in the US (aws-us-east-1).

Please see Regions and Zones for more details.

Why does MySQL stop responding after 8 hours?

MySQL sets the following default values:

interactive_timeout = 28800
wait_timeout = 28800

Connections that persist longer then 8 hours will get a timeout as a result. Modifying these values will not fix the problem, but you may be able to use a connection pool as a workaround. @emil.adz has provided a blog article on how to resolve this issue in a Java application using Hibernate.

Why am I getting 502 or 504 timeout errors?

These errors are coming from the global Apache instance as it tries to route the request to your gear. This generally means a transaction has timed out. That timeout is currently set at 4 minutes.

Alternatively, this may simply be due to idling and you should try to restart your application (see next question/answer).

If you are still having issues, please submit a help request.

Why am I getting 503 errors (Service Temporarily Unavailable)?

This error is coming from the global Apache instance as it tries to route the request to your gear. This generally means that your application is not responding. You can check log files to see what the root cause might be.

In some cases, a simple restart might help:

$ rhc app-restart <app_name>

You should still review your application logs to find clues on how to prevent the root cause.

If a simple restart does not help, try:

$ rhc app-force-stop <app_name>
$ rhc app-start <app_name>

If you are still having issues, please submit a help request.

Why is my application restarting automatically or having memory issues?

Current memory limits are 512MB for Small and Small.highcpu gears, 1GB for Medium gears, and 2GB for Large gears.

In each case, the memory plus swap (memsw) limit is 100MB higher than the memory limit. You may see performance degradation when either of these limits are hit. To check whether your application is reaching its memory limits, ssh into your gear and run:

oo-cgroup-read memory.failcnt
oo-cgroup-read memory.memsw.failcnt

If either command returns a value greater than zero, your gear has reached the corresponding limit and triggered a reclaim event to free some memory.

If memory.memsw.failcnt is greater than zero, it is possible that your gear has had an Out of Memory (OOM) event and been restarted for that reason. To resolve this issue, you must either manage memory from within your app or use a larger production gear size (Medium or Large).

Why do I get a conflicting dependency error when installing JBoss Tools?

If you see a 'Cannot complete the install because of a conflicting dependency' error when trying to install JBoss Tools, update the Eclipse IDE for Java EE Developers packages before installing the JBoss OpenShift Tools.

Why won’t my application start after being restored?

If your application code refers to the internal IP address of either the database server or the application server (127.x.x.x), these values most likely have changed on rhc app-restore. You can use environment variables to improve the portability of your applications.

Why am I getting a permission denied error?

You may see the following error when running rhc create-app:

Checking ~/.ssh/config
Contacting https://openshift.redhat.com
Found stg.rhcloud.com in ~/.ssh/config... No need to adjust
Now your new domain name is being populated worldwide (this might take a minute)...
Pulling new repo down
Permission denied (publickey,gssapi-keyex,gssapi-with-mic). (1)
fatal: The remote end hung up unexpectedly
Error in git pull
1 This is the error.

You may also see a similar error when using git clone or git push.

There are several possible reasons for this error:

  • You have modified your public SSH key in the web console, but not updated the SSH keys on the machine you using.

  • You have modified your SSH keys on the local machine, but not updated your public SSH key in the web console.

  • You are using Gnome and the gnome-keyring-manager has cached the old keys. Logging out and back in to Gnome should resolve this.

  • You can try running ssh-add.

How do I redirect traffic to HTTPS?

OpenShift supports both HTTP and HTTPS connectivity to your app, but you might need to force a redirect to HTTPS so that nothing is accidentally sent unencrypted when communicating with your applications.

For PHP, Ruby and other cartridges that are Apache-based

Applications of all language types except for JBoss and Node.js use Apache. For these applications, you can add an .htaccess file in your web root that looks like this:

RewriteEngine on
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [R,L]

For Python, the .htaccess file must be placed inside of the wsgi folder.

For Node.js Express applications

This tip is created based on default code that comes with the Node.js 0.10 quick start.

Create a function like this in your application server.js:

function redirectSec(req, res, next) {
  if (req.headers['x-forwarded-proto'] == 'http') {
      res.redirect('https://' + req.headers.host + req.path);
  } else {
      return next();
  }
}

Then change this line:

self.app.get(r, self.routes[r]);

To this:

self.app.get(r, redirectSec, self.routes[r]);

For JBoss AS7 and EAP6

For JBoss AS7/EAP6 applications, you will need to do the following:

In your application, create a file called jboss-web.xml in your repo/src/main/webapp/WEB-INF/ directory with this content:

<jboss-web>
  <security-domain>jboss-web-policy</security-domain>
  <valve>
    <class-name>org.jboss.web.rewrite.RewriteValve</class-name>
  </valve>
</jboss-web>

Then, create a rewrite.properties file in your repo/src/main/webapp/WEB-INF/ directory which checks for http and redirects to https:

RewriteCond %{HTTP:X-Forwarded-Proto} http
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [R,L]

A sample security-constraint directive in repo/src/main/webapp/WEB-INF/web.xml looks like:

<security-constraint>
  <web-resource-collection>
    <url-pattern>/*</url-pattern>
  </web-resource-collection>
  <user-data-constraint>
    <transport-guarantee>CONFIDENTIAL</transport-guarantee>
  </user-data-constraint>
</security-constraint>

For Tomcat (JBoss EWS)

You can also use security-constraint directives in your web.xml file to force HTTPS connectivity, but your application will go into a Redirect Loop error. To resolve that, you need to do the following:

Update your repo/.openshift/config/server.xml file’s Connector to look like:

<Connector address="${OPENSHIFT_JBOSSEWS_IP}"
           port="${OPENSHIFT_JBOSSEWS_HTTP_PORT}"
           protocol="HTTP/1.1"
           connectionTimeout="20000"
           redirectPort="443"/>

Then add a Valve directive to your repo/.openshift/config/context.xml file:

<Valve className="org.apache.catalina.valves.RemoteIpValve"
       protocolHeader="x-forwarded-proto" />

A sample security-constraint directive in repo/src/main/webapp/WEB-INF/web.xml looks like:

<security-constraint>
  <web-resource-collection>
    <url-pattern>/*</url-pattern>
  </web-resource-collection>
  <user-data-constraint>
    <transport-guarantee>CONFIDENTIAL</transport-guarantee>
  </user-data-constraint>
 </security-constraint>

Special thanks to many people in the community for helping with this answer: @Martin Borgman, @dmitrygusev, @dmace, and @mitking!

How can I disable HTTPS?

By default, all applications are accessible via HTTP and HTTPS. You don’t have to do anything differently unless you want to force HTTPS.

Why am I getting a 'resource temporarily unavailable' error when using rhc?

This error is a sign that your application has run out of threads/processes to handle requests - for example client-tool(rhc) commands.

You will need to app-force-stop your application and debug your code:

$rhc app-force-stop <app_name>

You can then ssh onto your gear and use one or more of the following commands to help monitor and limit resources:

Why is my JBoss application timing out?

You may see the following error in your log files when deploying a JBoss application:

ERROR [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) JBAS015052: Did not receive a response to the deployment operation within the allowed timeout period [60 seconds]. Check the server configuration file and the server logs to find more about the status of the deployment.

To resolve this, locate .openshift/config/standalone.xml in your repository and find the following section:

<subsystem xmlns="urn:jboss:domain:deployment-scanner:1.0">
  <deployment-scanner scan-interval="5000" relative-to="jboss.server.base.dir" path="deployments"  />
</subsystem>

Add a deployment-timeout attribute to the deployment-scanner tag with a sufficiently large number. For example:

<subsystem xmlns="urn:jboss:domain:deployment-scanner:1.0">
  <deployment-scanner scan-interval="5000" relative-to="jboss.server.base.dir" path="deployments" deployment-timeout="1200" />
</subsystem>

Why is my JBoss application having java.net.BindExceptions to 8080?

Typically this error occurs if the connection IP addresses are incorrect. This can happen if you restore an application from a snapshot, or if you used the standalone.xml file from a different application.

Instead of hard-coding IP addresses into standalone.xml, you should use environment variables, as outlined here.

How can I report a potential security problem?

If you see an issue with an application hosted on OpenShift Online or with the OpenShift Online site, contact the Red Hat Security Response Team.

Sync a new git repo with an existing git repo

Before attempting to merge the two repositories, you need the remote git URL. This is displayed at creation time with the rhc app create -a <app_name> command. You can also get it via the rhc app show -a <app_name> command for existing application. This example uses:

ssh://284bdd9fd9764803939ac5c309634ee6@myapp-mcgrath.rhcloud.com/~/git/myapp.git/

Next, you’ll be pulling the remote repo into your local upstream repo. This will cause conflicts. First run the following command substituting your applications remote git repo:

$ git pull ssh://284bdd9fd9764803939ac5c309634ee6@myapp-mcgrath.rhcloud.com/~/git/myapp.git/

This will let you know about conflicts. You might see, for example:

CONFLICT (add/add): Merge conflict in php/index.php

Fix whatever conflicts are found and git commit them. Remember, OpenShift is looking for some things in specific directories.

$ git commit -a -m "fixing OpenShift merge"

Once the merge is complete you can git push the master branch up to OpenShift (note the addition of master at the end to specify branch):

$ git push ssh://284bdd9fd9764803939ac5c309634ee6@myapp-mcgrath.rhcloud.com/~/git/myapp.git/ master

Next, git push to your upstream repo as normal and both git repos should now be in sync. Take a look at git’s documentation to alter your .git/config directory to make it easier to push to each remote repo.

Can I use DSA keys with my OpenShift Online account?

OpenShift now supports both RSA and DSA keys for communication between client and OpenShift Online.

Does OpenShift Online support outgoing email?

OpenShift Online supports limited outgoing email by default, but has a very strong spam filter. You should consider using a third party email service such as Sendgrid or MailGun.

You can also use your own authenticated email service such as Gmail, Yahoo Mail, Outlook, or your own private email server.

How do I see how many apps I have deployed?

The web console will list the numbers of applications you have deployed.

You can also use the following rhc command:

$ rhc apps

How do I look up my namespace?

Log into the web console and click My Account. This will display your namespace and give you the opportunity to change it.

You can also use the following rhc command:

$ rhc domains

To rename your namespace:

$ rhc domain-rename <old_name> <new_name>
You can only rename an empty domain at this time. You will need to delete your applications and recreate them if you need to change your namespace.

Can I have multiple namespaces?

OpenShift Online Free Plan users are allowed one namespace/domain per username.

OpenShift Online Bronze and Silver Plan users are allowed two namespaces/domains per username.

Evaluating the traffic to your OpenShift application

One way to do this is by using Piwik or Google Analytics.

You can also use:

$ rhc snapshot-save <app_name>

…​to get the logfiles from your running app, which you can run through a logfile analyzer like AWStats.

Another way of getting the application log files is to use the rhc scp command. See the Common RHC commands for details.
Only some cartridges do provide HTTP requests logging suitable for traffic estimates.

How do I find scheduled down time?

You can either visit the Status Page or run rhc servers to find the status of the OpenShift Online service. You can also follow @openshift_ops on Twitter.

Does OpenShift have restrictions as to what applications/content I can deploy?

In order provide the best possible service to our users. We do not allow content that is malicious or contains technology that may damage, interfere with, or intercept any system, program or data. For a full list of restricted content, please take a look at Acceptable Use Policy

Using .bash_profile and .bash_history on OpenShift gears

.bash_profile and .bash_history are available on all OpenShift gears. They are located in ~/app-root/data/ and are r/w.