11.2. Creating an Application
Prerequisites:
rhc app create
command and using the command options to supply the required information, such as the type of web framework to be used with the new application. Note that if multiple versions are available for the specified web framework cartridge, you are prompted to specify the version number to use for the new application.
Option | Description |
---|---|
-n, --namespace [NAME] | Domain where you wish to create the application. |
-g, --gear-size [SIZE] | Gear size determines how much memory and CPU a cartridge consumes. |
-s, --scaling | Creates a scalable application. |
--from-code [URL] | URL to a Git repository that becomes the initial contents of the application. |
-a, --app [NAME] | Name for the application to be created. |
--enable-jenkins [NAME] | Enables Jenkins continuous integration, and creates a Jenkins application if one does not already exist. The default name is 'jenkins' if a name is not specified. |
--region [NAME] | Specifies the region in which the application will be created. |
Create a non-scalable application in the default domain with the following command:
$ rhc app create App_Name Cart_Name
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.
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
Note
Replace the web framework type with the URL of the manifest for the hosted cartridge to create an application from a downloadable cartridge:
$ rhc app create App_Name https://www.example.com/manifest.yml
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
- http://app1-domain.example.com
- http://app2-domain.example.com
Create an application and enable Jenkins continuous integration:
$ rhc app create App_Name Cart_Name --enable-jenkins Jenkins_App_Name
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
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
To create an application using code from a Git repository, specify the URL:
$ rhc app create --from-code URL
For build or other testing purposes, create an application of no specific type with the DIY cartridge:
$ rhc app create App_Name diy
git push
and a .openshift/action_hooks/
.
Note
git push
command the application is automatically deployed and visible to customers.