Search

11.2. Creating an Application

download PDF
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.
Table 11.1. Options When Creating New Applications
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.
Creating a Non-Scalable Application

Create a non-scalable application in the default domain with the following command:

$ rhc app create App_Name Cart_Name

Example 11.1. Creating a Non-Scalable Application

$ rhc app create racer php-5.4
Application Options
-------------------
Domain:     mydomain
Cartridges: php-5.4
Gear Size:  default
Scaling:    no

Creating application 'racer' ... done


Waiting for your DNS name to be available ... done

Cloning into 'racer'...
The authenticity of host 'racer-mydomain.rhcloud.com (50.19.129.28)' can't be established.
RSA key fingerprint is cf:ee:77:cb:0e:fc:02:d7:72:7e:ae:80:c0:90:88:a7.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'racer-mydomain.rhcloud.com,50.19.129.28' (RSA) to the list of known hosts.

Your application 'racer' is now available.

  URL:        http://racer-mydomain.rhcloud.com/
  SSH to:     52ae91b8dbd93c8c43000001@racer-mydomain.rhcloud.com
  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.

Creating a Scalable Application

Create a scalable application by adding the -s parameter to the command:

$ rhc app create App_Name Cart_Name -s

Example 11.2. Creating a Scalable Application

$ rhc app create racer php-5.4 -s

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 11.3, “Cloning an Existing Application” for more information.
Creating an Application from a Downloadable Cartridge

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 

Creating an Application in a Specific Domain

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

When multiple applications are created in a domain, the application URLs are as follows:
  • http://app1-domain.example.com
  • http://app2-domain.example.com
Creating an Appliation With Jenkins Continuous Integration

Create an application and enable Jenkins continuous integration:

$ rhc app create App_Name Cart_Name --enable-jenkins Jenkins_App_Name

This command creates a Jenkins application, and then adds the Jenkins client cartridge to the specified application.

Example 11.3. Creating an Application With Jenkins Continuous Integration

$ rhc app create mynewapp php-5.4 --enable-jenkins myjenkinsapp
Application Options
-------------------
Domain:     mydomain
Cartridges: php-5.4
Gear Size:  default
Scaling:    no

Creating application 'mynewapp' ... done


Setting up a Jenkins application ... done

  Jenkins created successfully.  Please make note of these credentials:

   User: admin
   Password: wEXesNXyEe1M

Note:  You can change your password at: https://myjenkinsapp-mydomain.rhcloud.com/me/configure

Setting up Jenkins build ... done

  Associated with job 'mynewapp-build' in Jenkins server.

Waiting for your DNS name to be available ... done

Cloning into 'mynewapp'...
The authenticity of host 'mynewapp-mydomain.rhcloud.com (54.234.56.174)' can't be established.
RSA key fingerprint is cf:ee:77:cb:0e:fc:02:d7:72:7e:ae:80:c0:90:88:a7.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'mynewapp-mydomain.rhcloud.com,54.234.56.174' (RSA) to the list of known hosts.

Your application 'mynewapp' is now available.

  URL:        http://mynewapp-mydomain.rhcloud.com/
  SSH to:     52b10d7d2587c8415000012c@mynewapp-mydomain.rhcloud.com
  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.
Creating an Application in a Specific Region

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

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
If a region is not specified, one is picked randomly based on the regions available.
Creating an Application with Custom Code

To create an application using code from a Git repository, specify the URL:

$ rhc app create --from-code URL

The code from the specified URL becomes the initial contents of the application.
Creating an Empty Application

For build or other testing purposes, create an application of no specific type with the DIY cartridge:

$ rhc app create App_Name diy

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.
Red Hat logoGithubRedditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.