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.
Expand
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:
Copy to ClipboardCopied!Toggle word wrapToggle overflow
Example 11.1. Creating a Non-Scalable Application
rhc app create racer php-5.4
$ 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.
Copy to ClipboardCopied!Toggle word wrapToggle overflow
Creating a Scalable Application
Create a scalable application by adding the -s parameter to the command:
Copy to ClipboardCopied!Toggle word wrapToggle overflow
Example 11.2. Creating a Scalable Application
rhc app create racer php-5.4 -s
$ rhc app create racer php-5.4 -s
Copy to ClipboardCopied!Toggle word wrapToggle overflow
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:
Copy to ClipboardCopied!Toggle word wrapToggle overflow
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 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.
Copy to ClipboardCopied!Toggle word wrapToggle overflow
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:
Copy to ClipboardCopied!Toggle word wrapToggle overflow
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.
Aiutiamo gli utenti Red Hat a innovarsi e raggiungere i propri obiettivi con i nostri prodotti e servizi grazie a contenuti di cui possono fidarsi. Esplora i nostri ultimi aggiornamenti.
Rendiamo l’open source più inclusivo
Red Hat si impegna a sostituire il linguaggio problematico nel codice, nella documentazione e nelle proprietà web. Per maggiori dettagli, visita il Blog di Red Hat.
Informazioni su Red Hat
Forniamo soluzioni consolidate che rendono più semplice per le aziende lavorare su piattaforme e ambienti diversi, dal datacenter centrale all'edge della rete.